• 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
shared NSImage from bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shared NSImage from bundle


  • Subject: shared NSImage from bundle
  • From: Torsten Curdt <email@hidden>
  • Date: Tue, 11 Mar 2008 11:12:46 +0100

While I know I can load an image like this

image = [[NSImagealloc] initWithContentsOfFile: [[NSBundlemainBundle] pathForResource:@"someimage" ofType:@"PNG"]];

all my NSDocument should be OK to share the same instance. Creating class level singleton accessors seem a little too much work. Is there a class level init that could be used to fill class level variables? Forgive me my blasphemy but something along the lines of...

 public class MyDocument extends NSDocument {

   private final static NSImage image;
   private final static NSImage image2 = ...;

   static {
     image = ...
   }
   ...
 }

How do people usually do this? Sorry, if this turns out to be more a Objective-C question than a Cocoa question.

cheers
--
Torsten
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: shared NSImage from bundle
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: warning: assignment from distinct Objective-C type
  • Next by Date: Re: shared NSImage from bundle
  • Previous by thread: Re: warning: assignment from distinct Objective-C type
  • Next by thread: Re: shared NSImage from bundle
  • Index(es):
    • Date
    • Thread