• 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
[OT] Re: background image in cocoa view AU
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] Re: background image in cocoa view AU


  • Subject: [OT] Re: background image in cocoa view AU
  • From: daniel <email@hidden>
  • Date: Wed, 19 Jan 2005 09:42:29 -0800

You're leaking the NSImage in this example. You probably want to add "[background release]" to the end of that method.

*Always* release anything you alloc, copy, or retain. You should be releasing the "mBackgroundColor" object in your class's dealloc method, as well.

Daniel

On Jan 19, 2005, at 3:37 AM, Nicolas Dangy-Caye wrote:

I've modified the code inside awakeFromNib into :

- (void)awakeFromNib {
NSBundle *resource = [NSBundle bundleForClass:[self class]];
NSString *backgroundPath = [resource pathForResource: @"background" ofType: @"png"];
NSImage *background = [[NSImage alloc] initWithContentsOfFile:backgroundPath];
mBackgroundColor = [NSColor colorWithPatternImage:background];
[mBackgroundColor retain];
}

It now works fine.
Thank you Mark for your time.
Nicolas.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Fwd: background image in cocoa view AU (From: Nicolas Dangy-Caye <email@hidden>)

  • Prev by Date: Re: Tricks to avoid mutexes
  • Next by Date: Re: Coreaudio-api Digest, Vol 2, Issue 20
  • Previous by thread: Fwd: background image in cocoa view AU
  • Next by thread: Re: Coreaudio-api Digest, Vol 2, Issue 20
  • Index(es):
    • Date
    • Thread