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
    中的
    半透明灯光。您可以将其更改为半透明暗