I'm developing iOs application with common UI elements - header (with custom butons), background image and footer across all scenes. It is possible to design one template scene/view using storyboard with common elements and use it in all other scenes/ViewControllers as a base? In other scenes just add content into free place (images, tables, ...).
I was thinking about common custom UIViewController superclass with hard-coded elements, but it's easier to design UI with storyboard.
Application has to be compatible with iOs 5.0
Options include:
Use custom container view controller. Put your common controls on that controller, and then using view controller containment for your child views. For more information, see
WWDC 2011 - 102 - Implementing UIViewController Containment video
Implementing Custom View Controller in the UIViewController Class Reference
Creating Custom Container View Controllers in the UIViewController Programming Guide
Define a UIViewController
subclass that programmatically creates the common graphical elements and then subclass all of your other view controllers from that subclass.
Use UIAppearance
protocol to define common look at feel for your controls. See:
Personally, I'd use UIAppearance
in conjunction with one of the other two approaches. I'd lean towards custom container controllers, but you lose the ability to do simple modal and push segues (I define a custom segue type that does the segueing between children), so I can understand why you might rather use a shared UIViewController
subclass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With