UIDatePicker customisation and IBAction methods

preview_player
Показать описание

A UIDatePicker class allow us to customise the objects of its type. To do that, we have 4 options:
UIDatePickerModeTime
UIDatePickerModeDate
UIDatePickerModeDateAndTime
UIDatePickerModeCountDownTimer
, which represent the values of an Enum type in the iOS SDK. Usually we do that in Xcode Interface Builder, if the date-pickers are created visually as well.

When we interact with the UIDatePicker objects, we can call different event methods. The most common (which also comes as the default option when making the IBAction connection) is:
"- (IBAction)datePickerValueChanged:(id)sender".

If we want to get the value of the selected date and/or time from out picker in one of these methods, we can refer to the IBOutlet object or property if we have one, or we can change the parameter type from "id" to "UIDatePicker *", and then use the sender parameter-object (which is the actual UIDatePicker object).

For more information, you can check the Apple's online Documentation at:

Рекомендации по теме