0

しかし、プッシュしません。 nslogだけが表示されます

- (void)applicationDidBecomeActive:(UIApplication *)application 
{ 
    //To count the number of launches 
    NSInteger i = [[NSUserDefaults standardUserDefaults] integerForKey:@"numOfCalls"]; 
    [[NSUserDefaults standardUserDefaults] setInteger:i+1 forKey:@"numOfCalls"]; 
    NSLog(@"the number of active calls are %d",i%3); 
    if(i%3==0 && i!=0) 
    { 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"you might prefer MedChart+" message:@"Get it now for more options" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil]; 
     [alert show]; 
     [alert release]; 
    } 

} 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 

     if (buttonIndex == 0) 
     { 
      NSLog(@"canceled"); 

     } 
     else if (buttonIndex == 1) 
     { 
      NSLog(@"Pushed to the information view "); 

      InformationViewCotroller *info = [[InformationViewCotroller alloc]initWithNibName:@"InformationViewCotroller" bundle:nil]; 
      [self.navigationController pushViewController:info animated:YES];  

     } 

} 

(私の値は私の論理の一部です)。 ありがとうございます。

+0

self.navigationControllerが有効なオブジェクトであることを確認しましたか? – bneely

+0

はい、私は既にappdelegate.hに宣言しました –

+0

デバッガまたはログにその値を表示しましたか? – bneely

答えて

1

前にviewControllerに移動する前に、appControllerのappControllerのRootControllerを設定してください。 navigationController.Viewをwindowのサブビューとして追加します。ルートコントローラーが最初のViewController.fromになります。そこから任意のviewControllerを押すことができます。

関連する問題