簡體   English   中英

在ios7中,tableView:didSelectRowAtIndexPath:不被調用

[英]In ios7 tableView:didSelectRowAtIndexPath: is not called

當我遇到一個奇怪的問題時,我正在調整我的項目以調整ios7:在ios7中未調用委托方法“ tableView:didSelectRowAtIndexPath:”,它在以前的ios版本中運行良好。我想知道是否在ios7中更改了某些特定屬性。編碼:

- (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;
    }

    ....
}

在您的viewController.h文件中添加以下內容

 <UITableViewDelegate,UITableViewDatasource> 

還將tableview的委托和數據源連接到.xib的文件所有者

對不起,我找到了我需要設置的答案

[cell setExclusiveTouch:YES]

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM