Making NSView auto resize to fit contents of NSTextView
Making NSView auto resize to fit contents of NSTextView
- Subject: Making NSView auto resize to fit contents of NSTextView
- From: PCWiz <email@hidden>
- Date: Fri, 23 Oct 2009 17:43:30 -0600
I have an NSView subclass (the view of an NSCollectionViewItem) that
needs to dynamically resize in order to fully display the contents of
a NSTextView that it contains. I've tried just doing this off the top
of my head:
[self setFrame:NSMakeRect([self frame].origin.x, [self
frame].origin.y, [self frame].size.width, [tv frame].size.height)];
Where "tv" is a reference to the text view. I'm sure I'm doing this
wrong in a billion ways. I've also heard of NSTextView's sizeToFit
method, but I believe that only works when the NSView's bounds are
large enough to accommodate the enlarged text view, and in this case
the NSView needs to be resized before I can use sizeToFit.
I basically need a way of getting the height of the text view needed
to display all the text.
_______________________________________________
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