简体   繁体   English

在滚动时迅速调整iOS大小

[英]swift iOS resize view on scroll

I have a VC with a navigation bar and then a uiview under it that acts as an extension to the navbar. 我有一个带有导航栏的VC,然后在它下面的一个uiview作为导航栏的扩展。

Then I have a embedded table view. 然后,我有一个嵌入式表视图。

What I would like to do is to add a scroll recogniser to the container view that holds the table view so when I scroll down the uiview under the navigation bar should be hidden. 我想做的是向包含表视图的容器视图中添加一个滚动识别器,因此当我向下滚动时,导航栏下的uiview应该被隐藏。

Is this possible? 这可能吗? I have used self.navigationController?.setNavigationBarHidden(true, animated: true) In order to hide the navigation bar and that works. 我已经使用self.navigationController?.setNavigationBarHidden(true, animated: true)来隐藏导航栏,并且可以正常工作。 The problem is that I now need to hide the uiview under it. 问题是我现在需要将uiview隐藏在它下面。 And I can't get it to work/feel smooth since just a hide/show functions looks strange. 而且我无法使其工作/感觉流畅,因为仅一个隐藏/显示功能看起来很奇怪。 I would like it to be hidden the same speed as I scroll 我希望它以与滚动相同的速度被隐藏

iOS 8 has advaced functionality for such effects already buildin. iOS 8具有针对内置效果的高级功能。 See here: http://natashatherobot.com/navigation-bar-interactions-ios8/ 看到这里: http : //natashatherobot.com/navigation-bar-interactions-ios8/

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

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