Re: Custom component fails to load images by name in a IBPlugin
Re: Custom component fails to load images by name in a IBPlugin
- Subject: Re: Custom component fails to load images by name in a IBPlugin
- From: Chris Hanson <email@hidden>
- Date: Fri, 19 Sep 2008 12:15:41 -0700
On Sep 19, 2008, at 10:21 AM, Dalzhim Dalzhim wrote:
I have packaged this component in a IBPlugin and designed a custom
inspector to configure my custom component at design time by
entering the names of the required images. However, my component
fails to load the images when it is being configured in Interface
Builder. It also used to fail to load when I ran the application
which uses the framework which includes this ibplugin, but I already
fixed that by searching for the image in the mainBundle.
When your plug-in is run under Interface Builder, +[NSBundle
mainBundle] will return Interface Builder's bundle rather than your
application's bundle. Your view might want to look for the resources
in its bundle — e.g., the bundle returned by [NSBundle bundleForClass:
[MyView class]] — for its images.
That way, when your view class is compiled into the Interface Builder
plug-in it will look in the plug-in for its images, and when it's
compiled into your application it will look in your application for
its images. And if you move your view to a framework that's used by
both your application and your Interface Builder plug-in, you can move
its images along with it and they'll be found there as well.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden