Subview frames and bounds
Subview frames and bounds
- Subject: Subview frames and bounds
- From: DKJ <email@hidden>
- Date: Mon, 3 Nov 2008 05:23:59 -0800
I'm still puzzled by frames and bounds. I put this in the drawRect: of
MyView:
[[NSColor redColor] set];
NSRectFill( self.frame );
[[NSColor blueColor] set];
NSFrameRect( self.bounds );
I put this in the awakeFromNib of my controller:
NSRect r = NSMakeRect( 10.0, 10.0, 200.0, 200.0 );
MyView *mv = [[MyView alloc] initWithFrame:r];
[[theWindow contentView] addSubview:mv];
The blue bounds rectangle is drawn just where I would expect: inset 10
pixels from the lower left corner of the window. But the red frame
rectangle is inset another 10 pixels from the lower left corner of the
blue bounds rectangle.
When I set the origin of r to (0.0, 0.0), the red and blue rectangles
coincide.
What's happening here?
dkj
_______________________________________________
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