I have just started the basics of an application using the tab bar template. In the second tab I have added a table view.
I added a new class to handle the table delegate and data source.
Everything works with switching to the second tab and displaying the table data.
The problem comes when I select a row in the table. When a row is selected it will pop up an alert view to tell the user which row was selected. When I select a row it highlights blue and nothing happens, then when I select another row it shows the alert view but display data from the last row.
This is my didSelectRowAtIndexPath method
I've also zipped up the whole application for download at
ianluckraft.co.uk/downloads/TabsAndTables.zip
If anyone can solve why the previous row's data is being selected I will be very grateful.
Thanks
I added a new class to handle the table delegate and data source.
Everything works with switching to the second tab and displaying the table data.
The problem comes when I select a row in the table. When a row is selected it will pop up an alert view to tell the user which row was selected. When I select a row it highlights blue and nothing happens, then when I select another row it shows the alert view but display data from the last row.
This is my didSelectRowAtIndexPath method
Code:
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *name = [listData objectAtIndex:[indexPath row]];
NSString *message = [[NSString alloc] initWithFormat:@"You choose %@", name];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Nice Selection"
message:message
delegate:self
cancelButtonTitle:@"Cancel it"
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
I've also zipped up the whole application for download at
ianluckraft.co.uk/downloads/TabsAndTables.zip
If anyone can solve why the previous row's data is being selected I will be very grateful.
Thanks