问题
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