Re: Programmatically adding an NSTableView to another view
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