Reputation: 390
I would like to add an UIImageView to this view. Can anyone help me please?
The problem is the compatibilities for 4/3.5 inch
I tryed this
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.bounds.size.height)];
[imageView setImage:[UIImage imageNamed:@"test.png"]];
[self.view addSubview:imageView];
but the image comes out of the screen!
Thank you!
Upvotes: 0
Views: 223
Reputation: 3937
Controllers are created with a default size and resized after viewDidLoad
. Depending on where you are creating your image view, it could cause you problems
Add this code:
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Also make sure that you don't have other views that you don't want to step over with your image, like the bottom toolbar
Upvotes: 1