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

Crashlytics CarouselAndPageViewController.swift - 行 112 #274

Open
YingZheng02590218 opened this issue Jun 25, 2024 · 0 comments
Open

Crashlytics CarouselAndPageViewController.swift - 行 112 #274

YingZheng02590218 opened this issue Jun 25, 2024 · 0 comments

Comments

@YingZheng02590218
Copy link
Owner

YingZheng02590218 commented Jun 25, 2024

クラッシュしているので対策する

CarouselAndPageViewController.swift - 行 112
specialized CarouselAndPageViewController.collectionView(_:layout:sizeForItemAt:) + 112

Screenshot 2024-06-25 at 21 09 47

UICollectionViewで画面の回転に合わせてCellのサイズを変更する良い方法
https://seeku.hateblo.jp/entry/2015/05/06/124310
UICollectionViewに知らせるタイミング
すぐに思いつくタイミグは次の2つ。

viewWillTransitionToSize()
viewDidLayoutSubviews()
通知を使うのは面倒なので今回は省略。で、どのタイミングを使うのが良いのか?

実際にやってみた結果・・・ 現時点ではどっちも大差ない結果に。あとは、好みで選べばいい?

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        collectionView.collectionViewLayout.invalidateLayout()
        collectionView.reloadData()
    }
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