您好,我正在开发提醒应用程序。
我需要在某个特定时间后显示提醒。
但不是我们在日期选择器中设置的时间。
就像我有一个“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://www.iostipsandtricks.com/ios-local-notifications-tutorial/
关于iphone - 如何在 iPhone 中创建一段时间的提醒,例如 30 分钟后提醒我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10328168/