在uiview的右下角放一个阴影 [英] Drop a shadow to right and bottom of uiview
本文介绍了在uiview的右下角放一个阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在uiview的右边和底部放一个阴影。我在界面构建器中执行此操作。但是我看到阴影掉到了顶部。已经有不同的尺寸。但是无法得到它。
I have to drop a shadow to the right and bottom of uiview.Im doing this in interface builder.But I see the shadow dropped to top of it.Tried differnt sizes.but couldn't get it.
layer.masksToBound=No
layer.shadowOpacity=0.15
layer.shadowRadius=2
layer.shadowOffSet={10,-10} //Values being set in Interfacebuilder.
仍然会在顶部留下阴影。我应该怎么做才能到达视野底部。
Still this drops shadow at top.What should I do to get at bottom of view.
推荐答案
尝试以下代码,它可能对您有所帮助
Try the following code, it might help you
myView.layer.shadowColor = [UIColor purpleColor].CGColor;
myView.layer.shadowOffset = CGSizeMake(5, 5);
myView.layer.shadowOpacity = 1;
myView.layer.shadowRadius = 1.0;
myView.layer.maskToBounds = NO;
我测试了这段代码,它的工作和输出是:
I tested this code and it's working and output is:
这篇关于在uiview的右下角放一个阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文