0

我有一个来自另一个带有 XIB 文件的视图控制器的弹出视图。它从父 VC ( detailViewController) 启动,但关闭代码在其自己的 VC ( KNThirdViewController)中

我正在使用此代码:https ://github.com/kentnguyen/KNSemiModalViewController/blob/master/KNSemiModalViewControllerDemo/KNThirdViewController.xib

当从 ( KNThirdViewController)调用它时

- (IBAction)dismissButtonDidTouch:(id)sender {
    [self dismissModalViewControllerAnimated:NO];
}

应用程序返回到rootViewController而不是detailViewController. 它应该简单地关闭自己(KNThirdViewController弹出式 VC)并将用户返回到detailViewController.

视图控制器显示:

-(void)scriviBtnPress {

// You can also present a UIViewController with complex views in it
// and optionally containing an explicit dismiss button for semi modal
[self presentSemiViewController:semiVC withOptions:@{
 KNSemiModalOptionKeys.pushParentBack    : @(YES),
 KNSemiModalOptionKeys.animationDuration : @(0.5),
 KNSemiModalOptionKeys.shadowOpacity     : @(0.3),
 }];

}

4

2 回答 2

3

试试这样:

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
于 2013-08-29T10:07:22.980 回答
0

dismissModalViewControllerAnimated:方法在 iOS 6.0 中已弃用。为什么不尝试dismissViewControllerAnimated:completion:

于 2013-08-29T09:51:00.703 回答