Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding subviews: addSubview:positioned:relativeTo:



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.