didi/Hummer

ViewPager has layout problems on iOS 15; ViewPager 在 iOS 15 系统上出现布局问题

wymann01 opened this issue · 0 comments

描述

在 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.

Hummer version: 0.2.8(2023.1.7 使用 master 分支出现该问题)

Hummer version: 0.2.8(2023.1.7 use branch master)

复现步骤

  1. 在页面内添加 ViewPager 组件
  2. ViewPager 组件使用自定义 View

  1. Add ViewPager to my page
  2. Use custom view as the ViewPager's Cell

预期结果

正常显示所有 ViewPagerCell
Display all ViewPager's Cell

样例代码、屏幕截图或者仓库链接

不正常的展示:
Display abnormally:
宽高为 0

正常的展示:
Display normally:
正常显示

复现仓库地址

https://github.com/wymann01/TSHummerKit
分支:master
branch: master