viv*_*iya 1 iphone objective-c ios ios7
我想在iOS7中设置工具栏的背景颜色:我用这个设置颜色:
toolBar= [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,320,40)];
[toolBar setBarStyle:UIBarStyleBlack];
toolBar.items = [[NSArray alloc] initWithObjects:barButtonDone,flexible,barButtonOther,nil];
toolBar.tintColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"dropdownbar"]];
Run Code Online (Sandbox Code Playgroud)
但是背景图像没有显示.

我想知道这是做什么的:
NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
if ([[ver objectAtIndex:0] intValue] >= 7) {
self.navigationController.navigationBar.barTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_bar"]];
self.navigationController.navigationBar.translucent = NO;
} else {
self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_bar"]];
}
Run Code Online (Sandbox Code Playgroud)
Nd如何更改默认导航栏的后退按钮颜色:

在iOS 7中,您必须使用toolbar.barTintColor设置颜色,toolbar.tintColor将设置工具栏内barButtons的颜色.
最后一段代码测试应用程序是否在iOS 7上运行,如果使用它barTintColor,如果不是,tintColor则将使用.
要更改backButton,您可以通过设置tintColornavigationBar 来执行相同操作
| 归档时间: |
|
| 查看次数: |
8241 次 |
| 最近记录: |