Skip to content

New feature request: Layout a grid inside a fixed frame #5

Description

@chmaynard

I would like to use this class to implement a game that always displays 12 cells in a grid with 4 rows and 3 columns. I want the aspect ratio of each cell to be 2x3. The collection view's frame is fixed and its dimensions will depend on the device. (I’m assuming that the base class UICollectionViewLayout can figure out the correct size of the collection view’s frame regardless of the device.)

I don’t think the standard flow layout can do this. In order to accomplish what I want, the class will need to adjust the margins (section insets) and the item spacing (distance between cells) to fit the grid inside the frame and make it look regular. In other words, the item spacing and insets should all be the same distance in points.

I plan to spend some time working on this packing problem. If I can find a solution, I’ll go ahead and submit a pull request. Suggestions welcome!

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions