I have a UITableView that I have set-up with 2 sections. The code below is showing the same cell text all over the UITableView. My question in short is, how do you assign sections NSArrays?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [toStartPicker dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
}
cell.textLabel.text= [nameJan objectAtIndex:indexPath.row];
cell.detailTextLabel.text= [subTitlesJan objectAtIndex:indexPath.row];
UITableViewCell *cellTwo = [toStartPicker dequeueReusableCellWithIdentifier:@"cellTwo"];
if (cellTwo == nil) {
cellTwo = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cellTwo"];
}
cellTwo.textLabel.text= [nameFeb objectAtIndex:indexPath.row];
cellTwo.detailTextLabel.text= [subTitlesFeb objectAtIndex:indexPath.row];
return cell;
}
Make the method like this
Also, make sure the following methods look like this