Monday 15 April 2013

Colorize UINavigationBar iPhone SDK -


I with orange color with my navigation bar:

Navigation controller Navigation BarTrint = [UIColor ColorWithRed: 0.88 Green Color: 0.52 Blue: 0.27 Alpha: 1];

Everything is fine, every button is orange in the form of a bar, but when the IC custom is connected to the right item menu, it shows the blue. This is a screenshot:

And this is the code for the right button:

  UIView * container = [[UIView alloc] init]; UIToolbar * tools = [[Uitoolbar alloc] initWithFrame: CGRectMake (0, 0, 80, 45)]; NSMutableArray * button = [[NSMutableArray alloc] initWithCapacity: 2]; UIBarButtonItem * bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItem Add target: Self-action: @selector (addGadget :)]; Bi.style = UIBarButtonItemStyleBordered; [Button addObject: bi]; [BI release]; Bi = [[UIBarButtonItem alloc] initWithImage: [UIImage imageNamed: @ "less.png"] Style: UIBarButtonItemStyleBordered Target: Self-action: @selector (setEditing :)]; [Button addObject: bi]; [BI release]; [Tool sets: Animated button: No]; [Button release]; Self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: Tools]; [Device release];  

Can someone help me fix this problem? (I want to be everything orange)

You should set tintcolor The UIToolbar object must be the same as the UINavigationBar .

Note that a UIToolbar is not such a UINavigationBar , background gradient / color is slightly different. Try setting the background color of the UIToolbar for + [UIColor clearColor]

Also besides, you probably do not need container UIView , Because is a subclass of UIToolbar UIView , so you can also use it as a customview by yourself.


No comments:

Post a Comment