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

Doens't work correctly after changing cell size programmatically. #9

Closed
git-hwa opened this issue Sep 16, 2016 · 2 comments
Closed

Comments

@git-hwa
Copy link

git-hwa commented Sep 16, 2016

Thank you for this awesome library for collection view.

I have integrated your library in my project, and I have one problem.
After calling UICollectionViewDelegateFlowLayout method - sizeForItemAt, the transitioning cell sizes are doesn't changed.

My code is here and there are written on both of first and second view controller.

extension MyViewController: UICollectionViewDelegateFlowLayout {
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        let desiredWidth = (self.view.frame.size.width - 2) / 2
        let desiredHeight = desiredWidth

        return CGSize(width: desiredWidth, height: desiredHeight)
    }
}

Please let me know how can I handle this problem.
Thank you

@git-hwa
Copy link
Author

git-hwa commented Sep 19, 2016

@CezaryKopacz Any solution for this issue?
It seems your example project also doesn't work with my approach.

@git-hwa
Copy link
Author

git-hwa commented Sep 22, 2016

I have fixed by setting itemSize manually.

extension MyViewController: UICollectionViewDelegateFlowLayout {
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        let desiredWidth = (self.view.frame.size.width - 2) / 2
        let desiredHeight = desiredWidth

        (self.collectionViewLayout as! UICollectionViewFlowLayout).itemSize = CGSize(width: desiredWidth, height: desiredHeight)

        return CGSize(width: desiredWidth, height: desiredHeight)
    }
}

@git-hwa git-hwa closed this as completed Sep 22, 2016
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