在 iOS 15.4 系统(iPhone 11)上,使用 ViewPager,使用自定义 View 作为 Cell 时偶现布局问题:Cell 内所有 View 的宽高变为 0。滑动几次后才会正常显示。
When I use HMViewPager on iPhone11, iOS 15.4, I ran into a layout problem with custom views: the width and height of all views in HMViewPagerCell becomes 0. It can only be displayed properly after a few swipes.
在 Android 手机(OPPO R17, Android 10)未出现该问题。
我猜测可能是 ViewPager 使用 UICollectionView 实现的缘故。我换了一个基于 UIScrollView 实现的 ViewPager 后没有出现该问题。
This problem does not occur on my Android phone(OPPO R17, Android 10)
I suspect the problem has to do with the fact that HMViewPager is implemented in UICollectionView, because when I switched to a UIScrollView-based ViewPager, the problem disappeared.
描述
在 iOS 15.4 系统(iPhone 11)上,使用 ViewPager,使用自定义 View 作为 Cell 时偶现布局问题:Cell 内所有 View 的宽高变为 0。滑动几次后才会正常显示。 When I use HMViewPager on iPhone11, iOS 15.4, I ran into a layout problem with custom views: the width and height of all views in HMViewPagerCell becomes 0. It can only be displayed properly after a few swipes.
Hummer version: 0.2.8(2023.1.7 使用 master 分支出现该问题)
Hummer version: 0.2.8(2023.1.7 use branch master)
复现步骤
ViewPager 组件使用自定义 View
预期结果
正常显示所有 ViewPagerCell Display all ViewPager's Cell
样例代码、屏幕截图或者仓库链接
不正常的展示: Display abnormally:![宽高为 0](https://user-images.githubusercontent.com/48399927/211140435-2eb7bbfb-6088-4507-8b9b-8356ae8b62f5.jpg)
正常的展示: Display normally:![正常显示](https://user-images.githubusercontent.com/48399927/211140497-bc183591-e216-4a69-8113-e4449f82d0d9.jpg)
复现仓库地址
https://github.com/wymann01/TSHummerKit 分支:master branch: master