Reputation: 1712
I have been trying to add a label on top of an image but the label is under the image and I've tried turning AutoLayout off, adding constraints and moving tried moving the label on top of and on bottom of the UIImageView in the View controller scene but its still under neither. Anybody know a quick fix?
Upvotes: 1
Views: 3062
Reputation: 437482
Your view hierarchy looks OK (i.e. the label is further down in the view hierarchy than the image view, meaning that it will appear "over" the image view). If you're not seeing the label, it either doesn't have text in it or the constraints are not defined properly.
I'd suggest running the app through Xcode and then clicking on the "view debugger":
Then you can examine where precisely the label is (confirming that it is above the image view) and what its frame
is (i.e. perhaps your other constraints are not defined properly) and what text
it contains (perhaps it's in the right place but just doesn't have text to show).
You can either navigate through the view hierarchy in the left panel or rotate and expand the wireframe rendition in the main panel.
Upvotes: 1
Reputation: 2586
I guess that is due to your arrangement of elements and constraints in IB. Try removing all the constraints and see if you have the label on top of the image. If so - add constraints gradually and observe not to launch your label off the screen.
Upvotes: 0