我创建了带有不同按钮的自定义单元格,按钮总是正确地调用它们的操作,但我的问题是,如果我快速单击按钮,它不会突出显示,而是像我之前说的那样调用它的操作。我需要慢慢点击几秒钟(1-2秒)才能看到高亮显示的状态。我认为这可能是因为首先它占据了表视图滚动视图的焦点,但我不知道如何解决这个问题。
请帮忙!
试试这个代码:使单元格选择类型none
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}