我有一个非常奇怪的问题。我正在尝试使用 IB 将 NSPredicateEditor 放入我的界面,当我构建应用程序时,它只是显示为一个空的灰色矩形。这没有我对默认值应用任何更改,包括不修改默认模板。可能会发生什么?
1 回答
NSPredicateEditor works best when you bind it to some property (like an NSArrayController's filterPredicate).
The template you set up in IB is only to allow you to define the limitations of the rules (such as allowing the user to choose "first name" or "last name") but does not define what appears when the control is "live."
To modify an "empty" editor (array controller filter predicate or otherwise), connect a button or menu item's action to the editor view's -addRow:
action. At runtime, clicking this will add an initial "rule" (following the constraints you specified in your IB template). You can even test that in IB itself.