【发布时间】:2018-01-15 10:51:58
【问题描述】:
对于我在 iPhone X 上的应用,我需要创建一个页脚。这里没问题。
但是我需要把导航栏的颜色设置为相同。
navigationBar 的颜色是在 barTintColor 上设置的,不能更改。
构建的应用程序,在导航栏上自动设置 UIVisualEffect 并且颜色更改:它更亮了。
如何获得导航栏显示的颜色?
我试过但没用:
footer.backgroundColor = [UIColor myColor]footer.tintColor = [UIColor myColor]footer.tintColor = navigationBar.barTintColorfooter.backgroundColor = navigationBar.barTintColorimageView.image = [self.navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault]; [footer addSubview: imageView];UIVisualEffect *blurEffect; blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; UIVisualEffectView* visualView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; [self.footer addSubview:visualView];
**导航栏代码:**
self.navigationController.navigationBar.barTintColor = tintColor;
[self.navigationController.navigationBar setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont dpBoldFontWithSize:16.8],NSFontAttributeName,
fontColor,NSForegroundColorAttributeName,
nil]];
[self.navigationItem setTitle:title];
**页脚代码**
self.footerView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - 35, self.view.width, 35)];
[self.footerView setBackgroundColor:color];
[self.view addSubview:self.footerView];
问题截图:
【问题讨论】:
-
在页脚视图中添加 UIVisualEffectView 怎么样?
-
我尝试了模糊效果StyleLight,但没有颜色变化
-
嗯,您没有在此处设置
visualView的框架。你能添加一些代码或上下文吗? -
我加了一个框架,颜色没有变化
-
使用 navigationBar.isTranslucent = false ?
标签: ios