0

プッシュ通知を追加するアプリケーションがあります。プッシュ通知をaletviewとして表示しています。ビューとキャンセルの2つのボタンがあります。ユーザーがビューボタンをクリックすると、特定のビューコントローラーに移動する必要があります。誰か助けてくださいそれを達成するために私は?これは私が通知で行った方法です。

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    NSLog(@"########################################didReceiveRemoteNotification****************************###################### %@",userInfo);
    //check application in forground or background
    if(application.applicationState == UIApplicationStateActive)
    {
        //NSLog(@"FOreGround");
        //////NSLog(@"and Showing %@",userInfo)
    }
    else {

        NSDictionary *curDict= [userInfo objectForKey:@"aps"];
        UIAlertView *connectionAlert = [[UIAlertView alloc] initWithTitle:@"app" message:[NSString stringWithFormat:@"%@",[curDict objectForKey:@"alert"]] delegate:self cancelButtonTitle:@"View" otherButtonTitles:@"Cancel",nil];
        [connectionAlert show];
        [connectionAlert release];
        [UIApplication sharedApplication].applicationIconBadgeNumber =[[curDict objectForKey:@"badge"] intValue];



    }


}

`

4

1 に答える 1

1

を実装しUIAlertViewDelegateてデリゲートメソッドを呼び出すだけです

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
  switch(buttonIndex) {
    case 0: // do something
      break;
    case 1: // do something else
      break;
  }
}
于 2012-07-18T14:23:44.717 に答える