我有这个代码:
UILocalNotification *notification = [[UILocalNotification alloc] init]; [notification setAlertBody:@"This is a message"]; [notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:10]]; [notification setTimeZone:[NSTimeZone defaultTimeZone]]; [application setSchedualLocalNotifications:[NSArray arrayWithObject:notification]];
这在AppDelegate.m
or(-(void) applicationDidEnterBackground:(UIApplication *)application)
中工作正常,但在ViewController
. 我希望在用户单击按钮时发生这种确切的事情,所以我不需要此ViewController
代码AppDelegate
。我怎样才能更改此代码,以便它可以在ViewController
!非常感谢!