zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    用IntelliJ IDEA 开发Spring+SpringMVC+Mybatis框架 分步搭建一:建立MAVEN Web项目
    jvm学习笔记二(减少GC开销的建议)
    jvm学习笔记一(垃圾回收算法)
    【转】 StringUtils中 isNotEmpty 和isNotBlank的区别
    单例模式
    工厂模式
    个人项目作业
    第一次作业-热身!
    第四单元总结
    第三单元总结
  • 原文地址:https://www.cnblogs.com/unintersky/p/5018442.html
Copyright © 2011-2022 走看看