Question

I'm trying to add a sort of ''first row'' in the NSPredicateEditor like the Finder app. Something similar to the screenshot below: In particular I'd like to add a sort of label on the left, like ''Add search options'' and the plus button on the right.

Any clue on how to do this?

Finder screenshot

By the way: I will not use directly the resulting NSPredicate because I use the search field to query a REST server so I was thinking to translate the NSPredicate to a proper NSString object. Is there another, more appropriate component, or I can use the NSPredicateEditor and make the translation later?

Was it helpful?

Solution

You have to build the first line by yourself. Add "Seach:" - label and some state-Buttons. Then you can add the NSPredicateRuleEditor just under the view with heigh 1 (better 0).

Don't forget to set the Auto-Layout Constraints wisely. enter image description here

Just like that: the big black line is the reduced NSPredicateEditor Take care about Auto-Layout.. You'll have to expand the view if predicates grow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top