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

Question - Is it possible to have half screen width UICollectionViewCells with ComponentsKit? #89

Closed
aaronschubert0 opened this issue Apr 9, 2015 · 2 comments

Comments

@aaronschubert0
Copy link
Contributor

Currently I'm trying to create a half screen width component so that in theory I could have two cells side by side.

This is the code I've got and my expectation is that it would fill only half the width of the screen but it fills the whole screen width instead:

    return [super newWithComponent:
            [CKComponent
             newWithView:{
                 [UIView class],
                 {
                     {@selector(setBackgroundColor:),[UIColor redColor]}
                 }
             }
             size:{
                 .width = CKRelativeDimension::Percent(0.5),.height = 120
             }]];
@aaronschubert0 aaronschubert0 changed the title Question - Is it possible to have half UICollectionViewCells with ComponentsKit Question - Is it possible to have half screen width UICollectionViewCells with ComponentsKit? Apr 9, 2015
@smiLLe
Copy link

smiLLe commented Apr 9, 2015

You could try to set the constrained size to the half width of your CollectionView?!

[_dataSource
        enqueueChangeset:{listSctions, listItems}
        constrainedSize:[_sizeRangeProvider
          sizeRangeForBoundingSize:CGSizeMake(CGRectGetWidth(self.collectionView.bounds) / 2.0f, CGRectGetHeight(self.collectionView.bounds))
        ]
      ];

@aaronschubert0
Copy link
Contributor Author

But of course!! Just a heads up for anyone else trying this, you need to enqueue this on a separate CKArrayControllerInputItems otherwise, all the previous items are affected (obviously)

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

2 participants