I am trying to override different background imagery to run on my application. I used the code from this question; set background images for Iphone 3g, Iphone 4s and Iphone 5
Thankfully the code is simple. I also set these in the .m file just in case.
.h
@property (retain strong) UIImage* Image
@property (retain, strong) UIImageView.
.m
@interface ViewController ()
@end
@implementation ViewController
//SYNTHESIZE JUST IN CASE
@synthesize backgroundImageView=backgroundImageView;
@synthesize Image=Image;
- (void)viewDidLoad
{
//SETS A UIIMAGEVIEW TO BE SET TO A CUSTOM UIIMAGE (JPG)
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:Image];
[backgroundImageView setFrame:[[self view] bounds]];
[[self view] addSubview:backgroundImageView];
//I EXCPECTED THIS NEXT LINE OF CODE TO WORK TO SET A SEPARATE BACKGROUND FOR IPAD...
UIImage *Image = [[UIImage alloc]init];
if ([[UIScreen mainScreen] bounds].size.height == 568) {
Image = [UIImage imageNamed:@"11@2x.jpg"];
}
else
//THIS ELSE STATEMENT IS THE IMAGE THAT ACTUALLY RASTERIZES FOR BOTH IPAD AND IPOD TEST DEVICES
{
Image = [UIImage imageNamed:@"7@2x.jpg"];
}
self.view.backgroundColor = [UIColor colorWithPatternImage:Image];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
The override isn't working quite as expected. Only the else statement runs no matter what image i set in the if statement.
My question; are the dimensions (568) in the if statement correct to rasterize a separate image for iPad devices? If not please let me know, thanks.
Additional info: deployment target: 6.1 Additional info: i received an error at run time (even though it still ran) akin to something about a discrepancy between my nib file and story board. I am not using a nib though. ?