JXCategoryView
JXCategoryView copied to clipboard
iOS15 点击切换时卡顿
bug提交前阅读 1.请先仔细阅读文档,尤其是【其他注意事项】文档,里面有常见问题的解决方案; 2.请先搜索已有的Issues,尝试找到相同问题的讨论; 3.请先阅读相关类的API、源码,尝试从源码找到答案; 4.如果以上步骤都未能解决你的疑问,欢迎提交ISSUE;
bug描述 iOS15,iPhone12Mini,点击切换tab时卡顿,模拟器和低版本系统手机没有这个问题
版本号 1.JXCategoryView版本号:1.5.9 2.手机系统版本号:iOS15.0.2 3.手机型号:iPhone 12 mini
复现步骤
- 遇到问题的相关效果、类是:JXCategoryListContainerView 2.具体的操作步骤是:点击切换tab
截图、GIF
https://user-images.githubusercontent.com/7610726/138453006-9a08d550-6be0-43c3-a104-42386227b2d5.mp4
通过关闭动画,暂时解决了:JXCategoryBaseView:543行 [self.contentScrollView setContentOffset:CGPointMake(targetIndexself.contentScrollView.bounds.size.width, 0) animated:self.isContentScrollViewClickTransitionAnimationEnabled]; 修改成[self.contentScrollView setContentOffset:CGPointMake(targetIndexself.contentScrollView.bounds.size.width, 0)];
通过demo测试,这应该是iOS 15 iphone mini 系统手机自己的问题,写一个最简单的demo,进行视图动画,也会出现动画残影的问题。
同上问题,iphone13 pro ,iOS15.0.2
找到个了解决方式,JXCategoryBaseView:543行 [self.contentScrollView setContentOffset:CGPointMake(targetIndexself.contentScrollView.bounds.size.width, 0) animated:self.isContentScrollViewClickTransitionAnimationEnabled]; 修改成 [UIView animateWithDuration:0.2 animations:^{ [self.contentScrollView setContentOffset:CGPointMake(targetIndex*self.contentScrollView.bounds.size.width, 0)]; }]; 是否需要动画自行判断
经测试 楼上的方法 可行 , 本人机型 iPhone 12 Pro Max . 15.0.2的系统. 快速点击切换的时候,会卡顿
if (self.isContentScrollViewClickTransitionAnimationEnabled) { [UIView animateWithDuration:0.2 animations:^{ [self.contentScrollView setContentOffset:CGPointMake(targetIndexself.contentScrollView.bounds.size.width, 0)]; }]; }else { [self.contentScrollView setContentOffset:CGPointMake(targetIndexself.contentScrollView.bounds.size.width, 0)]; } 这样子可以兼容切换时
不用动画/需要动画
的场景