View settag example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < 5; i++) { | |
UICollectionView *currentCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, maxWidth, collectionViewHeight) collectionViewLayout:layout]; | |
// Trick to let the delegate and data source functions deal with the multiple UICollectionView's | |
[currentCollectionView setTag:i]; | |
} |
View gist:6835190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section | |
{ | |
NSInteger collectionID = collectionView.tag; | |
// do something about the id...... | |
} | |
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: | |
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
NSInteger collectionID = collectionView.tag; |
View gist:6835037
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < 5; i++) { | |
UICollectionView *currentCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, maxWidth, collectionViewHeight) collectionViewLayout:layout]; | |
// Trick to let the delegate and data source functions deal with the multiple UICollectionView's | |
[currentCollectionView setTag:i]; | |
} |
NewerOlder