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:
- set current settings while init
uiviewcontroller
- 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
Post a Comment