ios - UINavigationBar back button item font color won't set -


i have navigation bar on viewcontroller can enable/disable. the problem can't font uibarbuttonitems change colors after view loads, though arrow change.

i disable uinavigationbar on myviewcontroller following line of code:

    self.navigationcontroller.navigationbar.userinteractionenabled = no; 

i have uicontrolstates configured in appdelegate.m uibarbuttonitems enabled , disabled, nothing happens font after view loads.

in appdelegate.m, have following code set uinavigationbar's font , color:

// uibarbuttonitem styling nsshadow *shadow = [[nsshadow alloc]init]; shadow.shadowoffset = cgsizemake(0.0, 1.0); shadow.shadowcolor = [uicolor whitecolor];  // enabled nsdictionary *enabledtextattributedictionary = @{nsforegroundcolorattributename : [uicolor customcellhyperlinkcolor], nsshadowattributename: shadow, nsfontattributename:[uifont fontwithname:@"gillsans" size:17.0]};  [[uibarbuttonitem appearancewhencontainedin:[uinavigationbar class], nil] settitletextattributes:enabledtextattributedictionary forstate:uicontrolstatenormal];  // disabled nsdictionary *disabledtextattributedictionary = @{nsforegroundcolorattributename : [uicolor lightgraycolor], nsshadowattributename: shadow, nsfontattributename:[uifont fontwithname:@"gillsans" size:17.0]};  [[uibarbuttonitem appearancewhencontainedin:[uinavigationbar class], nil] settitletextattributes:disabledtextattributedictionary forstate:uicontrolstatedisabled];  // uinavigationbartitle styling nsdictionary *titleattributedictionary = @{nsforegroundcolorattributename : [uicolor blackcolor], nsshadowattributename: shadow, nsfontattributename:[uifont fontwithname:@"gillsans" size:19.0]};  [[uinavigationbar appearancewhencontainedin:[uinavigationcontroller class], nil]settitletextattributes:titleattributedictionary]; 

i thought since configured 2 states (uicontrolstatenormal/uicontrolstatedisabled) in appdelegate.m, nothing needs done other enable/disable navigationbar. enable/disable indeed enable/disable, color on button label doesn't change (though set color set uicontrolstatenormal in appdelegate).

i tried manually set it, label on backbuttonitem stays blue while icon left of tints light gray. (obvious thing) missing preventing me changing color of button font?

i think looking add code in appdelegate.m

nsshadow *shadow = [[nsshadow alloc] init]; shadow.shadowoffset = cgsizemake(0.0, 1.0); shadow.shadowcolor = [uicolor clearcolor];  [[uibarbuttonitem appearancewhencontainedin:[uinavigationbar class], nil]  settitletextattributes:  @{nsforegroundcolorattributename:[uicolor redcolor],    nsshadowattributename:shadow,    nsfontattributename:[uifont systemfontofsize:13.0]    }  forstate:uicontrolstatenormal]; 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -