Welcome to the iMore Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread AuthorThread Author   #1  
    vertmonkee's Avatar
    iPhone Nanite

    1 Posts

    Default Table row selection shows previously selected row's data

    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

    -  (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"
    										  cancelButtonTitle:@"Cancel it"
    	[alert show];
    	[alert release];
    	[message release];
    I've also zipped up the whole application for download at


    If anyone can solve why the previous row's data is being selected I will be very grateful.


Posting Permissions