Skip to content

Instantly share code, notes, and snippets.

@bnookala
Created February 7, 2016 20:06
Show Gist options
  • Save bnookala/f0531b75fcc2280ceb8d to your computer and use it in GitHub Desktop.
Save bnookala/f0531b75fcc2280ceb8d to your computer and use it in GitHub Desktop.
@interface MyAmazingViewController () <> {
BOOL isInGrid;
}
@implementation MyAmazingViewController
- (void)myCommonFunction:(NSIndexPath *)cellPath {
if (isInGrid) {
UICollectionViewCell *myCell = [self collectionView:self.grid cellForItemAtIndexPath:cellPath];
myCell.someProperty = YES;
} else {
UITableViewCell *myCell = [self tableView:self.table cellForRowAtIndexPath:cellPath];
myCell.someProperty = YES;
}
};
#pragma mark UICollectionViewDataSource
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)path {
[self myCommonFunction:path];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment