UITableView 中的 GLTapLabel [英] GLTapLabel Inside UITableView
问题描述
我正在使用 GLTapLabel
在我的 UITableView
中显示我的文本.它会有一些链接,我可以点击 GLTapLabels
,但是当我点击这些链接时,tableView:didSelectRowAtIndexPath:
会触发.那么如何检测这些链接中的点击操作?
I'm using GLTapLabel
to display my text in my UITableView
. It will have some links I can click on as GLTapLabels
, but when I click those links the tableView:didSelectRowAtIndexPath:
fires. So how can I detect the click action in those links?
推荐答案
实施 tableView:willSelectRowAtIndexPath:
并为任何返回 nil
您不想被选中的行.
Implement tableView:willSelectRowAtIndexPath:
and return nil
for any row you don't want to be selected.
返回值确认或更改所选行的索引路径对象.如果您希望选择另一个单元格,则返回一个 NSIndexPath 对象而不是 indexPath.如果您不想选择该行,请返回 nil.
Return Value An index-path object that confirms or alters the selected row. Return an NSIndexPath object other than indexPath if you want another cell to be selected. Return nil if you don't want the row selected.
例如,仅防止在第一部分中选择:
For example, to only prevent selection in the first section:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
return nil;
}
return indexPath;
}
<小时>
您还可以尝试在 GLTapLabel
上设置 exclusiveTouch
或覆盖其 hitTest:withEvent:
,如 为什么 UIView 的exclusiveTouch 属性没有阻塞?.
You can also try setting exclusiveTouch
on the GLTapLabel
or overriding its hitTest:withEvent:
as described in the answer to Why is UIView exclusiveTouch property not blocking?.
这篇关于UITableView 中的 GLTapLabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!