0
votes

Design preference.

If you have a view controller wrapper which contains an array of viewcontrollers and you only display one of those viewcontrollers at a time to the user (i.e the currentViewController)

should the class that contains your array of view controllers be a viewcontroller itself?

You could achieve a wrapper by created a class that inherits from NSObject, and then has an attribute property array.

All viewController's should have a 'view', but a wrapper viewController doesn't need a 'view', it just needs to return currentViewcontroller.view to the UIApplication Delegate windows' rootViewController.

All ideas welcome.

1

1 Answers

1
votes

I would use a viewController with childViewControllers, and then set the the view of my "container" viewController to the currentViewController.view

Doing so means that your lifecycle will stay intact and view events, rotation events etc... will all get passed down to the children.

See "Implementing a Custom Container View Controller" at: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html