IOS: how to send image back and forth

In my storyboard, I have a view by which I have ImageView and Button . ImageView is currently closing my button, and I would like to place the button above ImageView. I found similar topics that were resolved by going to "Editor" → "Arrange" → "Send to Front", however this was done for UIViews , and this option is passive for ImageView and Buttons .

So how can I send my ImageView in the background? The best solution for this is to add an extra look for Button only, and then bring it to the front?

+6
source share
3 answers

You can change your views on the storyboard:

enter image description here

The first view in order will be hidden by the following view.

Perhaps these options will also be useful for your running application:

 myImageView.layer.zPosition = -5; myImageView.layer.zPosition = 5; 

Like in HTML / CSS.

+12
source

The solution was to move the view components up and down in the "Document Structure" section.

+1
source

Alternatively, you could solve the problem using the bringSubviewToFront function:

 [self.view bringSubviewToFront:self.yourButtonControl]; 
+1
source

Source: https://habr.com/ru/post/981767/


All Articles