我向UITableViewCell
的contentView
添加了一堆UILabel
视图,其中一些可能重叠。在点击任何标签时,我想触发一些操作。另外,我想把敲击标签放在最上面。将UITableViewCell中的子视图带到前面
在标签上使用UITapGestureRecognizer,我可以找出哪一个被点击并执行操作。但将轻拍和重叠标签带到前面不起作用。这就是我想:
UILabel *foundLabel = ....; // find the label
for (UITableViewCell *acell in theTable.visibleCells) {
UIView *cellContentView = acell.contentView;
if ([cellContentView.subviews containsObject:foundLabel]) {
[cellContentView bringSubviewToFront:foundLabel];
NSLog(@"should bring to front...");
}
}
我得到上面的NSLog
输出,所以我知道bringSubviewToFront
被称为在相应的单元格的contentView
。但是在子视图布局顺序中没有改变。
想法?
你找到了一个解决方案?有兴趣知道我有类似的问题。 –