我正在尝试为用户调整背景静态UIImageView
(来自Nib
文件)的大小iPhone5
。不幸的是,以下代码似乎对背景视图的大小没有任何影响。
有谁知道为什么?提前感谢您提供的任何帮助。
视图控制器.m:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
device = appDelegate.deviceType;
NSLog(@"The device platform is: %@", device);
if ([[device substringToIndex:8] caseInsensitiveCompare: @"iPhone 5"] == NSOrderedSame) {
[background sizeThatFits:CGSizeMake(320, 504)];
}
else {
[background sizeThatFits:CGSizeMake(320, 416)];
}
...
//Note: 'background' is declared in `ViewController.h` as, `IBOutlet` `UIImageView` *background, and is linked to the image view in ViewController_iPhone.xib