0
如果應用程序處於活動狀態,則必須執行以下代碼以顯示通知。我把它放在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)
{
}
}