我在 ControlView 中有一个 DatePicker() 和按钮,当我单击该按钮时,它会跳转到一个函数,在该函数中我使用我在 DatePicker(旋转)中选择的日期,问题是 datePicker 旋转和我单击它不选择日期的按钮,它在不选择日期的情况下跳转到功能。旋转日期选择器以阻止按钮时是否可行?或者它可以是另一种方式?
感谢解答
UIDatePicker
控件将在用户完成控件旋转后发送一个操作方法(对于事件 UIControlEventValueChanged
)。您可以使用此操作方法启用按钮,以便只有在用户完成选择日期后才能按下按钮。
见 docs :
When properly configured, a UIDatePicker object sends an action message when a user finishes rotating one of the wheels to change the date or time; the associated control event is UIControlEventValueChanged.
关于iphone - 我可以阻止按钮吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15040708/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) | Powered by Discuz! X3.4 |