Search code examples
objective-ciostransparencyaqgridview

AQGridViewCell transparent background


I have a problem customizing my AQGridViewCell. I'd like to have the whole cell having a transparent background, but the following inside of the initWithFrame:reuseIdentifier does not do the job:

self.backgroundView.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];

self.backgroundView.opaque = NO;
self.contentView.opaque = NO;
self.opaque = NO;

Does anyone have an idea how to solve this?

Thank you very much for any response!

EDIT I found this, but this does not seem to work either: https://github.com/AlanQuatermain/AQGridView/pull/108#issuecomment-3610006


Solution

  • The tip in your link was half way there. The following did the trick for me:

    self.contentView.backgroundColor = nil;
    self.backgroundColor = nil;
    

    And you need to put this in your custom AQGridViewCell's initWithFrame:reuseIdentifier:. It's a bit puzzling that you have to set two properties but at least it works.

    Also note that you also need to set the background color to clear for all text labels you might have, e.g:

    captionLabel.backgroundColor = [UIColor clearColor];
    

    Setting label background to nil doesn't help - it comes out as black.