iOS: How to use images in custom bundle in Interface Builder?

Make sure the bundle is getting copied over in the “Build Phases” of the project settings for the target.

Also, try setting them progrmatically and see if they show:

myImageView.image = [UIImage imageNamed:@"MyBundle.bundle/images/picture1.png"];

I just tried this in my project and found that what you need to do is specify the image with the bundle name in front like this:

Image in IB

In the IB the image will look broken:

Broken

but when you build and run your project the image will show correctly.

So, in your case, use MyBundle.bundle/images/picture1.png in the actual Interface Builder Image box.

Also, when you dont put the bundle name in front, you get this warning when you load the view with the bundle image:

2011-10-12 08:22:16.360 UTDebug[721:11c03] Could not load the "map.png" image referenced from a nib in the bundle with identifier "com.companyname.myproject"

Leave a Comment