Not work in UITableViewCell
I have tried initialize StarReview view in override func awakeFromNib() , required init?(coder aDecoder: NSCoder) but it`s all not work for me. just empty star state initially and when it reload, then finally it appear properly
Hello uxight I know this issue. when you initialize StarReview, may be you do not call override init(frame: CGRect) this func. So it appears empty star. please call init(frame: CGRect) func to initialize StarReview or add some code below the func required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } please add init(){ super.init(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) //change the size you want self.backgroundColor = UIColor.clearColor() self.userInteractionEnabled = true starRadius = Float(self.frame.size.height) - Float(layer.borderWidth * 2) if ratio < startReviewWidthScale{ starRadius = Float(self.frame.width) / startReviewWidthScale - Float(layer.borderWidth * 2) } } please try this
Ok thanks!! Have a good day~