0
我遇到了UILocalNotifications問題。我的問題是 - 是否有可能在預定之後設置單一通知的警報體?是否有可能在預定後設置uilocalnotification警報主體
在此先感謝。
-------------------------------------
// scheduling uilocalnotification
localNotification = [[UILocalNotification alloc]init];
NSDate *currDate1 = [defaults objectForKey:@"Default_AlarmTime"];
localNotification.fireDate = currDate1;
localNotification.alertBody = @"Alarm";
localNotification.alertAction = @"View";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSWeekdayCalendarUnit;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
// changing alert body of existing local notification
Arr=[[UIApplication sharedApplication]scheduledLocalNotifications];
for (int k=0;k<[Arr count];k++)
{
localNotification = [Arr objectAtIndex:k];
NSLog(@"%@",localNotification.fireDate);
dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setTimeZone:[NSTimeZone defaultTimeZone]];
[dateFormat setDateFormat:@"hh:mma"];
dateString = [dateFormat stringFromDate:localNotification.fireDate];
NSLog(@"%@",dateString);
currDate = [defaults objectForKey:@"Default_AlarmTime"];
NSLog(@"%@",currDate);
if ([currDate isEqualToString:dateString])
{
localNotification.alertBody = @"Haiiiiii";
}
}
---------------------------
據我所知,沒有。您必須重新安排時間或以某種方式間接提醒機構。 – 2012-02-22 12:02:14