【发布时间】: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