UITableViewCell selectedBackgroundView's color not visible when building on iOS 13

后端 未结 3 421
旧巷少年郎
旧巷少年郎 2021-01-05 03:17

I have given a tableview cell a color on selection in cellForRowAtIndexPath using

    let backgroundView = UIView()
    backgroundView.backgroun         


        
3条回答
  •  隐瞒了意图╮
    2021-01-05 04:06

    If you use the hierarchy debugger, you'll see that in iOS 13 the contentView sits above the backgroundView and selectedBackgroundView.

    This can be resolved by setting

    contentView.backgroundColor = nil 
    

    in awakeFromNib

    or setting the contentView's backgroundColour to clear in the storyboard

提交回复
热议问题