gpt4 book ai didi

ios - 在 iOS10 上滚动正文时,我可以阻止隐藏底部菜单栏吗?

转载 作者:行者123 更新时间:2023-11-28 04:54:19 27 4
gpt4 key购买 nike

当您在 iOS 10 Safari 上滚动主体时,底部控件会隐藏。我可以阻止吗?

我需要 body 可以滚动。

最佳答案

这是代码

func scrollViewWillBeginDragging(scrollView: UIScrollView) {
if scrollView.panGestureRecognizer.translationInView(scrollView).y < 0{
changeTabBar(true, animated: true)
}
else{
changeTabBar(false, animated: true)
}
}
You can also use the other callback method:

func scrollViewDidScroll(scrollView: UIScrollView) {
...
}
but if you choose so, then you most handle multiple calls to the helper method that actually hides the tabBar.

And then you need to add this method that animates the hide/show of the tabBar.

func changeTabBar(hidden:Bool, animated: Bool){
var tabBar = self.tabBarController?.tabBar
if tabBar!.hidden == hidden{ return }
let frame = tabBar?.frame
let offset = (hidden ? (frame?.size.height)! : -(frame?.size.height)!)
let duration:NSTimeInterval = (animated ? 0.5 : 0.0)
tabBar?.hidden = false
if frame != nil
{
UIView.animateWithDuration(duration,
animations: {tabBar!.frame = CGRectOffset(frame!, 0, offset)},
completion: {
println($0)
if $0 {tabBar?.hidden = hidden}
})
}
}

关于ios - 在 iOS10 上滚动正文时,我可以阻止隐藏底部菜单栏吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40503010/

27 4 0