Multiple UIViewControllers inside master UIViewController in Swift -




i building game in swift 3 tvos. game has cpu intensive game background includes several animations. background uiviewcontroller dedicated task. use background in other uiviewcontrollers.

when navigating between viewcontrollers background animation need continue smoothly. best way this?

schematic example of shared background uiviewcontroller:

example

use parent child view controller containment.

create parent view controller. have constant animation run in view controller's content view.

add container view view controller , embed segue, linked first child view controller want go inside container view.

then use view controller child view controller support methods , transition methods swap child view controller child view controller. (see transition(from:to:duration:options:animations:completion:). see section "implementing container view controller" in uiviewcontroller class description in xcode docs. in particular, bit:

here essential methods might need call:

  • addchildviewcontroller(_:)

  • removefromparentviewcontroller()

  • willmove(toparentviewcontroller:)

  • didmove(toparentviewcontroller:)





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -