ios - One instance of navigation bar in every tab -


i've been struggling problem several days. in application have tab bar controller uinavigationviewcontrollers inside. want every navigation bar in every navigation controller same depending on user actions , app state. example: if user logged in app in first view controller, app sets name in navigation bar , sets navigation bar logged in state. when user selects other tab item, want set logged in state of navigation bar first view controller other view controllers. i've tried use singleton no effect.

seems have 2 things:

  1. set current settings while init uiviewcontroller
  2. update initiated controllers after state changes

to 1: create class with

@interface uiviewcontroller (uinavigationcontroller)  - (uinavigationcontroller*)wrapwithnavigationcontroller;  @end  @implementation uiviewcontroller (uinavigationcontroller)  - (uinavigationcontroller*)wrapwithnavigationcontroller {     uinavigationcontroller* navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:self];      // customizations     navigationcontroller.navigationbar.barstyle = uibarstyleblack;     [...]      return [navigationcontroller autorelease]; }  @end 

you can call uiviewcontrolleradditions example.

to 2:

use nsnotificationcenter updates :)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -