我需要知道用户从 NSPopUpButton
更改项目后的用户选择。
为什么 NSPopUpButton
控件会在用户操作之前发出通知。
Posted when an NSPopUpButton object receives a mouse-down event—that is, when the user is about to select an item from the menu.
实现 NSPopUpButton
通知效果很好:
@objc func popUpButtonUsed(notification: NSNotification){
print(distributionPopUpButton.titleOfSelectedItem!)
}
但是我怎样才能在用户选择后触发一个 Action /方法呢?
谢谢!
最佳答案
就像下面这样
@IBAction func popUpButtonUsed(_ sender: NSPopUpButton) {
print(sender.indexOfSelectedItem)
}
关于swift - 选择后的osx NSPopUpButton通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42462213/