【发布时间】:2014-02-25 05:06:45
【问题描述】:
我需要澄清一下,我的图像大小为 640×1136,它设置为视图控制器背景全视图,这在 iOS 7 中设置得很好,因为状态栏与视图合并。
self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"iOS-7.png"]];
但在 iOS 6 中我无法设置 640×1136 的大小,此图像底部大小是隐藏的。如何在 iOS 6 中处理视图控制器背景上的图像
我该如何解决这个问题
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
imageView.contentMode = UIViewContentModeScaleToFill;
[imageView setImage:[UIImage imageNamed:@"iOS-7.png"]];
// self.view.backgroundColor = [UIColor colorWithPatternImage:imageView.image];
[self.view addSubview:imageView];
如果我使用上面的代码只能正常工作。感谢@Greg 的回答,但我需要知道为什么设置 self.view backgroundColor 会出现屏幕问题
【问题讨论】:
标签: ios iphone objective-c ios6 ios7