dismissViewControllerAnimated在iOS 7中不起作用?

时间:2013-10-11 20:03:47

标签: objective-c uiviewcontroller ios7

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

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属性为nil。

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

1 个答案:

答案 0 :(得分:0)

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

[self removeFromParentViewController];