简体   繁体   中英

Xcode6 image view + Asset Catalog. Image not showing

iOS Newbie here. After the announcement of Xcode 6 and SWIFT, I decided to give it a try.

Now I am three days into iOS development and found a very strange problem.

Problem: On a empty project with only 1 ImageView control, I can't figure out how to display a PNG image.

Here is what I did: 1) Create a single view project. 2) Create a Asset Catalog, add image set, add PNG image. 3) In storyboard, drag Image View Control into the board.
4) Assign image & background color to Image View 在此输入图像描述

Now hit run and simulator shows only the image background but not the image.

Xcode 6, target iOS7.0, ipad 2 simulator(7.1).

Tested the same procedure in Xcode 5 and the image shows correctly. However, I wish to learn SWIFT + Xcode 6. Using Xcode 5 isn't really a solution.

Here is the project package if you care to test it.

I've had a similar problem, but for an Objective-C project. I found this "problem" listed in the release notes:

"Images from asset catalogs in projects with a minimum deployment target of iOS 7 or OS X 10.9 will be available when running on iOS 8 and OS X 10.10, but not iOS 7 and OS X 10.9."

Which I took to mean that you will not see the images if the target device/simulator is not running iOS 8. I've partially confirmed this by deleting the images from the Images.xcassets and copying them into the project as files, then they get loaded and displayed correctly.

So, I take this mean that I should avoid using the Images asset catalog for iOS 7 targets for this release and just copy the images in as files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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