I ran into a really cryptic error. The first line of my UITableView returns 1 , and second returns 0 in indexPath! How is this possible?
In my `- (void) viewDidLoad` everything is still fine. I highlight the first line successfully with
currentRow = 0; [tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:currentRow inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];
I have a currentRow variable to track the selected row (another control changes depending on the currently selected one).
Now in my delegate function `didDeselectRowAtIndexPath` I have:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { ... NSLog(@"IndexPath: %@", [indexPath description]); }
The following is displayed in the log:
IndexPath: <NSIndexPath 0x79509d0> 2 indexes [0, 0] when I touch the second line and IndexPath: <NSIndexPath 0x79509d0> 2 indexes [0, 1] when I touch the first line.
No insertion or deletion of rows or sorting, etc., not even scrolling. This is a simple UITableView, grouped style, with 1 section and 3 rows. What could be the reason for this?
Thanks for your help,
S
objective-c iphone uitableview didselectrowatindexpath nsindexpath
Mundi Nov 07 '10 at 18:14 2010-11-07 18:14
source share