如果应用程序处于活动状态,我必须遵循代码来显示通知。我把它放在 AppDelegate.m
我想要做的是在用户点击第二个按钮时执行到视图控制器的转换(或转场)。我如何从 AppDelegate 执行此操作?
我想我需要将navigationcontroller 设置为appdelegate .. 但我无法做到这一点。
谢谢
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
NSString *cancelTitle = @"Close";
NSString *showTitle = @"Show";
//NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Social Dilemma"
message:@"Next round is ready to play!"
delegate:self
cancelButtonTitle:cancelTitle
otherButtonTitles:showTitle, nil];
[alertView show];
}
}
-(void) alertView: ( UIAlertView *) alertView
clickedButtonAtIndex: ( NSInteger ) buttonIndex {
if (alertView.tag == 1)
{
//check the button index
//create and display the other alert view (set the tag property here to 2)
}
else if (alertView.tag == 2)
{
}
}