UIButton也会在触摸单元格时突出显示 [英] UIButton also highlighting when cell is touched
问题描述
我在表格单元格上有一个 UIButton
,它弹出( touchUpInside
)一个 UIAlertView
并询问用户是否要删除与该单元格关联的文件.否则,触摸单元格本身会突出显示该单元格,然后移至下一个级别以显示内容.问题在于,当单元格被选中
和 highlighted
时,该按钮也会突出显示,从而使用户感到困惑.
I've a UIButton
on my table cell that pops up (touchUpInside
) a UIAlertView
and asks the user if they want to delete the file associated with that cell. Otherwise, a touch on the cell itself highlights the cell then moves to the next level to reveal content. The issue is that when the cell is selected
and highlighted
, the button highlights as well, confusing the user.
如何告诉按钮忽略对单元格的触摸或让单元格单独留下该死的按钮.
How can I tell the button to ignore touches to the cell or tell the cell to leave the damn button alone.
推荐答案
我尝试了这种解决方法,但结果复杂.虽然它将使 button
返回其 normal
状态,但从正常更改为 selected 时会出现短暂的闪烁
,然后又恢复正常.
I tried this workaround with mixed results. While it will return the button
to its normal
state, there is a brief flicker as it changes from normal, to selected
, and back to normal again.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *cell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.button.highlighted = NO;
}
这篇关于UIButton也会在触摸单元格时突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!