• 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: NSToolbar Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSToolbar Problem


  • Subject: Re: NSToolbar Problem
  • From: Julian Cain <email@hidden>
  • Date: Fri, 1 Apr 2005 13:28:40 -0500

Um, the are defined and draw just fine thank you. Sorry

On Apr 1, 2005, at 1:06 PM, Shaun Wexler wrote:

[(_imageLeft = [[NSImage imageNamed:@"TB_Segment_LeftCap"] retain]) setFlipped:YES];

Please RTFM, and you'll see that the -setFlipped: method does not return an object. You're retaining nothing, and thus your ivars are undefined. If you really want to stack all that gack into one line, you'd have to do something ugly like:


[(_imageLeft = [[NSImage imageNamed:@"TB_Segment_LeftCap"] retain]) setFlipped:YES];
[(_imageRight = [[NSImage imageNamed:@"TB_Segment_RightCap"] retain]) setFlipped:YES];


It's better to create your objects, retain them, and cache the pointer. Then you can send them messages:

	// create all of my static images
	_imageLeft = [[NSImage imageNamed:@"TB_Segment_LeftCap"] retain];
	_imageRight = [[NSImage imageNamed:@"TB_Segment_RightCap"] retain];
	...

	// flip all images
	[_imageLeft setFlipped:YES];
	[_imageRight setFlipped:YES];
	...

It's easier to read the code when blocks of identical messages are grouped together, and it's more cache-friendly.
--
Shaun Wexler
MacFOH
http://www.macfoh.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSToolbar Problem
      • From: daniel <email@hidden>
    • Re: NSToolbar Problem
      • From: "Sean McBride" <email@hidden>
    • Re: NSToolbar Problem
      • From: Guy English <email@hidden>
References: 
 >NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: j o a r <email@hidden>)
 >Re: NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: daniel <email@hidden>)
 >Re: NSToolbar Problem (From: Julian Cain <email@hidden>)
 >Re: NSToolbar Problem (From: Shaun Wexler <email@hidden>)

  • Prev by Date: multiple keys for object?
  • Next by Date: Re: NSToolbar Problem
  • Previous by thread: Re: NSToolbar Problem
  • Next by thread: Re: NSToolbar Problem
  • Index(es):
    • Date
    • Thread