简体   繁体   中英

Bundle behaviour differs inside ios simulator and actual device

At the moment I'm trying to manage a large number of images by putting them in a folder and naming the folder [something].bundle, and dragging these into XCode.

Weird thing right now is that, if I run this in the simulator, I can get access to these images with [UIImage imageNamed:] as if all the files are within the main bundle; but running the same code on a actual device (iPad 4.3.3 in this case), imageNamed: doesn't work.

Can someone explain to me why this might be?

You cant use imageNamed: with items in a bundle.

You need to either to imageWithContentsOfFile: or imageWithData:

See (iPhone) Use external image in UIImage imageNamed for similar examples.

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