开发者

UIImageView image not showing up on iPad Simulator

I have a Window in Interface Builder. I dragged a UIImageView onto the Window and selected the image that I wanted to be displayed from Image View Attributes -> Image View -> Image, and it was on the drop down list. I see the image on the Window screen.

However, when I go to File -> Simulate 开发者_StackOverflowInterface, it only displays a black screen.

Am I doing something incorrectly?


Perhaps your image is not part of the Simulator bundle, so the loading fails and your UIImageView will be blank.

Do the connection between image and UIImageView in code and it should show the image.

Like:

UIImage *image = [UIImage imageNamed: @"cell.png"];

Once you have an UIImage you can then set UIImageView this way:

[imageView setImage:image];


I had the same problem.

It may be because I renamed by UIViewController h, m and xib files.

I did rm -r on my Library/Application Support/iPhone Simulator/ folder. Quit the simulator. Then tried again. Worked.

Some strange caching issue, I suspect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜