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

Programmatically adding an NSTableView to another view


  • Subject: Programmatically adding an NSTableView to another view
  • From: Randall Meadows <email@hidden>
  • Date: Mon, 8 Dec 2008 20:14:46 -0700

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];

(tableView is an outlet defined in self and connected to File's Owner in the xib; all the connections look right when I view them in gdb)

As the tableView fits into the view, it occupies about 90% of the space (there are 2 other views that take up the rest, both above the table). However, there are usually very few rows in the table, and instead of row 0 being towards the top of the view with all the extra space at the bottom of the view, instead, all the rows are compressed towards the bottom of the view, with the last row exactly at the bottom of the view and all the extra space above the table. Row 0 moves up in the view as there are more rows added to the table. Like so:

------------------- <-top of view
[view header][icon]
|                 |
|   empty space   |
|                 |
-------------------
|row0             |
|row1             |
|row2             |
|row3             |
|row4             |
|row5             |
------------------- <-bottom of view

I've tried subclassing NSTableView and returning YES from -isFlipped:, but that did nothing (useful). I've tried playing around with the springs and struts in the view xib, but not found the right combination yet.

Is there something else I should be doing to move that table up and move the empty space down?

I imagine this is going to be another "DOH!" moment, so feel free in reveling in the moment of pointing out my dumb mistake (it's been a looooonnnnngggg day).

Thanks!
randy
_______________________________________________

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


  • Follow-Ups:
    • Re: Programmatically adding an NSTableView to another view
      • From: Patrick Mau <email@hidden>
  • Prev by Date: Re: Understanding text cell editing behaviour
  • Next by Date: Re: iPhone Orientation
  • Previous by thread: Re: Live updating NSPredicateEditorRowTemplate?
  • Next by thread: Re: Programmatically adding an NSTableView to another view
  • Index(es):
    • Date
    • Thread