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?
Asked
Active
Viewed 155 times
2 Answers
1
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.

Willeke
- 14,578
- 4
- 19
- 47
0
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.

DDP
- 2,463
- 1
- 26
- 28
-
Why the 0.1 seconds? – Willeke Jul 12 '17 at 11:24