Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI template view - common UI elements in all scenes on iOs application?

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

like image 585
michael911 Avatar asked Nov 03 '22 00:11

michael911


1 Answers

Options include:

  1. 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

  2. Define a UIViewController subclass that programmatically creates the common graphical elements and then subclass all of your other view controllers from that subclass.

  3. Use UIAppearance protocol to define common look at feel for your controls. See:

    • WWDC 2011 - 114 - Customizing the Appearance of UIKit Controls

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.

like image 77
Rob Avatar answered Nov 13 '22 22:11

Rob