Tight NSBox around view
Tight NSBox around view
- Subject: Tight NSBox around view
- From: Hans van der Meer <email@hidden>
- Date: Sun, 10 Sep 2006 16:57:46 +0200
I would like to draw an NSBox tight around its contained subview; the
subview being a NSView descendant.
In order to draw a rectangle with given color and linewidth around
the content of the box I subclassed NSBox and did an override of
drawRect:
- (void) drawRect:(NSRect)frame {
float framesize = 1.0f;
NSFrameRectWithWidth(frame, framesize);
// Note: no call to super.
}
In awakeFromNib I do for the NSBox variable surround:
[surround sizeToFit];
Both surround and its contents are custom views installed through
IBuilder.
When I do this, the frame in the box does not fit tight around its
contents. There is a considerable margin between the frame and the
view contained. At the top the margin is larger than at the bottom
and the sides. Changing the frame width and height of the surrounding
box had not the effect sought. It therefore looks to me if there is
some mechanism determining the margins between box and contents.
Because I was unable to find the solution, I am asking if someone can
point me in the right direction.
Thanks in advance.
Hans van der Meer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden