2013-10-11 63 views
1

點擊時,我有一個單元格顯示密碼更改視圖控制器。dismissViewControllerAnimated在iOS 7中不起作用?

else if (indexPath.row == 2) { 
       //Change passcode 
       NSString *passcode = [[NSUserDefaults standardUserDefaults] stringForKey:@"passcode"]; 
       PAPasscodeViewController *passcodeViewController = [[PAPasscodeViewController alloc] initForAction:PasscodeActionChange]; 
       passcodeViewController.delegate = self; 
       passcodeViewController.passcode = passcode; 
       passcodeViewController.simple = YES; 
       [self presentViewController:passcodeViewController animated:YES completion:nil]; 
       break; 

      } 

委託回調方法駁回密碼更改視圖控制器時,命中取消:

- (void)PAPasscodeViewControllerDidCancel:(PAPasscodeViewController *)controller { 
    [self dismissViewControllerAnimated:YES completion:nil]; 
// [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; 
// [self.navigationController popViewControllerAnimated:YES]; 

} 

但是,它沒有關閉該密碼更改視圖控制器命中即使Xcode的調試擊中取消按鈕時碼。我試過[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];它也沒有工作。 presentViewController屬性爲零。

它以前在iOS 6上完美工作。之前有人遇到過這個問題嗎?謝謝

+0

什麼是self.presentingViewController? –

回答

0

你可以試試PAPasscodeViewController,而不是使用委託。

[self removeFromParentViewController]; 
+1

這不是真正正確的使用該方法...... –

相關問題