Reputation: 535
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?
Upvotes: 0
Views: 164
Reputation: 15589
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.
Upvotes: 1
Reputation: 2563
Try adjusting your selection using GCD with
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: {
// Set selection.
}
You could call this from the array or view / window controller's awakeFromNib for example.
Upvotes: 0