Question

After hours googling, I found no solution..

I want to add these attributes to a cell but this code does not work

AppCell *cell = [[AppCell alloc] init];

cell.layer.cornerRadius = 5.0;
cell.layer.shadowColor = [[UIColor blackColor] CGColor];
cell.layer.shadowOpacity = 1.0;
cell.layer.shadowRadius = 10.0;
cell.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);

What is the solution?? .. Thank you very much in advance

Was it helpful?

Solution

First,create a CustomCell which is a subclass of UICollectionViewCell.. Then, import that CustomCell.h file into your collectionView's controller.

If you want to set up those properties on some cells, using the delegate method - (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath

If you want to set up those properties for all cells, just put them inside CustomCell.m.Remember import QuartzCore framework.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top