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



嗨,我正在开发提醒应用程序。

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

但不是在我们在日期选择器中设置的时间。

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

-(IBAction)ReminderClick:(id)sender
{
}

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

你需要为此函数使用 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]; 

你可以按照你的教程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

你必须为此使用 UILocalNotificataion

最新更新