大佬教程收集整理的这篇文章主要介绍了ios – 如何控制阴影传播和模糊?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:
以下是我在Sketch中的设置:@H_696_5@
这就是我希望我的阴影看起来像:
这里现在是什么样子的:@H_696_5@@H_696_5@注意,你必须点击图片实际看到阴影.
我的@L_874_6@如下:
func setupLayer(){ view.layer.cornerRadius = 2 view.layer.shadowColor = Colors.Shadow.CGColor view.layer.shadowOffset = CGSize(width: 0,height: 1) view.layer.shadowOpacity = 0.9 view.layer.shadowRadius = 5 }
let radius: CGFloat = demoView.frame.width / 2.0 //change it to .height if you need spread for height let shadowPath = UIBezierPath(rect: CGRect(x: 0,y: 0,width: 2.1 * radius,height: demoView.frame.height)) //Change 2.1 to amount of spread you need and for height replace the code for height demoView.layer.cornerRadius = 2 demoView.layer.shadowColor = UIColor.blackColor().CGColor demoView.layer.shadowOffset = CGSize(width: 0.5,height: 0.4) //Here you control x and y demoView.layer.shadowOpacity = 0.5 demoView.layer.shadowRadius = 5.0 //Here your control your blur demoView.layer.masksToBounds = false demoView.layer.shadowPath = shadowPath.CGPath
let radius: CGFloat = demoView.frame.width / 2.0 //change it to .height if you need spread for height let shadowPath = UIBezierPath(rect: CGRect(x: 0,height: demoView.frame.height)) //Change 2.1 to amount of spread you need and for height replace the code for height demoView.layer.cornerRadius = 2 demoView.layer.shadowColor = UIColor.black.cgColor demoView.layer.shadowOffset = CGSize(width: 0.5,height: 0.4) //Here you control x and y demoView.layer.shadowOpacity = 0.5 demoView.layer.shadowRadius = 5.0 //Here your control your blur demoView.layer.masksToBounds = false demoView.layer.shadowPath = shadowPath.cgPath
demoView.layer.cornerRadius = 2 demoView.layer.shadowColor = UIColor.blackColor().CGColor demoView.layer.shadowOffset = CGSizeMake(0.5,4.0); //Here your control your spread demoView.layer.shadowOpacity = 0.5 demoView.layer.shadowRadius = 5.0 //Here your control your blur
以上是大佬教程为你收集整理的ios – 如何控制阴影传播和模糊?全部内容,希望文章能够帮你解决ios – 如何控制阴影传播和模糊?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。