• 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
Re: Programmatically adding an NSTableView to another view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically adding an NSTableView to another view


  • Subject: Re: Programmatically adding an NSTableView to another view
  • From: Patrick Mau <email@hidden>
  • Date: Tue, 09 Dec 2008 04:44:08 +0100

Hi Randall

On 09.12.2008, at 04:14, Randall Meadows wrote:

I have configured a view .xib with an NSTableView; I load the nib and add the table view to another parent view. I've implemented the necessary delegate and data source methods. It's all working just peachy, except...

It's placement in the parent view is wrong, and I can't figure out how to place it correctly.

In the .xib file, I've configured all 4 exterior sizing connections to be struts, both interior sizing connections to be springs, for the view, the scrollview, and the table view.

[NSBundle loadNibNamed:@"FlexViewTable" owner:self];
[view addSubview:tableView];

The view's frame is taken from the nib file, meaning whenever you resize the view's layout window in IB it will encode its size in the nib file.

Simply set the frame of the tableview before adding it as a subview:

[NSBundle loadNibNamed:@"FlexViewTable" owner:self];
[tableView setFrame:[view frame]];
[view addSubview:tableView];

Ofcourse you can create a new frame based on the superview's frame by
using NSMakeRect or similar.

Regards,
Patrick

_______________________________________________

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


References: 
 >Programmatically adding an NSTableView to another view (From: Randall Meadows <email@hidden>)

  • Prev by Date: Re: iPhone Orientation
  • Next by Date: Right way to implement contextual menu in table/outline view?
  • Previous by thread: Programmatically adding an NSTableView to another view
  • Next by thread: Right way to implement contextual menu in table/outline view?
  • Index(es):
    • Date
    • Thread