博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS 学习笔记27-CALayer
阅读量:6895 次
发布时间:2019-06-27

本文共 799 字,大约阅读时间需要 2 分钟。

首先 添加图片到项目

 UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1"]];

    imageView.center = self.view.center;

    [self.view addSubview:imageView];

 

 

 //设置阴影

    imageView.layer.shadowColor = [[UIColor yellowColor]CGColor];

    //阴影偏移

    imageView.layer.shadowOffset= CGSizeMake(10, 10);

    //阴影透明度

    imageView.layer.shadowOpacity = 0.5;

    //阴影圆角大小

    imageView.layer.cornerRadius = 8;

    imageView.layer.masksToBounds = YES;//必须设置这个属性才能圆角

    

    //设置边框

    imageView.layer.borderWidth = 8;

    imageView.layer.borderColor = [[UIColor redColor]CGColor];

    //设置旋转

//    imageView.layer.transform = CATransform3DMakeRotation(M_PI_4, 1, 1, 0);

    imageView.layer.transform = CATransform3DMakeScale(0.5, 1, 1);

 

 

 

 

这里要注意:如果要设置图层圆角,必须要设置

    imageView.layer.masksToBounds = YES;//必须设置这个属性才能圆角

 

转载于:https://www.cnblogs.com/adodo/p/5222332.html

你可能感兴趣的文章
No module named 'MySQLdb' python3.6 + django 1.10 + mysql 无法连接
查看>>
使用nginx搭建https服务器 (转)
查看>>
Linux磁盘分区管理--ext2和ext3文件系统逻辑结构分析
查看>>
玩转智能路由器-WRTnode添加显示支持
查看>>
Centos 6.5 下搭建Mysql 5.6双主模式
查看>>
It is indirectly referenced from required .class files
查看>>
Guava学习笔记:EventBus
查看>>
为何要用ERP
查看>>
Nginx之配置HTTPS站点
查看>>
STL——set
查看>>
TCP/IP中MSL详解
查看>>
JavaWeb学习总结(四十九)——简单模拟Sping MVC
查看>>
tar命令的使用
查看>>
linux环境变量,cp,mv命令,more,less,cat,tail,head,的使用
查看>>
ubuntu16.04下docker修改配置文件不生效解决办法
查看>>
msyql 的半同步复制
查看>>
C语言查漏补缺——const
查看>>
Druid MiddleManager Config 设置(默认只允许2个任务)
查看>>
Linux深入篇之九:构建企业级Nginx+Keepalived集群架构
查看>>
我的友情链接
查看>>