Iglistkit: Invalidate ListCollectionViewLayout after device rotation

Created on 9 Feb 2018  路  2Comments  路  Source: Instagram/IGListKit

New issue checklist

General information

  • IGListKit version: 3.2.0
  • iOS version(s): 11.2.5
  • CocoaPods/Carthage version: CocoaPods 1.3.1
  • Xcode version: 9.2
  • Devices/Simulators affected: All
  • Reproducible in the demo project? (Yes/No): Yes, Storyboard demo for example
  • Related issues:

Hello, is there a way to invalidate ListCollectionViewLayout after device rotation? It seems that when I use this layout and rotate my device, sizeForItem is not triggered in section controllers. It is working fine when switching back to UICollectionViewFlowLayout. Any advice would be appreciated. Thanks!

question

Most helpful comment

Thanks @jessesquires 馃憤

I've ended up with something like this:

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
        super.traitCollectionDidChange(previousTraitCollection)
        adapter.reloadData(completion: nil)
}

It's not probably the most effective solution, but it's working. Thnx again for great library鉁岋笍

All 2 comments

Hey @jurex !

You should be able to do this in your view controller. See Apple's UIViewController docs and look for the traitCollectionDidChange callback.

Thanks @jessesquires 馃憤

I've ended up with something like this:

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
        super.traitCollectionDidChange(previousTraitCollection)
        adapter.reloadData(completion: nil)
}

It's not probably the most effective solution, but it's working. Thnx again for great library鉁岋笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucabartoletti picture lucabartoletti  路  3Comments

PhilCai1993 picture PhilCai1993  路  3Comments

runmad picture runmad  路  3Comments

rnystrom picture rnystrom  路  3Comments

joseph-francis picture joseph-francis  路  3Comments