Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-c: How to have a one shared background image between the views in UINavigationController
    text
    copied!<p>I'm trying to create a basic navigation app using UINavigationController as root container for other inner UIViewController views. I have already achieved similar functionality with shared toolbar. I'm wondering, is it a good approach because the toolbar and its items are redrawed (i think ?) on every inner view. So, here are some details of my existing code. In my main MultiviewAppDelegate.m implementation file, in didFinishLaunchingWithOptions method, I am initializing UINavigationController, then initializing the first inner view (UIViewController) and then adding its view to UINavigationController. </p> <pre><code>UINavigationController *nc = [[UINavigationController alloc] init]; [self.window addSubview:nc.view]; ... FirstView *v1 = [[FirstView alloc] init]; [nc pushViewController:v1 animated:NO]; [nc setToolbarHidden:NO]; ... </code></pre> <p>All other inner views (like FirstView) extends BaseViewController class (BaseViewController extends UIViewController) because, in my BaseViewController, I have implemented shared toolbar that I want to be visible across inner views. So in the method viewDidLoad of BaseViewController class I'm doing the creation of that toolbar:</p> <pre><code>- (void)viewDidLoad { UIBarButtonItem *firstViewBtnItem = [[UIBarButtonItem alloc]initWithTitle:@"FirstView" style:UIBarButtonItemStyleBordered target:self action:@selector(showFirstView)]; UIBarButtonItem *secondViewBtnItem = [[UIBarButtonItem alloc]initWithTitle:@"SecondView" style:UIBarButtonItemStyleBordered target:self action:@selector(showSecondView)]; ... NSArray *items = [NSArray arrayWithObjects:firstViewBtnItem, secondViewBtnItem, ..., nil]; [firstViewBtnItem release]; [secondViewBtnItem release]; [self setToolbarItems:items]; ... </code></pre> <p>The thing is I'm not sure is it good to redraw a toolbar every time every new inner view comes up. So I'm not sure would it be a good decision to do the same with a background. Or maybe, I want too much :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload