We often encounter the need to implement multiple view switches within a controller.
a convenient way to achieve this is to use the Addchildviewcontroller function to add a child controller to the master controller, The corresponding sub-controller's view is then added to the main controller's main view as Subview for the first time by Transitionfromviewcontroller Toviewcontroller to implement the view switch. This is a good and convenient way.
But the sub controller's view needs to set the corresponding frame, can add to the correct position, realizes the correct switch. The frame of the view that was shown for the first time is different from the frame of the view that is displayed after the switch, (although we see the same height), which may be because the first display was implemented by Addsubview, while the others were Transition to achieve.
The specific height setting:
1. The height setting of the view that is not the first display is exactly the height we see, and the height of the screen minus some of the controls. Typically includes the navigation bar status bar height, toggle control height, and so on.
2, the first (default) display of the height of the view, only the screen height minus the height of the control used to switch. Note that this switch is used in the control, because sometimes nested multi-layer switching, switching inside and switching, then subtract is only the height of the switch.
3, the child controller internal view or according to the actual height set, such as have a tableview, height is also need to subtract all the height of the control, that is, we see the actual height.
If the height is set incorrectly, it can cause events that are out of range to be unresponsive and other strange phenomena.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Questions about several full screen view switches in a controller