简体   繁体   中英

In ios7 tableView:didSelectRowAtIndexPath: is not called

I meagrate my project to adjust ios7 while I encountered a strange problem : the delegate method "tableView:didSelectRowAtIndexPath:" is not called in ios7 ,it works well in prior ios version.I was wonder if some specific property be changed in ios7 Here is the code:

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.tableView setDelegate:self];
    [self.tableView setDataSource:self];
    [self.tableView setAllowsMultipleSelection:NO];
    [self.tableView setMultipleTouchEnabled:NO];

}

- (void)tableView:(UITableView *)sender didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [sender deselectRowAtIndexPath:indexPath animated:YES];

    _currentContact = [contactArr objectAtIndex:indexPath.row];
    if ([_currentContact.accountNPC hasPrefix:@"0"]) {
        isContactToNPC = NO;
    }else{
        isContactToNPC = YES;
    }

    ....
}

Add the following in your viewController.h file

 <UITableViewDelegate,UITableViewDatasource> 

also connect the tableview's delegate and datasource to the File's Owner of .xib

I'm sorry,I found the answer I just need set

[cell setExclusiveTouch:YES]

Tks @ abhishekkharwar from https://stackoverflow.com/a/18826264/2396477

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM