Alex Rivera | Logout

Apple Interface Builder: adding subview to UIImageView

Asked 2010-03-10T09:00:08.230
56

I created UIImageView with the help of Interface Bulder. Now I want to place label inside it (as its subview). In code I can type something like: [myUIImageView addSubview:myUILabel]; But can I do it with the help of IB? I found the solution for UIView, but can't find something similar for UIImageView.

Edit
Report

1 Answer

-5

Use this code:

UIImage *image = [UIImage imageNamed:@"background.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self.view insertSubview:imageView atIndex:0];

(replace background.png with image) (replace atIndex:0 with whatever place in the .index root you want to insert the image and your off.

answered 2013-03-03T19:16:20.743

Your Answer