chameleon icon indicating copy to clipboard operation
chameleon copied to clipboard

Gradient in tableview cell starts at wrong point

Open jevonjcharles opened this issue 7 years ago • 4 comments

While using the left to right gradient option the color over laps onto the cell on the left side. I'm not using the accessory for the cell and have even tried changing that color but it still doesn't fix the problem. simulator screen shot aug 29 2017 3 10 34 pm

jevonjcharles avatar Aug 29 '17 22:08 jevonjcharles

@Jevon718 i have same issue you find any solution for it ?? if yes then please suggest it

Jay-iTechPioneer avatar Mar 21 '18 09:03 Jay-iTechPioneer

Hello,

Any Solution for this?

av089 avatar Aug 07 '18 04:08 av089

class TableViewCell: UITableViewCell {

@IBOutlet weak var lblplayerName:UILabel!
@IBOutlet weak var lblhowOut:UILabel!
@IBOutlet weak var lblruns:UILabel!
@IBOutlet weak var lblballs:UILabel!
@IBOutlet weak var lbl4s:UILabel!
@IBOutlet weak var lbl6s:UILabel!
@IBOutlet weak var lblSR:UILabel!
@IBOutlet weak var imgCellBg:UIImageView?



override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
    if let cellbg = self.imgCellBg
    {
        //set gradient color
        var frame = cellbg.frame
        frame.size.width = UIScreen.main.bounds.size.width
        let gradientColor = GradientColor(.leftToRight, frame: frame, colors: SportColor.gradientColor())
        cellbg.backgroundColor = gradientColor
        
    }
}

}

Jay-iTechPioneer avatar Aug 08 '18 02:08 Jay-iTechPioneer

Hello @av089 ,

Can u try inside "layoutSubviews" method?

koust avatar Mar 23 '19 16:03 koust