Adding subviews: addSubview:positioned:relativeTo:
Adding subviews: addSubview:positioned:relativeTo:
- Subject: Adding subviews: addSubview:positioned:relativeTo:
- From: Don Willems <email@hidden>
- Date: Fri, 12 Aug 2005 19:46:33 +0200
Hi,
I'm trying to create a panel to which I can add sub-views. I've
created the panel in Interface Builder in the main nib and the sub-
view in another nib. When I click a button a sub-view is added to the
panel and the panel resizes.
The problem is that the subviews are added on top of each-other
instead of one below the other.
First I get the content view of the panel (in the awakeFromNib method):
_contentView = [[_updatePanel contentView] retain];
[_contentView setAutoresizingMask:NSViewHeightSizable];
I add the subview ([updateControl view]) to the content view of the
panel (_contentView) and relative to the previously added subview
(rv) or nil if it is the first subview to be added:
[_contentView addSubview:[updateControl view]
positioned:NSWindowBelow relativeTo:rv];
Then aftwerwards I recalculate the frame of the panel.
The resizing of the panel works OK, only the subviews are all
displayed at the same location in the bottom left corner of the panel.
I did find references to the same problem in the mail archives, but
no solution.
Can someone tell me how to solve this problem?
Don
_______________________________________________
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