Mailing Lists: Apple Mailing Lists

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

Re: Programmatically adding an NSTableView to another view



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

This email sent to email@hidden
References: 
 >Programmatically adding an NSTableView to another view (From: Randall Meadows <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.