Question

I have one background I want constant to all views; it shouldn't animate out and back to itself. I have another background I want common to another handful of views that layers on top of that one. I could do this cleanly enough by:

a) just having one viewcontroller and managing all the transitions of layered objects within that b) using separate viewcontollers and managing them programatically

But I don't grok how I can do this with a storyboard proper-like. Do I need to make a custom segue? Is there a certain type of segue it should be, if it's custom (or otherwise)? Is there a best viewcontroller that I do it all inside? (note: there's no "levels" of navigation, tab bar, navbar, etc... though if that's the way to go, with the elements hidden, and that's the "best" way to do it, I suppose that that might be me c)? )

Hope I've explained this well enough. :) I do grok layer transparency, etc, as far as views go....

Thanks!

ETA: After more research, I thought I understood c as the correct answer, (with a nod to set "default" UIViewController background image? ) ~

  • navigation controller with main background
    • navigation controller with secondary background elements
      • subpage 1
      • subpage 2
      • subpage 3
    • other controller

But I'm still hitting a wall. Not grokking the storyboard (IB) way to even add a background to a navigation controller. The number of custom classes I've made and tossed out, now....

Était-ce utile?

La solution

See if this is what you need. It is not in storyboard, but should do well enough.

navViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.jpg"]];

This is what I have done (but only with 1 level of nav controller). You can put this code in AppDelegate.m, or maybe subclass UINavigationViewController and change the view's backgroundColor there (and attach it within StoryBoard)

I guess the problem is StoryBoard still has some limitations. And UINavigationViewController is not an interface element, it is a View Controller. It is simply shown as a simulated element in StoryBoard.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top