zoukankan      html  css  js  c++  java
  • 设置UICollectionViewCell圆角和阴影

      设置cell圆角:

        cell.contentView.layer.cornerRadius =2.0f;

        cell.contentView.layer.borderWidth =1.0f;

        cell.contentView.layer.borderColor = [UIColor clearColor].CGColor;

        cell.contentView.layer.masksToBounds =YES;


    经测试,这方法无效,具体原因,后期补上。 
     
    关键代码: cell.layer.cornerRadius = 2.0f; 
     
    写上这句就可以完美展现圆角效果,不过考虑到性能优化和离屏渲染问题,建议让UI设计师直接给圆角背景图是优选 (#^.^#) 
     

      设置cell阴影:

      cell.layer.shadowColor = [UIColor lightGrayColor].CGColor;

        cell.layer.shadowOffset = CGSizeMake(0,2.0f);

        cell.layer.shadowRadius =2.0f;

        cell.layer.shadowOpacity =1.0f;

        cell.layer.masksToBounds =NO;

        cell.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:cell.bounds cornerRadius:cell.contentView.layer.cornerRadius].CGPath;


    (目前测试阴影还未测试,暂时写上此方法,有什么见解的童鞋欢迎留言指点江山)
     
     
     
  • 相关阅读:
    K8s网络插件flannel与calico
    calico部署与网卡绑定
    脚本基本函数
    k8s迁移工具-helm
    mysql不识别中文
    日志收集系统对比
    VM虚拟机安装后的网络设置
    微擎目录结构介绍
    amazeui笔记-web组件
    jQuery 数据
  • 原文地址:https://www.cnblogs.com/liuzhi20101016/p/11908071.html
Copyright © 2011-2022 走看看