简体   繁体   中英

how to set a current time in picker view Objective C

I have a problem with set a current time on my pickerView object. I have 3 component in it, one for hour, one for minute and last one for second.

I get a current time like this:

NSDate *now = [NSDate date];

I tried to set a current time using:

[picker setDate:now]

where picker is a declaration my PickerView object.

I'll be glad to get a help with set current time on it. Thanks in advance.

The setDate method you are looking for is in UIDatePicker class.

Note that

UIDatePicker does not inherit from UIPickerView, but it manages a custom picker-view object as a subview.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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