NSView resizing problems.
NSView resizing problems.
- Subject: NSView resizing problems.
- From: Geoffrey Holden <email@hidden>
- Date: Mon, 20 Sep 2010 12:45:42 +0100
I've set up a view in it's own separate NIB. I've done this because the
same view will be loaded multiple times into an NSTabView (where each tab is
a conversation with a different person). The NIB contains the following
elements:
NSTextField (*) (top of the screen, anchored top, left and right, and set to
shrink/grow as the screen width changes)
NSTextView (#) (middle of the screen, anchored top, left, right and bottom,
and set to shrink/grow as the screen width and height changes)
NSTextField (=) (bottom of the screen, anchored bottom, left and right, and
set to shrink/grow as the screen width changes)
3 Buttons (B) (bottom of the screen, anchored bottom and right)
****************
################
################
################
################
============== B
============== B
============== B
My problem is that when I load this view into a tab (using the attached
code), the textview doesn't fit on the screen. It covers up the top
textfield and seems to have it's top edge somewhere above the tabview (as
follows)
Tab view right
|
################|
----------------- Tab view top
################|
################|
################|
################|
################|
============== B|=
============== B|=
============== B|=
Furthermore, the bottom textfield seems to have its right edge to the right
of the right edge of the tab view. Using the interface simulator (in IB) on
the view, the view appears to behave correctly. The problem only occurs
when I load the NIB into a tab.
My current workaround (for testing only - it doesn't look at all
professional) is to turn off the shrink/grow functionality in IB for each of
the elements. I've tried putting all the elements into an NSBox - but the
same issue occurs. Can anyone suggest what I'm doing wrong?
Messenger* messenger = [[Messenger alloc] initWithApp:@"Messenger"
:self];
[currentConversations setObject:messenger forKey:[NSNumber
numberWithInt:convId]];
NSView* newView = [[[NSView alloc] init] autorelease];
[newView setAutoresizesSubviews:YES];
[[messenger view] setFrame:[newView frame]];
[[messenger view] setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
[newView addSubview:[messenger view]];
NSTabViewItem* newTabView = [[[NSTabViewItem alloc] init] autorelease];
[newTabView setLabel:recipient];
[newTabView setToolTip:recipient];
[newTabView setView:newView];
[messagePane addTabViewItem:newTabView];
_______________________________________________
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