Ios UIToolbar tintColor和barTintColor问题
我有这样的代码:Ios UIToolbar tintColor和barTintColor问题,ios,uiview,ios7,uitoolbar,tintcolor,Ios,Uiview,Ios7,Uitoolbar,Tintcolor,我有这样的代码: UIView *colorView = [[UIView alloc] init]; colorView.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 64.0); colorView.backgroundColor = [UIColor blackColor]; //colorView.tintColor = [UIColor blackColor]; UIToolbar *toolbar = [[UITo
UIView *colorView = [[UIView alloc] init];
colorView.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 64.0);
colorView.backgroundColor = [UIColor blackColor];
//colorView.tintColor = [UIColor blackColor];
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 44.0);
self.view addSubview:colorView];
[self.view addSubview:toolbar];
为什么工具栏子视图的颜色与我的视图不同?视图显示为黑色,工具栏显示为浅灰色?是否有模糊或其他原因导致此问题?尝试此代码,它将帮助您
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, 44.0);
toolbar.barStyle = UIBarStyleBlackTranslucent;
toolbar.tintColor = [UIColor blackColor];
toolbar.alpha = 0.0;
根据您的要求更改
tintColor
和alpha
。UINavigationBar
的某些属性的行为已从iOS 7
更改。我已经在我的报告中解释了这件事
查看ios6
和ios7
的条形图样式:
您可以在这里注意到两点:
半透明暗
,而不是半透明光
(默认设置)半透明
属性从是
(默认)更改为否
我想制作一个64.0高的工具栏,其颜色与导航栏相同。默认情况下,
UIToolBar
的-barStyle
是iOS7
中的半透明灯光。您可以将其更改为半透明暗
。