When I try to send a view to the back, it hides some of the buttons and labels in my view controller. The view I am sending to the back is a UIImageView. Does anyone have an opinion of what might be the problem?
Here is the code I am using:
UIImage *image = [UIImage imageNamed: @"background.jpg"]; UIImageView *backImage = [[UIImageView alloc] initWithImage: image]; [self.view addSubview: backImage]; [self.view sendSubviewToBack: backImage];
Then, when I am adding controls to self.view, they does not always show
I managed to get it roght by moving my code from init to loadView. I don't understand why that should make a difference, but hey.. it works!
If you are using UIView
's sendSubviewToBack:
or a similar message, you probably have your buttons inserted in the hierarchy under the UIImageView
. When a view moves in the hierarchy, all of its subviews move with it.
To fix this, you need to add your controls as subviews of the same view (possibly the UIWindow
) you added the UIImageView
to initially.
Without seeing your code, it's very difficult to be more precise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With