• 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: sizeToFit without actually changing the size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sizeToFit without actually changing the size?


  • Subject: Re: sizeToFit without actually changing the size?
  • From: John Stiles <email@hidden>
  • Date: Tue, 20 Nov 2007 16:50:34 -0800

This worked perfectly. Thanks.

The reference docs for cellSize don't really make this clear—they imply that it only works for cells containing text or an image, and subclassed cell types like NSButtonCell don't clarify that -cellSize will actually work properly. But sure enough, it provides the same result as calling -sizeToFit and then reading back the resultant size.

Ricky Sharp wrote:

On Nov 20, 2007, at 4:56 PM, John Stiles wrote:

It's a checkbox and I want to know how wide it will need to be if I change its title—not exactly sure how I would do that.

Try using:

NSSize theSize = [[theCheckbox cell] cellSize];

When writing all my custom controls, I implement cellSize in their cells to return a proper value. IB's "size to fit" operation then uses that info. Sounds like you want to do the same thing, but programatically? (I'm assuming this thread is related to the "building checkboxes programatically" thread).

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

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


References: 
 >sizeToFit without actually changing the size? (From: John Stiles <email@hidden>)
 >Re: sizeToFit without actually changing the size? (From: Michael Watson <email@hidden>)
 >Re: sizeToFit without actually changing the size? (From: John Stiles <email@hidden>)
 >Re: sizeToFit without actually changing the size? (From: Ricky Sharp <email@hidden>)

  • Prev by Date: CoverFlow
  • Next by Date: Re: Including <Agl/agl.h> ...
  • Previous by thread: Re: sizeToFit without actually changing the size?
  • Next by thread: "Cue Sheet Parser" - Use NSString?
  • Index(es):
    • Date
    • Thread