1

点击时,我有一个显示密码更改视图控制器的单元格。

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]; 它也没有用。presentingViewController 属性为零。

它之前在 iOS 6 上完美运行。以前有人遇到过这个问题吗?谢谢

4

1 回答 1

0

您可以在 PAPasscodeViewController 中尝试此操作,而不是使用委托。

[self removeFromParentViewController];
于 2013-10-11T20:10:18.957 回答