【发布时间】:2015-01-23 07:25:43
【问题描述】:
我想将导航栏色调设置为白色,但将底部工具栏色调设置为红色。
导航栏色调在storyboard中设置,工具栏色调在代码中设置。
self.navigationController?.toolbar.tintColor=UIColor.redColor()
但代码不起作用。
【问题讨论】:
标签: ios objective-c swift uitoolbar tintcolor
我想将导航栏色调设置为白色,但将底部工具栏色调设置为红色。
导航栏色调在storyboard中设置,工具栏色调在代码中设置。
self.navigationController?.toolbar.tintColor=UIColor.redColor()
但代码不起作用。
【问题讨论】:
标签: ios objective-c swift uitoolbar tintcolor
斯威夫特:
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()]
}
目标-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]];
【讨论】:
在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];
更多信息请点击here
【讨论】: