Search code examples
swiftcocoacore-dataswift3nspopupbutton

How do I preselect an item in NSPopUpButton bound to core data?


I have an NSPopUpButton with bindings to core data. I need to preselect an item in the list dynamically when the view is loaded. Is there a way to get a notification when the NSArrayController is ready? Or any other way to do it?


Solution

  • Bind the selected object of the popup button to a property of the VC. Make sure the property is set before the popup button is drawn.