简体   繁体   English

如何使用图形样式的日期选择器?

[英]How can I do with the Date Picker in Graphical Style?

I create a button with a popover date picker.我创建了一个带有弹出日期选择器的按钮。 Inside the date picker, I control dragged an IBAction to receive the date I pick and print out.在日期选择器中,我控制拖动一个 IBAction 来接收我选择的日期并打印出来。 However, whenever I select another date, it will always print out twice.但是,每当我选择另一个日期时,它总是会打印两次。 (Select the same day will print out once) (选择当天会打印一次)

I would like to get ONE value from date picker whenever I select.每当我选择时,我都想从日期选择器中获得一个值。 How can I fix it?我该如何解决?

here is what I've done. 这是我所做的。

Try adding this in awakeFromNib or viewDidLoad :尝试在awakeFromNib 或viewDidLoad 中添加:

    let theAction = Int(NSEventMask.MouseExitedMask.rawValue)
    theDatePicker.sendActionOn(theAction)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM