Ami*_*hel 5 iphone xcode objective-c datepicker ios
我想从datePicker获取时间到NSDate对象,然后在这个时间每天运行一个方法.例如:用户将日期戳于08:00,并且每天08:00应用程序将运行一些方法.
非常感谢,Amir Foghel
Kin*_*iss 12
为了从datepicker使用中获取时间,
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"HH:mm"]; //24hr time format
NSString *dateString = [outputFormatter stringFromDate:self.myDatePicker.date];
[outputFormatter release];
Run Code Online (Sandbox Code Playgroud)
要在每天的特定时间执行功能,请使用UILocalNotification.
将repeatInterval设置为NSDayCalendarUnit.
并且在委托中处理UILocalNotification代码的方法.
注意:仅当用户接受本地通知时才会执行此方法.
| 归档时间: |
|
| 查看次数: |
12792 次 |
| 最近记录: |