繁体   English   中英

iOS UITableViewCell必须长按才能选择项目

[英]iOS UITableViewCell Have To Hold A Long Press To Select Item

所以这让我疯了,每当我点击我的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];
}

我在这里找到了答案 - 我在UITableView的父视图上有一个UITapGestureRecognizer ,它捕获了水龙头。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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