Bringing a routine to a UITableViewCell to the forefront

I added a bunch of UILabel to the UITableViewCell contentView , some of which may overlap. When I click on any of the shortcuts, I want to trigger some actions. In addition, I want to raise the label with the inscription up.

Using UITapGestureRecognizer on shortcuts, I can figure out which one is involved and perform actions. But casting a shortcut with overlap and overlap to the fore does not work. This is what I am trying:

 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..."); } } 

I get the NSLog output above, so I know that bringSubviewToFront is called in the corresponding contentView cell. But no changes to the layout of the subview.

Ideas?

+4
source share
2 answers

One thing to learn is the position at the uitablviewcell level.

This has been successfully placed on tableviewcell in front of another for me:

  cell1.layer.zPosition=3 ;//above cell2.layer.zPosition=2 ;//below 
+13
source

bringSubviewToFront: didn't work for me either

Try insertSubview:belowSubview: where the last view is a super view such as a tab bar, navigation bar, table view.

+3
source

All Articles