objective c - Make a custom title view for a backBarButtonItem -


i making custom backbarbuttonitem png , works fine. question how change text color. way did on navigation bar this:

cgrect frame = cgrectmake(0, 0, 400, 44); uilabel *label = [[[uilabel alloc] initwithframe:frame] autorelease]; 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 colorwithpatternimage:[uiimage imagenamed:@"acolor.png"]]; self.navigationitem.titleview = label; label.text = @"atitle"; 

dont use autorelease set label titleview,after assign them release them

        cgrect frame = cgrectmake(0, 0, 400, 44);          uilabel *label = [[uilabel alloc] initwithframe:frame];          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 colorwithpatternimage:[uiimage imagenamed:@"acolor.png"]];          label.text = @"atitle";          self.navigationitem.titleview = label;          [label release]; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -