• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing project images in IB Plugin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing project images in IB Plugin


  • Subject: Re: Accessing project images in IB Plugin
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Sat, 3 Nov 2007 23:16:28 -0200

At 15:22 -0700 03/11/2007, email@hidden wrote:
>From: Ricky Sharp <email@hidden>
>Date: Sat, 3 Nov 2007 16:41:07 -0500
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>I'm having a bit of difficulty having my IB Plugin custom classes access images in the opened Xcode project.
>
>When building my IB 2.x palettes, I had to write custom palette loading code to scan all the project images and load them in memory.
>This allowed me to have an NSString* ivar for say a custom view.  In the view's drawRect:, I just needed to do:
>
>NSImage* theImageToDraw = [NSImage imageNamed:[self myImageName]];
>....
>* The only solution I came up with to use my existing drawing code, and see the image at both design-time and in the simulator, is to add the images to the framework as part of the IB plugin.  It works great, but that's going to be a maintenance nightmare.

Right, this is what I do; the images are in my plugin's resources folder.

NSImage* theImageToDraw = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForImageResource:[self myImageName]]];

and I do that only once, in the IBPlugin's didLoad method. (Release them in the willUnload method.)

HTH
--
Rainer Brockerhoff  <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
 _______________________________________________
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

  • Follow-Ups:
    • Re: Accessing project images in IB Plugin
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: SenTesttingKit.framework runtime failure
  • Next by Date: Re: Xcode 3 SCM Preference Pane Documentation
  • Previous by thread: Accessing project images in IB Plugin
  • Next by thread: Re: Accessing project images in IB Plugin
  • Index(es):
    • Date
    • Thread