mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[Umbrella] ASCollectionView -> ASCollectionNode Migration, Separate Index Spaces (#2372)
* Separate dataSource & UIKit index spaces Beef up our supplementary node support Make the API way better Go nuts Add a unit test for UICollectionView's handling of reloadData inside batch updates Wrap indexPathForNode: in a cache Convert index paths in delegate methods Go back on table view Put collection view back Switch up the API Move most ASCollectionView API to ASCollectionNode Move most table logic over to ASTableNode Do the things More conversion work Keep on keepin' on Get table view delegate API done More porting Simplify Clear the delegate More cleanup Move more stuff around Remove pointless file Re-add some API Put back more API Use the right flag * Some cleanup * Remove incorrect comment * Tweak the API * Put back a couple methods * update example projects (note: ASCollectionView deprecation warnings expected) * change reloadDataWithCompletion:nil --> reloadData * Clean up rebase * Make deprecated numberOfItemsInSection methods optional * Use the right flag * Address nits * update ASDKTube, ASDKgram & ASViewController examples
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
@property (nonatomic, strong) NSArray *data;
|
||||
@end
|
||||
|
||||
@interface ViewController () <ASCollectionViewDataSource, ASCollectionViewDelegateFlowLayout>
|
||||
@interface ViewController () <ASCollectionDataSource, ASCollectionViewDelegateFlowLayout>
|
||||
|
||||
@end
|
||||
|
||||
@@ -49,12 +49,16 @@
|
||||
layout.headerReferenceSize = CGSizeMake(50.0, 50.0);
|
||||
layout.footerReferenceSize = CGSizeMake(50.0, 50.0);
|
||||
|
||||
// This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
|
||||
// This functionality & example project remains for users who insist on using ASCollectionView.
|
||||
self.collectionView = [[ASCollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
|
||||
self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.collectionView.asyncDataSource = self;
|
||||
self.collectionView.asyncDelegate = self;
|
||||
self.collectionView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
// This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
|
||||
// This functionality & example project remains for users who insist on using ASCollectionView.
|
||||
[self.collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionHeader];
|
||||
[self.collectionView registerSupplementaryNodeOfKind:UICollectionElementKindSectionFooter];
|
||||
[self.view addSubview:self.collectionView];
|
||||
@@ -92,6 +96,8 @@
|
||||
|
||||
- (void)reloadTapped
|
||||
{
|
||||
// This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
|
||||
// This functionality & example project remains for users who insist on using ASCollectionView.
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user