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

iPad Split 模式下布局异常 #31

Open
xiaerfei opened this issue Feb 7, 2024 · 0 comments
Open

iPad Split 模式下布局异常 #31

xiaerfei opened this issue Feb 7, 2024 · 0 comments

Comments

@xiaerfei
Copy link

xiaerfei commented Feb 7, 2024

在 iPad Split 模式下会产生布局异常的问题,如下视频,拖动顶部的三个点进入 Split 模式,然后点击 App 退出 Split 模式:

test.mp4

究其原因问题产生在下面这段代码上:

- (void)layoutSubviews {
    [super layoutSubviews];
    
    if (CGSizeEqualToSize(self.originSize, CGSizeZero)) return;
    
    // 解决xib加载时导致的布局错误问题
    if (!CGSizeEqualToSize(self.bounds.size, self.originSize)) {
        [self updateScrollViewAndCellSize];
    }
}

在不 reload 的情况下,self.originSize 不会发生变化:

  1. 现在 self.originSize{300, 300}
  2. 进入 Split 模式, self.bounds.size 变为 {150, 150},此时调用 updateScrollViewAndCellSize
  3. 退出 Split 模式,self.bounds.size 变为 {300, 300},此时没有调用 updateScrollViewAndCellSize
  4. cell layout 现在异常了

目前我暂时去掉了 CGSizeEqualToSize(self.bounds.size, self.originSize) 判断,经过 QA 测试暂未发现异常

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