Skip to content

Instantly share code, notes, and snippets.

@hafizrahman
Created October 5, 2013 00:54
Show Gist options
  • Save hafizrahman/6835190 to your computer and use it in GitHub Desktop.
Save hafizrahman/6835190 to your computer and use it in GitHub Desktop.
How to use tag in datasource methods.
- (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;
// do something about the id...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment