I used tableViewCell and plist files with data in my project. I want make event with click on of my all of cells. View calls text.xib. Code:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
test *testVar = [[test alloc] initWithNibName:@"test" bundle:nil];
if ([[countries objectAtIndex:indexPath.row] isEqual:[countries objectAtIndex:indexPath.row]]){
[testVar setTitle:@"Test"];
}
[self.navigationController pushViewController:testVar animated:YES];
[testVar release];
}
countries – my array of date, but it’s primary label of tableViewCell.
indexPath.sectionandindexPath.roware different things. Let’s imagine an array of arrays.indexPath.sectionwill refer to a single array into our array of arrays.indexPath.rowwill refer to an element into an array, into our array of arrays (You can see a graph on this link).In the code you show above, you have this comparison, into an if statement:
You’re trying to compare objects of the same array, so I presume that the code below never executes because the if statement is always false. Maybe it could be true if you touch the very first row of the table.
Anyway, check if you correctly added the delegate for UITableView.