UIImageView 图像不显示 [英] UIImageView image not showing up
问题描述
_topBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 45)];
UIImageView *bar = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top_bar.png"]];
bar.frame = CGRectMake(0, 0, 320, 45);
[_topBar addSubview:bar];
_up = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"up.png"]];
[_topBar addSubview:_up];
_up 没有出现在我的构建中.如果我将up.png"替换为我的资源文件夹中的任何其他图像,它会显示,但 up.png 拒绝.有什么我可以做的吗?我只使用一个 UIImage 初始化它,一个静态分配的 UIImageView,删除并重新添加 .png 文件,将它们从资源文件夹中取出并将它们放在其他地方,重新保存它们,除了扔掉它们之外的一切.
_up does not show up in my build. If i exchange the "up.png" for any other image in my resources folder, it shows up, but up.png refuses to. Is there anything I can do? I've initialized it using just a UIImage, a statically allocated UIImageView, removed and re-added the .png files, took them out of the resources folder and put them somewhere else, re-saved them, everything aside from throwing them out.
该文件被保存为 up.png 但实际上是 up.png.psd.只是阅读细则的问题.
The file was saved as up.png but was really up.png.psd. just a matter of reading the fine print.
推荐答案
在 Finder 中检查种类.它可能不是 png,因此不会显示.
Check the Kind in Finder. Its probably not a png and therefore wouldn't display.
自从您发表评论以来,我现在知道这是真的:)
I now know this to be true since you commented :)
这篇关于UIImageView 图像不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!