Reputation: 247
I want to set the navigator bar tint to white but the bottom tool bar tint to red.
The navigator bar tint is set at storyboard, and the tool bar tint is set in code.
self.navigationController?.toolbar.tintColor=UIColor.redColor()
But the code dose not work.
Upvotes: 2
Views: 2578
Reputation: 96
In Objectivec-c
UIToolbar *doneToolbar=[[UIToolbar alloc]initWithFrame:CGRectMake(0,
self.view.frame.size.height-44, 320, 44)];
doneToolbar.translucent=NO;
doneToolbar.barTintColor=[UIColor redColor];
[self.view addSubview:doneTool bar];
for more information click here
Upvotes: 0
Reputation: 514
Swift:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
var nav = self.navigationController?.navigationBar
nav?.barStyle = UIBarStyle.Black
nav?.tintColor = UIColor.whiteColor()
nav?.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.orangeColor()]
}
Objective-C:
NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, nil];
[[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions];
textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, nil];
[[UINavigationBar appearance] setTintColor:[UIColor redColor]];
[[UIToolbar appearance] setTintColor:[UIColor redColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor redColor]];
Upvotes: 2