Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS: How to send an Image View back and front

In my storyboard I have a view on which I have an ImageView and a Button. The ImageView is currently covering my button and I would like to put the button over the ImageView. I found similar topics which were solved by going to "Editor" -> "Arrange" -> "Send to Front", however that was done for UIViews and this option is passive for ImageView and Buttons.

So how can I send my ImageView to background? Is the best solution for this to add an additional view only for the Button and then bring it to front?

like image 469
Eduard Avetisyan Avatar asked Jan 30 '15 13:01

Eduard Avetisyan


2 Answers

You can rearrange your views on storyboard:

enter image description here

First view in order will be hidden by next view.

Maybe this options will be also useful for your running application:

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

Like in HTML/CSS.

like image 137
Alexander Perechnev Avatar answered Oct 15 '22 10:10

Alexander Perechnev


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

like image 40
Eduard Avetisyan Avatar answered Oct 15 '22 10:10

Eduard Avetisyan