iphone - Change the navigation bar's font -
the question plain easy , simple, answer unfortunately not.
how can change font of text in uinavigationbar
?
from ios 7 , later:
nsshadow* shadow = [nsshadow new]; shadow.shadowoffset = cgsizemake(0.0f, 1.0f); shadow.shadowcolor = [uicolor redcolor]; [[uinavigationbar appearance] settitletextattributes: @{ nsforegroundcolorattributename: [uicolor greencolor], nsfontattributename: [uifont fontwithname:@"helvetica" size:20.0f], nsshadowattributename: shadow }];
from ios 5 , later:
[[uinavigationbar appearance] settitletextattributes: @{ uitextattributetextcolor: [uicolor greencolor], uitextattributetextshadowcolor: [uicolor redcolor], uitextattributetextshadowoffset: [nsvalue valuewithuioffset:uioffsetmake(0.0f, 1.0f)], uitextattributefont: [uifont fontwithname:@"helvetica" size:20.0f] }];
earlier ios 5:
uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 400, 44)]; label.backgroundcolor = [uicolor clearcolor]; label.font = [uifont boldsystemfontofsize:20.0]; label.shadowcolor = [uicolor colorwithwhite:0.0 alpha:0.5]; label.textalignment = uitextalignmentcenter; label.textcolor =[uicolor whitecolor]; label.text=self.title; self.navigationitem.titleview = label; [label release];
Comments
Post a Comment