简体   繁体   English

顶部工具栏和导航栏的常见模糊效果

[英]Common blur effect for top tool bar and navigation bar

I have many ViewControllers inside one NavigationController. 我在一个NavigationController中有许多ViewController。 In one of ViewControllers I should show toolBar below navigationBar. 在其中一个ViewController中,我应该在navigationBar下面显示toolBar。 If simply add it to ViewController with necessary coordinates I have this: 如果简单地将其添加到具有必要坐标的ViewController中,我将具有以下内容:

在此处输入图片说明

But here is separator between NavigationBar and ToolBar. 但是这里是NavigationBar和ToolBar之间的分隔符。

If I set clear background and shadow images and set blur effect for navigationBar it is a problem with different blur effects in navigationBar and toolBar: 如果我设置了清晰的背景和阴影图像,并为NavigationBar设置了模糊效果,那么NavigationBar和ToolBar中的模糊效果就会不同: 在此处输入图片说明 So is it resolution when there is no imagesShadow in navigationBar and there is common blur effect? 那么当NavigationBar中没有imagesShadow且存在常见的模糊效果时,分辨率是多少?

I resolve my problem. 我解决了我的问题。 Idea of resolution make NavigationBar and ToolBar fully transparent. 解决方案的想法使NavigationBar和ToolBar完全透明。 Next On every ViewController in place of bars and below them I put UIVisualEffectView with common height of bar or bars. 接下来,在每个ViewController上代替条形图的地方,在它们下面,我将UIVisualEffectView放置为具有常见条形图的高度。 So UIVisualEffectView simply should be the highest subview of rootView of ViewController. 因此,UIVisualEffectView应该只是ViewController的rootView的最高子视图。 And here is a problem in case of using UITalbeViewController UITabBarController and so on. 在使用UITalbeViewController UITabBarController等的情况下,这是一个问题。 In my situation there was only UITalbeViewControllers. 在我的情况下,只有UITalbeViewControllers。 Firstly I try to use this resolution . 首先,我尝试使用此分辨率 But I had problems with creating of multiple subviews wile navigation via different ViewControllers. 但是我在通过不同的ViewControllers创建多个子视图导航时遇到了问题。 Finaly I restructure storyboard. 最后,我重组情节提要。 Every TableViewController I have replaced by ViewController with rootView simple view. 我用rootView简单视图将每个TableViewController替换为ViewController。 TableView was subview of rootView. TableView是rootView的子视图。 Also I put there VisualEffectView. 我也把VisualEffectView放在那里。 I have done it for every TableViewControllers. 我已经为每个TableViewControllers做到了。 Here is a sample of structure: 这是一个结构示例:

控制器结构样本

I think there is there better resolution but currently this is optimal. 我认为有更好的分辨率,但目前这是最佳的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM