• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Tight NSBox around view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Tight NSBox around view
      • From: Daniel Jalkut <email@hidden>
    • Re: Tight NSBox around view
      • From: Henry McGilton <email@hidden>
  • Prev by Date: Newbie:initialize at app. startup?
  • Next by Date: Re: Newbie:initialize at app. startup?
  • Previous by thread: Re: Newbie:initialize at app. startup?
  • Next by thread: Re: Tight NSBox around view
  • Index(es):
    • Date
    • Thread