【发布时间】:2015-04-16 12:21:55
【问题描述】:
我想在代码中将 viewcontroller 嵌入到 containerview 中。
我在故事板上放置了一个容器视图,我想在另一个故事板上嵌入一个视图控制器。
我在下面尝试过,但它不起作用。
你有什么建议吗?
let storyboard: UIStoryboard = UIStoryboard(name: "AnotherStoryboard", bundle: nil)
let vc:OtherViewController = storyboard.instantiateViewControllerWithIdentifier("OtherViewController") as OtherViewController
self.addChildViewController(vc)
containerView.addSubview(vc.view)
vc.didMoveToParentViewController(self)
【问题讨论】:
-
“不起作用”是什么意思?实际发生了什么?您做了哪些故障排除?
标签: ios objective-c swift storyboard