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

WMStickyPageController可能出现滚动不了的bug #642

Open
dadadong opened this issue Dec 29, 2020 · 0 comments · May be fixed by #643
Open

WMStickyPageController可能出现滚动不了的bug #642

dadadong opened this issue Dec 29, 2020 · 0 comments · May be fixed by #643

Comments

@dadadong
Copy link

dadadong commented Dec 29, 2020

问题 及 方案 见图:
image

WMMagicScrollView.m中的 
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context ;

         bug:
         maximumContentOffsetY 这个数值必须是像素的整数倍, 否则 196 行 设置contentOffset的值并不会精准, 系统会自动调整contentOffset像素对齐,
         这时 207 行的判断是错误, 导致otherScrollView无法被滚动
         例如: maximumContentOffsetY = 151.72 在3x屏幕时, 设置给scrollView的contentOffset后, 会被系统纠正为contentOffset = 151.666... ,
         207 行的判断 self.contentOffset.y(151.666...) < maximumContentOffsetY(151.72) 将会一直满足
         
         fix:
         方案1: 对齐像素 添加 maximumContentOffsetY = roundf(maximumContentOffsetY / (1/[UIScreen mainScreen].scale)) * (1/[UIScreen mainScreen].scale);
         方案2: 也是对齐像素, 直接取整 maximumContentOffsetY = roundf(maximumContentOffsetY);

// 1:       maximumContentOffsetY = roundf(maximumContentOffsetY / (1/[UIScreen mainScreen].scale)) * (1/[UIScreen mainScreen].scale);
// 2:       maximumContentOffsetY = roundf(maximumContentOffsetY)
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

Successfully merging a pull request may close this issue.

1 participant