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

Ran*_*nga 3 iphone notifications objective-c push-notification uilocalnotification

嗨,我正在处理提醒申请.

我需要在特定时间后显示提醒警报.

当时我们没有设置日期选择器.

就像我有一个按钮'提醒10分钟'

-(IBAction)ReminderClick:(id)sender
{
}
Run Code Online (Sandbox Code Playgroud)

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

Ank*_*pta 11

您需要使用UILocalNotification来实现此功能代码

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]; 
Run Code Online (Sandbox Code Playgroud)

你可以按照这个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