- (void)awakeFromNib { // Initialization code _btnViews.layer.shadowPath =[UIBezierPath bezierPathWithRect:_btnViews.bounds].CGPath; _btnViews.layer.shadowColor = [UIColor grayColor].CGColor;//shadowColor陰影顏色 _btnViews.layer.shadowOffset = CGSizeMake(0,3);//shadowOffset陰影偏移,x向右偏移4,y向下偏移4,默認(0, -3),這個跟shadowRadius配合使用 _btnViews.layer.shadowOpacity = 0.5;//陰影透明度,默認0 _btnViews.layer.shadowRadius = 2;//陰影半徑,默認3 _labAuthorTitle.layer.shadowPath =[UIBezierPath bezierPathWithRect:_labAuthorTitle.bounds].CGPath; _labAuthorTitle.layer.shadowColor = [UIColor grayColor].CGColor;//shadowColor陰影顏色 _labAuthorTitle.layer.shadowOffset = CGSizeMake(2,2);//shadowOffset陰影偏移,x向右偏移4,y向下偏移4,默認(0, -3),這個跟shadowRadius配合使用 _labAuthorTitle.layer.shadowOpacity = 0.5;//陰影透明度,默認0 _labAuthorTitle.layer.shadowRadius = 2;//陰影半徑,默認3 _labAuthorSubTitle.layer.shadowPath =[UIBezierPath bezierPathWithRect:_labAuthorSubTitle.bounds].CGPath; _labAuthorSubTitle.layer.shadowColor = [UIColor grayColor].CGColor;//shadowColor陰影顏色 _labAuthorSubTitle.layer.shadowOffset = CGSizeMake(2,2);//shadowOffset陰影偏移,x向右偏移4,y向下偏移4,默認(0, -3),這個跟shadowRadius配合使用 _labAuthorSubTitle.layer.shadowOpacity = 0.5;//陰影透明度,默認0 _labAuthorSubTitle.layer.shadowRadius = 2;//陰影半徑,默認3 }
如上,給Cell添加完陰影后 ,屏幕出現卡頓現象,tableview 拖動時有抖動現象。spa
增長此句就OK了。code
_labAuthorSubTitle.layer.shadowPath =[UIBezierPath bezierPathWithRect:_labAuthorSubTitle.bounds].CGPath;