ios - removing uinavigationbar title margins -
i modified navigation bar follows in app delegate:
nsdictionary *settings = @{ uitextattributefont : [uifont fontwithname:@"impact" size:36.0], uitextattributetextcolor : [uicolor whitecolor], uitextattributetextshadowcolor : [uicolor clearcolor], uitextattributetextshadowoffset : [nsvalue valuewithuioffset:uioffsetzero]}; [[uinavigationbar appearance] settitletextattributes:settings];
but font cuts down larger font. :
i tried doing in viewwillappear of vc, :
uiview *newtitleview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 44)]; [newtitleview setbackgroundcolor:[uicolor blackcolor]]; [self.navigationcontroller.navigationbar addsubview:newtitleview];
then going align title center. doesn't seems right. thing need remove margins @ top , bottom of title label. how go it.
try code , don't set settitletextattributes
uilabel *titleview = (uilabel *)self.navigationitem.titleview; if (!titleview) { titleview = [[uilabel alloc] initwithframe:cgrectzero]; titleview.backgroundcolor = [uicolor clearcolor]; titleview.font = [uifont boldsystemfontofsize:20.0]; titleview.shadowcolor = [uicolor colorwithwhite:0.0 alpha:0.5]; titleview.textcolor = [uicolor yellowcolor]; // change desired color self.navigationcontroller.navigationitem.titleview = titleview; [titleview release]; } titleview.text = title; [titleview sizetofit];
Comments
Post a Comment