简体   繁体   English

图像未显示在较新的iPad设备(如iPad Air,iPad3)上,但显示在模拟器iOS 8.1上

[英]Images not displayin on newer iPad devices like iPad Air, iPad3 but displaying on simulator iOS 8.1

I am working on app that runs only on iPad. 我正在开发仅在iPad上运行的应用程序。 Images from 'Resources' folder are not being displayed on newer generation iPad's and iPad Air but they are displaying fine when iPad Air is selected as target on Xcode Simulator. “资源”文件夹中的图像未显示在新一代iPad和iPad Air上,但是当在Xcode Simulator中将iPad Air选择为目标时,它们显示得很好。 We have both @1x (Image size: 14*14) and @2x (Image size: 28*28) images in the project. 在项目中,我们同时具有@ 1x(图像尺寸:14 * 14)和@ 2x(图像尺寸:28 * 28)图像。

Also, I checked the files names and they match. 另外,我检查了文件名,它们是否匹配。 Any help or suggestions would be appreciated. 任何帮助或建议,将不胜感激。 Thanks a lot 非常感谢

Please find the code below: 请在下面找到代码:

@property (nonatomic, weak) UIButton *expandAllButton; @属性(非原子的,弱的)UIButton * expandAllButton;

self.expandAllButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.expandAllButton.frame = CGRectMake(10, 10, 32, 44);
[self.expandAllButton setImage:[UIImage imageNamed:@"ExpandAll.png"] forState:UIControlStateNormal];

EDIT: If anyone facing the same problem, I solved it by changing the button to strong reference from weak reference. 编辑:如果有人面临相同的问题,我通过将按钮从弱引用更改为强引用来解决。 We had it weak reference when we had IBOutlet to the button but later we removed it and forgot to change it to strong reference. 当我们将IBOutlet应用于按钮时,它具有弱引用,但是后来我们将其删除,却忘记将其更改为强引用。

@property (nonatomic, strong) UIButton *expandAllButton; @property(非原子的,强的)UIButton * expandAllButton;

It seems like 64bit device issue. 看来是64位设备问题。 New device mentioned by you are 64bit devices. 您提到的新设备是64位设备。

Some other user have also same problem for 64 bit devices. 其他一些用户对于64位设备也有同样的问题。 Some images are not displaying from bundle in 64-bit device though implemented correctly. 尽管正确实现了某些图像,但是在64位设备中,捆绑包中未显示某些图像。

You may check this SO Answer . 您可以检查此SO Answer It may solve your problem. 它可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM