• 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
Adding subviews: addSubview:positioned:relativeTo:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Adding subviews: addSubview:positioned:relativeTo:
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: NSImageView SubClass and Mouse Cursor problems
  • Next by Date: Easy NSScanner (or equivalent) question.
  • Previous by thread: Re: Handling application termination in a non-gui application
  • Next by thread: Re: Adding subviews: addSubview:positioned:relativeTo:
  • Index(es):
    • Date
    • Thread