refresh - Reload UIToolbar in UINavigationController without reloading view -


i using uinavigationcontroller , setting toolbar items using method settoolbaritems of topmost uiviewcontroller. works fine first time when user goes screen or when user revisits screen. have background thread communicates server. server send message remove button toolbar or change icon due application logic. @ time if call settoolbaritems method of current uiviewcontroller on main thread, toolbar items not updated. way reload uitoolbar of uinavigationcontroller without reloading entire view.

thanks

i had similar problem. when user leaves app change color scheme in ‘settings’, navigation bar, text, , color attributes needed updated. able update nav bar color nav bar text color not getting updated. solution: not using ‘storyboards’. in appdelegate.h have:

@property (….) customviewcontroller *viewcontroller; @property (….) uinavigationcontroller *nav;  

i did not @synthesize in appdelegate.m. in appdidfinishlaunchingwithoptions:

…. self.viewcontroller  = [[customviewcontroller alloc ….initwithnib…. [self setnavcontrollerattributes];  // solution in method self.window.rootviewcontroller = self.nav; …. 

the method of work in appdelegate.m

- (void) setnavcontrollerattributes {     self.nav = nil;     self.nav = [[uinavigationcontroller alloc…     // set attributes dictionary options , such     self.window.rootviewcontroller = self.nav; } 

i know setting *nav nil first time app runs works , set nil when user leaves , relaunches app. concern fact reassigning rootviewcontroller window, think arc take care of memory management. to make work call method again on re-launch in applicationwillenterforeground:

[self setnavcontrollerattributes]; 

i’m sure can tweak needs. other thing watch out for, guess, saving data because when set *nav nil, may deallocate child controllers , lose data. works ios 6. if notice different approach needed ios 7, come , update. if has additional suggestions take advice. hope helps

in applicationwillenterforeground: can better minimize memory , performance overhead. method update first view controller

if (self.viewcontroller.isviewloaded) {     [self setnavcontrollerattributes];     [self.viewcontroller viewwillappear:yes]; } if (self.viewcontroller.view.window) {     // perform other action if code above doesn't work } 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -