我构建了一个 UIViewController
,其中包含一个容器 View ,该 View 嵌入了另一个 UIViewController(我将其称为 subViewController)。
我希望 subViewController 在其容器 View Canvas 中呈现它自己的另一个实例(不是针对所有屏幕)。
我尝试使用 prepareForSegue
方法
用这个方法
-(void)showFurtherReadingDetails
{
[self performSegueWithIdentifier:@"ShowArticleDetails" sender:self];
}
注意:showFurtherReadingDetails
方法是 subVC over 的委托(delegate)方法,在 supperVC 中初始化。
但我遇到了这个问题:
'NSInternalInconsistencyException', reason: 'There are unexpected subviews in the container view. Perhaps the embed segue has already fired once or a subview was added programmatically?'.
最佳答案
如果你的 UIViewController 没有嵌入 UINavigationController 那么你不能执行推送。
您需要做的是,将导航 Controller 嵌入到您的 subVC 中,然后从 subVC 推送新的 View Controller ,它将处于容器 View 中,并且不会占据全屏。
为方便起见,我附上了 Storyboard的屏幕截图,以便您更好地理解。希望对您有所帮助。
关于ios - 从容器 View 中呈现 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33318417/