Skip to content
This repository was archived by the owner on May 15, 2020. It is now read-only.
This repository was archived by the owner on May 15, 2020. It is now read-only.

Suggestions for using collectionViewLayout:sizeForItemAtIndexPath: #2

Description

@Nemesisprime

At the moment, I'm using a static size cell, however, it'd be nice to actually size the cells to fit their content.

UAFilterableResultsController provides filteredObjectAtIndexPath to get items by their indexPath and it works in the other delegate calls, but not in this case.

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
    let viewModel = self.searchResultsController.filteredObjectAtIndexPath(indexPath) as! Object
    let titleWidth = //...
    return CGSizeMake(titleWidth, 44)
}

It'll work on the initial go, but as soon as you attempt to filter the results, you'll get a crash. I know that's vague, but I haven't looked too deep into it yet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions