Sizing an NSTableView to be big enough to show all its rows
Sizing an NSTableView to be big enough to show all its rows
- Subject: Sizing an NSTableView to be big enough to show all its rows
- From: Steve Israelson <email@hidden>
- Date: Fri, 8 Jun 2007 11:13:54 -0700
I am trying to figure out the best way to make a table always show
all its rows. The same way spotlight does.
In my current implementation, whenever the list of items is changed
or filtered I call reLayout in my controller.
In there I determine how many items the table will display, and the
row height and size the table accordingly.
The problem is that I need to do my own fetch request and filter
operation to figure out how many items will be displayed since the
array controller does not yet have its data.
Forcing the array controller to load its data NOW, does not seem to
work properly as the data ignores the filter predicate (also bound
using bindings) and also ignores the sort order. This causes the
table to draw twice, once in the wrong order and once in the correct
order.
The way I am doing it now works, but seems clunky.
Does anyone have any idea on a better way to do this?
The ideal way would be to write a category on NSArrayController with
a method called FetchContentsNOWDagNabbit that would make it fetch
the data and use the proper sort order and predicate. Then I could
call that and get a count.
Once I have the table view sized, I then move the header and footer
views around to make the layout work.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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