2012-10-20 28 views
2

我在iPhone 5上显示背景图像时出现问题。我已将3张图像添加到该项目。第一个是main_background.png,第二个是[email protected],第三个是[email protected]。在init方法中我设定的图像,以这样的背景:设备选择错误的视网膜图像

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) 
    { 
     self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"main_background"]]; 
    } 
    return self; 
} 

我跑在我的iPhone 5的应用程序,它选择了@ 2倍的图像。它开始在y轴上重复它。我做错了什么,以及如何解决这个问题?

+0

确保将X-stupid-code **实际**复制到设备上。 – 2012-10-20 09:34:59

+0

如何检查? – Majster

回答

4

你需要自己处理。 使用后缀[email protected]仅适用于启动图像。

+0

啊!就是这样了。 iOS是愚蠢的。 – 2012-10-20 09:38:07

+0

哇,令人难以置信。感谢上帝,我在GitHub上找到了这个https://github.com/erica/uidevice-extension/。它使这个过程更容易:) – Majster

+0

@Majster:'colorWithPatternImage:'不知道一个1136x640像素的图像具有Retina解决方案,即使它被命名为“[email protected]”,所以这也可能是有用的:http://stackoverflow.com/questions/12847541/ios-colorwithpattern-using-a-custom-iphone5-image –