Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load image from bundle with iOS

I added to my project a .bundle folder filled with some images. Is it correct refer to this image directly writing something like ?:

[UIImage imageNamed:@"imageInBundle.png"]; 

Which is the best method to access and use these images ?

like image 331
MatterGoal Avatar asked Apr 14 '11 14:04

MatterGoal


2 Answers

If that does not work, try

[UIImage imageNamed:@"yourbundlefile.bundle/imageInBundle.png"]; 

Best

like image 194
Ignacio Pascual Avatar answered Sep 18 '22 01:09

Ignacio Pascual


That is correct, imageNamed: will search your main bundle. Images in your project, even if they are in different groups in your Project Navigator will be in your main bundle and can be accessed directly by name.

like image 24
Joe Avatar answered Sep 19 '22 01:09

Joe