Search code examples
iosxcodeinterface-builderuistoryboardxcode-storyboard

How to reuse appearance tweaks in multiple navigation controllers in ios storyboard?


Is it possible to share appearance tweaks (background, images, colors, etc.) among several navigation controllers (and any elements in general)?

For example, now I have a tab controller view with two navigation controller descendants, but they have the same appearance, so, is there any kind of things like css classes or android styles (just a comparison) or I have to implement all the adjustment repeatedly for every controller?

enter image description here


Solution

  • No one has answered, so, I'd try. As it seems, there is no ways to share the same tweaks between several scenes in the storyboard. Sharing the same things is possible via creating custom subclasses of viewControllers and setting the tweaks inside theirs code or even adjust appearance in appDelegate with appearance property available for some.

    For example, if you want to set tint color for all your app's navigation controllers in a single place, you'd better make it in AppDelegate inside

    application:(UIApplication *)application
    didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
        [[UINavigationBar appearance] setTintColor: [UIColor whiteColor]];
    }