Problem assigning NSView bounds from subview.bounds
Problem assigning NSView bounds from subview.bounds
- Subject: Problem assigning NSView bounds from subview.bounds
- From: Michael Crawford <email@hidden>
- Date: Mon, 13 Feb 2012 10:02:09 -0500
I'm trying to have a superview resize itself to match the bounds of a subview when the subview is added. When I do, the superview bounds become NaN.
Why would this:
- (void)didAddSubview:(NSView *)view
{
// resize to match bounds of given subview
NSLog(@"%@ = %@, %@ = %@", self, NSStringFromRect([self bounds]), view, NSStringFromRect([view bounds]));
[self setBounds:[view bounds]];
NSLog(@"%@ = %@, %@ = %@", self, NSStringFromRect([self bounds]), view, NSStringFromRect([view bounds]));
}
result in this?
2012-02-13 09:48:03.637 LSSettingsBar[3797:707] <MCView: 0x100184ba0> = {{0, 0}, {0, 0}}, <NSView: 0x100189340> = {{0, 0}, {216, 216}}
2012-02-13 09:48:03.637 LSSettingsBar[3797:707] <MCView: 0x100184ba0> = {{nan, nan}, {nan, nan}}, <NSView: 0x100189340> = {{0, 0}, {216, 216}}
-Michael
_______________________________________________
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