iPhone中的通知弹出重定向

时间:2011-09-05 08:32:23

标签: ios iphone alert uilocalnotification

我有通知警报的正常代码:

- (void)saveNotification {
Class cls = NSClassFromString(@"UILocalNotification");
if (cls != nil) {

    UILocalNotification *notif = [[cls alloc] init];
    notif.fireDate = [[datePicker date] dateByAddingTimeInterval:-20];
    notif.timeZone = [NSTimeZone defaultTimeZone];

    notif.alertBody = @"Evaluation Planner";
    notif.alertAction = @"Details";
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.applicationIconBadgeNumber = 1;

    NSDictionary *userDict = [NSDictionary dictionaryWithObject:reminderText.text
                                                         forKey:kRemindMeNotificationDataKey];
    notif.userInfo = userDict;

    [[UIApplication sharedApplication] scheduleLocalNotification:notif];
    [notif release];
   }
}


- (void)showReminder:(NSString *)text {

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" 
                                                    message:text delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
[alertView show];
[alertView release];
}

这对我来说效果很好但是当我点击“详细信息”时,我希望将其重定向到特定页面。相反,这只会重定向到应用程序的主页面,我必须点击整个应用程序一直到提醒部分才能查看它。我不确定如何解决它。帮助我。

感谢。

1 个答案:

答案 0 :(得分:2)

您的应用委托方法application:didFinishLaunchingWithOptions:将通过通知有效负载进行调用。这一切都记录在Local and Push Notification Programming Guide中。