Skip to content
New issue

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

跳转返回UITableViewController后contentoffset变了 #116

Open
elsenpan opened this issue Mar 6, 2018 · 0 comments
Open

跳转返回UITableViewController后contentoffset变了 #116

elsenpan opened this issue Mar 6, 2018 · 0 comments

Comments

@elsenpan
Copy link

elsenpan commented Mar 6, 2018

界面结构是UITabBarController->UINavigationController->UITableViewController

如果push一个viewController再pop回UITableViewController, UITableViewController里的contentoffset发生了变化(和push前不一致,tableview上移了)。

测试设备:iPhone SE, iOS 11.2.6


修改源码:

注释掉以下方法的内容:
-(void)km_adjustScrollViewContentInsetAdjustmentBehavior()
-(void)km_restoreScrollViewContentInsetAdjustmentBehaviorIfNeeded()

或者:
在 -(void)km_adjustScrollViewContentInsetAdjustmentBehavior()方法中的scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
后面重新设置修改前的contentoffset

以上两种修改都可以解决我的问题。


请教下为什么在viewWillAppear中
设置scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
然后在viewDidAppear设置回原先的值?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant