开发者

UIDatePicker: How to call a function if no value was changed?

开发者 https://www.devze.com 2023-03-30 02:40 出处:网络
I have a question concerning a UIDatePicker: [datePicker addTarget:self action:@selector(datePickerValueChange开发者_JAVA百科d:) forControlEvents:UIControlEventValueChanged];

I have a question concerning a UIDatePicker:

[datePicker addTarget:self action:@selector(datePickerValueChange开发者_JAVA百科d:) forControlEvents:UIControlEventValueChanged];

This will call my method "datePickerValueChanged:" but only if, well, a value got changed. But how can I call that method if nothing on the UIDatePicker was changed?


When do you want to call the method? (or when do you want it to be called?)

If you keep a reference to your date picker object, you can always call the 'datePickerValueChanged' action method directly from within your controller object or any other object that has a reference to your controller object. You can also interrogate the date picker at any time if you have a handle to it, via its date property, to find out which date is showing.

0

精彩评论

暂无评论...
验证码 换一张
取 消