首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建一段时间的提醒,比如在iPhone中30分钟内提醒我

如何创建一段时间的提醒,比如在iPhone中30分钟内提醒我
EN

Stack Overflow用户
提问于 2012-04-26 06:18:18
回答 2查看 4K关注 0票数 3

嗨,我在做一个提醒应用程序。

我需要在某个特定的时间后显示一个提醒警报。

在我们设置日期选择器时,不是

就像我有一个按钮‘10分钟后提醒’

代码语言:javascript
复制
-(IBAction)ReminderClick:(id)sender
{
}

当用户按下按钮时,10分钟后需要显示一个警报.

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-04-26 06:32:19

您需要对此函数代码使用UILocalNotification,如下所示

代码语言:javascript
复制
UIApplication* app = [UIApplication sharedApplication];
        UILocalNotification* notifyAlarm = [[UILocalNotification alloc] init];

        NSDate *date1=[fire dateByAddingTimeInterval:60];
        notifyAlarm.fireDate = date1;
        notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        //notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        notifyAlarm.repeatInterval =NSWeekCalendarUnit ;
        notifyAlarm.soundName =soundString;
        notifyAlarm.alertBody =snoozeBody;
        notifyAlarm.userInfo=snoozeDict;
        //notifyAlarm.alertLaunchImage=@"in.png";
        [app scheduleLocalNotification:notifyAlarm]; 

您可以按照本http://www.icodeblog.com/tag/uilocalnotification/教程进行操作。

http://blog.mugunthkumar.com/coding/iphone-tutorial-scheduling-local-notifications-using-a-singleton-class/

http://www.iostipsandtricks.com/ios-local-notifications-tutorial/

http://www.youtube.com/watch?v=tcVoq488-XI

票数 11
EN

Stack Overflow用户

发布于 2012-04-26 06:24:55

为此,您必须使用UILocalNotificataion

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10328168

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档