2121#import " SupplementaryNode.h"
2222#import " ItemNode.h"
2323
24- @interface ViewController ()
24+ @interface ViewController () <ASCollectionDataSource, ASCollectionViewDelegateFlowLayout>
25+
2526@property (nonatomic , strong ) ASCollectionView *collectionView;
2627@property (nonatomic , strong ) NSArray *data;
27- @end
28-
29- @interface ViewController () <ASCollectionDataSource, ASCollectionViewDelegateFlowLayout>
3028
3129@end
3230
33-
3431@implementation ViewController
3532
33+ #pragma mark - Lifecycle
34+
3635- (void )dealloc
3736{
3837 self.collectionView .asyncDataSource = nil ;
@@ -52,20 +51,24 @@ - (void)viewDidLoad
5251 // This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
5352 // This functionality & example project remains for users who insist on using ASCollectionView.
5453 self.collectionView = [[ASCollectionView alloc ] initWithFrame: self .view.bounds collectionViewLayout: layout];
55- self.collectionView .autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
5654 self.collectionView .asyncDataSource = self;
5755 self.collectionView .asyncDelegate = self;
56+
57+ self.collectionView .autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
5858 self.collectionView .backgroundColor = [UIColor whiteColor ];
5959
6060 // This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
6161 // This functionality & example project remains for users who insist on using ASCollectionView.
6262 [self .collectionView registerSupplementaryNodeOfKind: UICollectionElementKindSectionHeader];
6363 [self .collectionView registerSupplementaryNodeOfKind: UICollectionElementKindSectionFooter];
64+
6465 [self .view addSubview: self .collectionView];
6566
6667#if !SIMULATE_WEB_RESPONSE
6768 self.navigationItem .leftItemsSupplementBackButton = YES ;
68- self.navigationItem .leftBarButtonItem = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemRefresh target: self action: @selector (reloadTapped )];
69+ self.navigationItem .leftBarButtonItem = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemRefresh
70+ target: self
71+ action: @selector (reloadTapped )];
6972#endif
7073
7174#if SIMULATE_WEB_RESPONSE
@@ -94,15 +97,16 @@ - (void)viewDidLoad
9497#endif
9598}
9699
100+ #pragma mark - Button Actions
101+
97102- (void )reloadTapped
98103{
99104 // This method is deprecated because we reccommend using ASCollectionNode instead of ASCollectionView.
100105 // This functionality & example project remains for users who insist on using ASCollectionView.
101106 [self .collectionView reloadData ];
102107}
103108
104- #pragma mark -
105- #pragma mark ASCollectionView data source.
109+ #pragma mark - ASCollectionView Data Source
106110
107111- (ASCellNodeBlock)collectionView : (ASCollectionView *)collectionView nodeBlockForItemAtIndexPath : (NSIndexPath *)indexPath ;
108112{
0 commit comments