所以这让我疯了,每当我在UITableView中点击一个项目它什么都不做,但是当我在大约3-5秒后按住UITableViewCell它决定向前移动并做我想要的..任何想法为什么这可能发生了什么?
这是我的代码
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 100; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ _cell = [_arrayItems objectAtIndex:indexPath.row]; _cell = nil; static NSString *AutoCompleteRowIdentifier = @"AutoCompleteRowIdentifier"; _cell = (CustomWidget *)[tableView dequeueReusableCellWithIdentifier:AutoCompleteRowIdentifier]; if (_cell == nil) { _cell = [[CustomWidget alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AutoCompleteRowIdentifier title:[_arrayItems objectAtIndex:indexPath.row] subTitle:@"Custom subtitle"]; } _cell.textLabel.text = [_arrayItems objectAtIndex:indexPath.row]; _cell.textLabel.hidden = YES; return _cell; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _arrayItems.count; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; _passedInPageTitle = selectedCell.textLabel.text; [self openDetailPage]; }
apb.. 9
我发现我的答案在这里 -我有一个UITapGestureRecognizer
对UITableView
的父视图,这是捕捉龙头.