开发者

Fetch data by date range using Interface Builder

I have an NSTableView that is done using the typical IB and data bindings. It works well.

However I need to put in a Segmented Control to indicate date range. So for example, if user clicks on the "Last Year" segmented control button, the table should only display records for last year.

I looked at the data binding options in IB for the NSArrayController, but I have no idea how to do this.

Can somebody point me in the right direction please?

*Update:

The app I'm working on has 3 SegmentedControl buttons -- "This Year", "Last Year", "Total", and a tableview that displays the records associated with the year selection the user selected. So selecting the "This Year" will reload the tableview 开发者_如何学Pythonwith records for the current year, and selecting "Last Year" will reload the table to show last year records.


You want to set a filter predicate. Your "last year" button would have to set the array controller's "filter predicate" to one that describes the appropriate date range filter.

Predicates Programming Guide

-[NSArrayController setFilterPredicate:] Source


if you got a field in your store called is isChecked that have data type bool you could do this in IB.

isChecked == 0

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜