Re: sizeToFit without actually changing the size?
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