Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableViewCell custom selectedBackgroundView issue
    text
    copied!<p>So I'm facing an issue with setting a custum selectedBackgroundView inside my <code>UITableViewCell</code>.</p> <p>My cell has a <code>contentView</code> that basically is a <code>UIView</code> (frame = 0,0,80,70) with a black background and an <code>UIImageView</code> as a subview. </p> <p>The imageView's <code>contentMode = UIViewContentModeScaleAspectFit;</code></p> <p>This looks something like this:</p> <p><img src="https://i.stack.imgur.com/Agi6P.png" alt="unselected cells"></p> <p>Now I set the selectedBackgroundView like this:</p> <pre><code> //set the custom selected color UIView *bgColorView = [[UIView alloc] init]; bgColorView.backgroundColor = MY_TINT_COLOR; CGColorRef darkColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha: 0.25].CGColor; CGColorRef lightColor = [self.view.backgroundColor colorWithAlphaComponent:0.0].CGColor; //setting some gradients here //should not be relevant for the question [cell setSelectedBackgroundView:bgColorView]; </code></pre> <p>This results in something like this:</p> <p><img src="https://i.stack.imgur.com/AR2aq.png" alt="enter image description here"></p> <p>My question now is why the <code>selectedBackgroundView</code> hides the black part of the <code>contentView</code>?</p> <p>I have already tried initializing my <code>bgColorView</code> with a frame starting at <code>x = 80</code>, but this does not change anything. </p> <p>Also I have tried to explictly set the <code>backgroundColor</code> of the <code>imageView</code> to black, same result.</p> <p>What could cause this behaviour?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload