KKGridView
KKGridView copied to clipboard
Can't get transparent background on cells
Here is the code I have. I am using custom cells loaded from xibs and did everything possible to create transparent backgrounds. No luck.
AlbumsViewController
- (KKGridViewCell *)gridView:(KKGridView *)gridView cellForItemAtIndexPath:(KKIndexPath *)indexPath {
NSDictionary *album = [self.albums objectAtIndex:indexPath.section];
NSDictionary *photo = [[album arrayForKey:@"photos"] objectAtIndex:indexPath.index];
PhotoGridCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"PhotoGridCell" owner:self options:nil] objectAtIndex: 0];
cell.reuseIdentifier = @"PhotoCell";
[cell updateCellInfo:photo];
cell.contentView.backgroundColor = [UIColor clearColor];
cell.contentView.opaque = NO;
return cell;
}
PhotoGridCell
@implementation PhotoGridCell
- (void) updateCellInfo:(NSDictionary *) data {
[imageView setImageWithURL:[NSURL URLWithString:[data stringForKey:@"url"]]];
imageView.contentMode = UIViewContentModeScaleAspectFill;
[imageView setClipsToBounds:YES];
self.backgroundColor = [UIColor clearColor];
self.contentView.opaque = NO;
self.contentView.backgroundColor = [UIColor clearColor];
}
@end
Hmmm... I suspect this is an issue with the cell's backgroundView
. Try setting its color to [UIColor clearColor]
.
try this:
cell.contentView.backgroundColor = [UIColor clearColor];
cell.backgroundView.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor clearColor];
I guess they are stacked on each other so you have to set all of them transparent.