I'm trying to add an index to an alphabetically sorted table view. At the moment, I have the index appearing and working correctly (it jumps to the correct section). However, each section has every cell in it, rather than just cells which start with the sections letter.
I'm a bit confused as to what I should return for numberOfRowsInSection - as it's obviously going to be different for each section, and subject to change so needs to be worked out dynamically.
My cellForRowAtIndexPath currently looks like this:
I know that this too will obviously have to change, but I'm really not sure how. If anyone could help me out and point me in the right direction it would be much appreciated
I'm a bit confused as to what I should return for numberOfRowsInSection - as it's obviously going to be different for each section, and subject to change so needs to be worked out dynamically.
My cellForRowAtIndexPath currently looks like this:
Code:
My_Class *listItem = [listItemArray objectAtIndex:[indexPath indexAtPosition:1]];
NSString *CellIdentifier = [NSString stringWithFormat:@"%d", listItem.listItemID];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell.text = listItem.name;
}
// Set up the cell...
return cell;
I know that this too will obviously have to change, but I'm really not sure how. If anyone could help me out and point me in the right direction it would be much appreciated