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: Jonathan Hess <email@hidden>
- Date: Mon, 22 Sep 2008 15:14:57 -0700
On Sep 22, 2008, at 1:09 PM, Dalzhim Dalzhim wrote:
Hello,
I will try to re-explain my problems with this Interface Builder
plugin I am trying to get working as I realised I have more than one
problem...
Problem #1
Once my MyComponent.ibplugin product is built I can run Interface
Builder through my project and use the plugin just fine. Although I
am unable to make the plugin load automatically in Interface Builder
when opening a nib file which links with my framework (which
includes the plugin). I have searched a lot on this issue and I
found out that the problem might be that Interface Builder fails to
find my framework at the advertised location. Although I have been
trying both configurations I have seen for the installation path of
the framework, meaning @executable_path/../Frameworks and
@loader_path/../Frameworks without getting either of them to work.
Hey Dalzhim -
If you want to work with your Interface Builder outside of building
and running your plug-in project, you need to do an "sudo xcodebuild
install" from your project directory and then install the built bits.
By default, Xcode will layout the distribution root for the built
projects in /tmp in a folder that starts with the name of your
projects and ends with dst. If you examine this folder, you'll see
that it's a sparse root for /. It will contain all of the files your
project built that should be installed and the will have a path
relative to their final destination. If your project was named
MyProject, you could install them with 'sudo ditto /tmp/
MyProject.dst/ /'. That ditto command would overlay the contents of
the distribution root on to /, effectively installing them. At this
point if you launched Interface Builder from the finder, you'd be able
to load your plug-in and work with it. Working with your plug-in in
this manner would be different than working with it after having
pressed build and run from the plug-in project in Xcode. Pressing
build and run will build and run the latest sources. When running IB
from the finder, you'll be running against the installed framework,
and possibly the installed plug-in depending on which on you loaded
into Interface Builder last.
Problem #2
When trying to load an image from MyComponent for display purposes,
I cannot seem to make these images show up at design time in
Interface Builder. The problem seems to be that I do not look for
the image in the proper bundle, but I cannot seem to find any bundle
at all which might contain images from the associated xcode project
when my plugin runs inside Interface Builder.
When your code is in IB, and is working with images there are a couple
of subtleties to consider. First, is the image a project image coming
from the user, or is it a framework image coming from your framework,
or both. If your widget has an image property, that you would like the
user to be able to fill out in the inspector, then you should obtain
the image via -[IBDocument documentImageNamed:]. The reason you need
to go through that message and not -[NSImage imageNamed:] is that -
[NSImage imageNamed:] works on a global set of names. In Interface
Builder the user is free to work on many documents were each document
has a different set of images and names. Unfortunately, Interface
Builder doesn't offer a way for plug-ins to integrate content into the
set of per-document named images. So, if you're framework has an image
and you want that image to show up in the library and be available to
regular cocoa controls, then unfortunately, there isn't a supported
way to do that. However, if you just want to integrate the users
images into your custom controls, you should be able to do that with -
[IBDocument documentImageNamed:].
Jon Hess
Any help or clues would be appreciated!
regards
-Dalzhim
_______________________________________________
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
_______________________________________________
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