iOS 添加阴影后 屏幕卡顿 抖动

- (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 拖动时有抖动现象。

增加此句就OK了。

_labAuthorSubTitle.layer.shadowPath =[UIBezierPath bezierPathWithRect:_labAuthorSubTitle.bounds].CGPath;
posted on 2015-12-04 09:59  toward fai  阅读(694)  评论(0编辑  收藏  举报