Re: NSBox sizeToFit problem
Re: NSBox sizeToFit problem
- Subject: Re: NSBox sizeToFit problem
- From: Reinhard Segeler <email@hidden>
- Date: Thu, 6 May 2010 19:26:39 +0200
The help says "If you wish to change grouping behavior or other behavioral
characteristics of the NSBox class, consider overriding
setContentView:<file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBox_Class/Reference/Reference.html#//apple_ref/occ/instm/NSBox/setContentView:>
, sizeToFit<file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBox_Class/Reference/Reference.html#//apple_ref/occ/instm/NSBox/sizeToFit>,
or addSubview:<file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/addSubview:>
(inherited
from NSView)."
maybe you didn't override the method "siezToFit" in your class managing the
NSBox...
--Reinhard
Am 06.05.2010 um 16:01 schrieb Ingvar Nedrebo:
Hi all,
I'm seeing some strange behaviour using NSBox's sizeToFit method. When I
send the message in my code, the box gets sized too small and clips it
contents.
To make sure it wasn't anything to do with my app, I created a brand new
test project, added a box to the main window, and put a couple of labels and
buttons inside the box.
When I use Layout > Size to Fit in IB, the box is nicely fitted around its
contents with proper margins as I would expect.
In the app delegate's applicationDidFinishLaunching method I then send a
sizeToFit message to the box:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[box sizeToFit];
}
The result is that the box is sized too small and clips its contents. As
this is a brand new project where I've added a single line of code, I'm not
sure what I could be doing wrong. Is this method working as expected for
anyone else?
_______________________________________________
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