iphone – 如何从datePicker和run方法中获取时间?

iphone – 如何从datePicker和run方法中获取时间?,第1张

概述我想从datePicker获取时间到NSDate对象,然后在这个时间每天运行一个方法. 例如: 用户将日期戳于08:00以及每天08:00的应用程序中运行一些方法. 非常感谢你, 阿米尔福格尔 为了从datepicker使用中获取时间, NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];[outputFormatt 我想从datePicker获取时间到NSDate对象,然后在这个时间每天运行一个方法.
例如:
用户将日期戳于08:00以及每天08:00的应用程序中运行一些方法.

非常感谢你,
阿米尔福格尔

解决方法 为了从datepicker使用中获取时间,

NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];[outputFormatter setDateFormat:@"HH:mm"]; //24hr time formatNsstring *dateString = [outputFormatter stringFromDate:self.myDatePicker.date];[outputFormatter release];

要在特定时间每天使用功能UILocalNotification.

将repeatInterval设置为NSDayCalendarUnit.

并且在委托中处理UIlocalnotification代码的方法.

注意:仅当用户接受本地通知时才会执行此方法.

总结

以上是内存溢出为你收集整理的iphone – 如何从datePicker和run方法中获取时间?全部内容,希望文章能够帮你解决iphone – 如何从datePicker和run方法中获取时间?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1044087.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存