【问题标题】:Images not displayin on newer iPad devices like iPad Air, iPad3 but displaying on simulator iOS 8.1图像未在 iPad Air、iPad 3 等较新的 iPad 设备上显示,但在模拟器 iOS 8.1 上显示
【发布时间】:2015-03-12 06:50:26
【问题描述】:

我正在开发仅在 iPad 上运行的应用程序。来自“资源”文件夹的图像不会显示在新一代 iPad 和 iPad Air 上,但当 iPad Air 被选为 Xcode 模拟器上的目标时,它们显示正常。 我们在项目中有@1x(图像尺寸:14*14)和@2x(图像尺寸:28*28)图像。

另外,我检查了文件名并且它们匹配。任何帮助或建议将不胜感激。非常感谢

请在下面找到代码:

@property (nonatomic, weak) UIButton *expandAllButton;

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

编辑:如果有人遇到同样的问题,我通过将按钮从弱引用更改为强引用来解决它。当我们有 IBOutlet 到按钮时,我们有它的弱引用,但后来我们删除了它并忘记将其更改为强引用。

@property (nonatomic, strong) UIButton *expandAllButton;

【问题讨论】:

  • 请发布您正在执行的代码
  • 请找内联代码
  • 如果您将代码修改为:[expandAllButton setImage:[UIImage imageNamed:@"ExpandAll"] forState:UIControlStateNormal];?
  • 我试过了,也没用

标签: ios


【解决方案1】:

这似乎是 64 位设备问题。您提到的新设备是 64 位设备。

其他一些用户对 64 位设备也有同样的问题。尽管正确实施,但某些图像在 64 位设备中无法从捆绑包中显示。

您可以查看此SO Answer。它可能会解决您的问题。

【讨论】:

  • 您好,我尝试了与上述链接相同的方法,但没有成功。还有其他想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-01
  • 2012-06-24
  • 1970-01-01
  • 2018-12-20
  • 2013-08-23
  • 1970-01-01
相关资源
最近更新 更多