t3hcakeman
t3hcakeman

Reputation: 2339

How do you show UILabel over a UIImageView (Objective-C)?

I am developing an iPhone app and I cannot see the UILabel I made in Interface Builder, but I can see the UIImageView I made programmatically. I am a complete noob to Objective-C so please tell me what I can do to fix this.

Upvotes: 4

Views: 8791

Answers (4)

Ann
Ann

Reputation: 485

I'm not sure, but click on your xib file. On the second column on your left you'll see Object, and below there's "View" with an arrow.If you click on it(the arrow) you'll see everything you have in this View. I suppose you have Button and ImageView. They shouldn't go in this way. Change their order. If you first have Button,then ImageView, you won't see your Button,cause it's under the image.

Upvotes: 0

Janak Nirmal
Janak Nirmal

Reputation: 22726

Gussing that you are adding image in view where label is existing than use following code to see the label over the image view.

[self.view addSubView:yourImageViewName];
[self.view bringSubviewToFrong:yourImageViewName];

Upvotes: 1

user866214
user866214

Reputation:

Try adding the label after the image view :

[mainView addSubview:imageView];
[mainView addSubview:label];

Also make sure the label's frame makes it visible on the screen.

Upvotes: 3

Nekto
Nekto

Reputation: 17877

Drag you UILabel in IB to bottom of your stack subviews of view where your UIImageView is placed.

enter image description here

Upvotes: 11

Related Questions