【问题标题】:dismissViewControllerAnimated does not work in iOS 7?dismissViewControllerAnimated 在 iOS 7 中不起作用?
【发布时间】:2013-10-20 00:25:52
【问题描述】:

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

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

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

【问题讨论】:

  • 什么是 self.presentingViewController?

标签: objective-c uiviewcontroller ios7


【解决方案1】:

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

[self removeFromParentViewController];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-20
    • 2013-10-19
    • 2013-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多