2017-04-06 7 views
0

UIAlertControllerポップアップから「OK」ボタンをクリックすると、以前のView Controllerに戻ります。私はthat.Belowへのこだわりを持っています。これは私のコードです。以前のView Controllerに戻すにはどうしたらいいですか?

if (jsonData == nil){ 
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error!" message:@"This Git repository is empty" preferredStyle:UIAlertControllerStyleAlert]; 

    UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 
    [alertController addAction:ok]; 

    [self presentViewController:alertController animated:YES completion:nil]; 

     } 

答えて

1

はこれを試してみてください -

if (jsonData == nil){ 
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error!" message:@"This Git repository is empty" preferredStyle:UIAlertControllerStyleAlert]; 

     UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action){ 
      // Ok action example 
      [self.navigationController popViewControllerAnimated:YES]; 
     }]; 
     [alertController addAction:ok]; 

     [self presentViewController:alertController animated:YES completion:nil]; 
    } 
+0

Awesome..itsが動作し..私はこの答えを探していますのthnx sir..almostの2hourを!。 –

+0

よろしくお願いします。 –

+0

done up @Dipankar Das :) –

関連する問題