in one of my views I have a full screen button with an image as a background set with my story board, when running on a four inch screen the image looks fine but on a 3.5 the image is cut off by the lack of screen real estate. Is it possible for the image to re size to fit either screen or a way I can set the image in the code or storyboard for it to look proper on both screen? Thanks
Asked
Active
Viewed 299 times
1

user3381665
- 1,131
- 3
- 11
- 16
2 Answers
1
Depending on your requirements you have two possible solutions:
imageView.contentMode = UIViewContentModeCenter; // Other options too...
imageView.clipsToBounds = YES;
OR create two different image assets and load via code something like:
if ([UIScreen mainScreen].bounds.size.height == 568)
{
// Load tall image
}
else
{
// Load short image
}

John Erck
- 9,478
- 8
- 61
- 71
-
if i where going with method two how would i load the images for the button – user3381665 May 21 '14 at 23:22
-
If you're working with a storyboard which it sounds like you are, drag and drop to make an outlet to your UIImageView (to your view controller's .m file) and then in your `viewDidLoad` method write some code like such, `self.myImageView.image = [UIImage imageNamed:@"my-tall-image"];`. – John Erck May 21 '14 at 23:26
-
No problem. Good luck w/ your app. – John Erck May 21 '14 at 23:33