简体   繁体   中英

Initial Child View Controller

I have a custom container view controller with 4 buttons. My goal is to have those 4 buttons load up each of the 4 child view controllers. The problem I am facing now is that I do not know how to make those buttons show the child view controllers. I have performed addChildViewController and the necessary didMoveToParentController ...however when I cannot use the transitionFromViewController:toViewController function since I do not have an already existing child VC in the parent. So essentially the question is how do I make the navigation screen with 4 buttons( custom container) navigate initially to the first child VC?

通过调用您提到的包含API以及使用[self.view addSubview:childController.view]添加子视图来添加初始子控制器的视图。

You can call transitionFromViewController:toViewController and manually perform the view transition in the animations block. You can treat the initial case in a different way by keeping track of the initial state in a property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM