Barry Wark
Barry Wark

Reputation: 107764

Modifying NSDatePicker for automatically generated predicate row templates

How can I modify the NSDatePickerElementFlags for the NSDatePicker in row templates for NSDate properties returned by [NSPredicateRowEditorTemplate templatesWithAttributeKeyPaths:inEntityDescription:]? I would like the NSDatePicker to show hrs:minutes as well as the date.

Update I've added an answer below, gleaned from the cocoa-dev list.

Upvotes: 0

Views: 472

Answers (2)

Barry Wark
Barry Wark

Reputation: 107764

Per Peter Ammon, on cocoa-dev, and as Ben notes, the easiest way is to modify the date picker in -templateViews directly:

[[[template templateViews] objectAtIndex:2] setDatePickerElements:...]

According to Peter, the order of elements in -templateViews is guaranteed to be constant.

Upvotes: 1

Ben Stiglitz
Ben Stiglitz

Reputation: 4004

You can probably grok through the templateViews of the returned row templates to set this property.

Upvotes: 1

Related Questions