0
我有一個ProfileCollectionViewCell
一個方法:的UIButton與CAShapeLayer使標題消失時滾動
func configureCellWithProfile(profile: Profile) {
shapeLayer.removeFromSuperlayer()
let path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, 0, 0)
CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), 0)
CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), CGRectGetHeight(likeButton.frame))
CGPathCloseSubpath(path)
shapeLayer.fillColor = profile.favourite ? UIColor.brilliantRose().CGColor : UIColor.blackSqueeze().CGColor
shapeLayer.path = path
likeButton.layer.masksToBounds = true
likeButton.layer.addSublayer(shapeLayer)
}
而就在加載後,它看起來是這樣的:
但之後,我滾動我的頭銜(來自icomoon字體的心)消失:
爲什麼?
打印'likeButton.frame',看看發生在滾動,或有什麼問題你重用 –
我解決問題......圖層覆蓋了我的'titleLabel'。:) –