-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[ASCollectionNode] Add support for using UICollectionViewCells #2948
Conversation
|
||
if (!AS_AT_LEAST_IOS8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting rid of this because we're dropping iOS 7 support
return cell; | ||
} | ||
|
||
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(_ASCollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
// Since _ASCollectionViewCell is not available for subclassing, this is faster than isKindOfClass: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revisit this after/in light of #2942 which has a lot of these same hooks.
Just wondering, what are we getting out of this? From the description, it seems like using ASCellNode over UICollectionViewCell is a no brainer. |
@QuynhNguyen - great question!
This change allows mixing both those un-ported That said, I think @Adlai-Holler implemented this feature in #2942 so we may not need this PR anymore. |
I'm closing this PR – supporting this use case will be much different in light of #2942 so let's take a fresh stab at it. If you disagree and want to fix forward from this PR, feel free to reopen. |
Paired programming with @appleguy.
This method offers compatibility with synchronous, standard UICollectionViewCell objects. These cells will not have the performance benefits of ASCellNodes (like preloading, async layout, and async drawing) - even when mixed within the same ASCollectionNode.
In order to use this method, you must:
4a. UICollectionViewFlowLayout (incl. ASPagerNode). Implement collectionNode:constrainedSizeForItemAtIndexPath:.
4b. Custom collection layouts. Set .view.layoutInspector and have it implement collectionView:constrainedSizeForNodeAtIndexPath:.
For an example of using this method with all steps above (including a custom layout, 4b.), see the app in examples/CustomCollectionView and enable kShowUICollectionViewCells = YES (example project included in this PR).