We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么我在我的项目中使用这些代码,在每次切换菜单的时候都会调用viewDidLayoutSubviews,导致menu每次都从0重新滚动一遍。而你的demo却没有,我自己做个实验,新建一个空白 的项目只放一个uiscrollview 每次向这个scrollview添加view的时候都会调用 viewDidLayoutSubviews。 真心很奇怪
The text was updated successfully, but these errors were encountered:
hi, @xoxhk 是否在视图内部使用了Autolayout呢? 最近刚修复了这个引起的bug。 可以使用下最新的,看下bug是否还存在?
Autolayout
Sorry, something went wrong.
嗯,非常谢谢你提供的代码,我的每个的controller是从storybord加载的,内部有用autolayout, 我看到你修复的代码了,现在可以了,如果你有空能解释一下为什么就好了, 一直对autolayout的处理过程,导致相关回调函数被调用的情况不实很清楚 CGFloat oldSuperviewHeight = _superviewHeight; _superviewHeight = self.view.frame.size.height; if (_hasInited && _superviewHeight == oldSuperviewHeight) return;
这段代码主要是判断了 如果 self.view 的高度不变,就禁止下面的代码执行。 (下面代码有对scrollView的contentOffset进行改变) 由于autolayout的存在,在scrollView滚动时会调用 -viewDidLayoutSubviews(具体系统是如何调用的还有待研究,如果知道还望告知),此时会引起重设contentOffset的情况,导致无法滚动或是滚动异常。
self.view
No branches or pull requests
为什么我在我的项目中使用这些代码,在每次切换菜单的时候都会调用viewDidLayoutSubviews,导致menu每次都从0重新滚动一遍。而你的demo却没有,我自己做个实验,新建一个空白 的项目只放一个uiscrollview 每次向这个scrollview添加view的时候都会调用 viewDidLayoutSubviews。
真心很奇怪
The text was updated successfully, but these errors were encountered: