0

I am having trouble figuring out how to place a UIButton with a custom image above the text in the UITableViewCell that it belongs to. Is there a way to reorder the items outside of the visible storyboard hierarchy?

In the storyboard, I have tried:

  1. Setting the button to opaque.
  2. Unchecking 'Clip Subviews' in for the cell view.

Nothing I tried works. Below is a picture of how it appears now.

Notice how the text is in front of the button?

Timothy Swan
  • 623
  • 3
  • 9
  • 21

2 Answers2

0

If I understand your question correctly, you need the following code to insert your subview above the UILabel.

[self.view insertSubview:<#(UIView *)#> aboveSubview:<#(UIView *)#>];

Hope that helps!

  • The problem with me doing this is that the button is now resized greatly and they are no longer linked to their actions. However, I am starting to think that my images are partially transparent because I can see that where the text intersects the image, the text color changes. – Timothy Swan Jul 30 '14 at 23:12
0

I figured out what I needed to do:

UIButton * button = (* obtain button *)
[button.superview bringSubviewToFront:button];
Timothy Swan
  • 623
  • 3
  • 9
  • 21