iphone – 如何从datePicker和run方法中获取时间?
发布时间:2020-12-14 19:10:59 所属栏目:百科 来源:网络整理
导读:我想从datePicker获取时间到NSDate对象,然后在这个时间每天运行一个方法. 例如: 用户将日期戳于08:00以及每天08:00的应用程序中运行一些方法. 非常感谢你, 阿米尔福格尔 解决方法 为了从datepicker使用中获取时间, NSDateFormatter *outputFormatter = [[NS
我想从datePicker获取时间到NSDate对象,然后在这个时间每天运行一个方法.
例如: 用户将日期戳于08:00以及每天08:00的应用程序中运行一些方法. 非常感谢你, 解决方法
为了从datepicker使用中获取时间,
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:@"HH:mm"]; //24hr time format NSString *dateString = [outputFormatter stringFromDate:self.myDatePicker.date]; [outputFormatter release]; 要在特定时间每天使用功能UILocalNotification. 将repeatInterval设置为NSDayCalendarUnit. 并且在委托中处理UILocalNotification代码的方法. 注意:仅当用户接受本地通知时才会执行此方法. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |