UITableView clicked and no cell selected,but long press trigger cell selected

六眼飞鱼酱① 提交于 2019-12-24 12:26:13

问题


environment: Xcode 6.1.1 ;Storyboard issue: I'm creating some list with UITableView embed in a UIViewContrller instoryboard ,and all the cell can't be selected by click,but can be selected by long press unexpectedly. I don't know why and I can't figure it out . I hope someone help me . Thinks.


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        HBillCell *cell = [tableView dequeueReusableCellWithIdentifier:@"billCell"];
        [cell loadInfo:self.dataSource[indexPath.row]];
        return cell; 
    }
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        [self performSegueWithIdentifier:@"bill2detail" sender:nil];
    } 


回答1:


Thank you all.This problem comes up because of the tap gesture added on the root view of view controller in the base class by myself.

- (void)viewDidLoad {
    [super viewDidLoad];
    UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBlankAction:)];
    tgr.delegate = self;
    [self.view addGestureRecognizer:tgr];
}

I'd figured it out.



来源:https://stackoverflow.com/questions/28927909/uitableview-clicked-and-no-cell-selected-but-long-press-trigger-cell-selected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!