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
Post a Comment