iPhone – 将阴影应用于UITextView.layer?

iPhone – 将阴影应用于UITextView.layer?,第1张

概述我想在UITextView上应用阴影,看起来像UITextField.Any Idea? 我在用 textView.layer.shadowOpacity=0.8;textView.layer.shadowColor=[[UIColor lightGrayColor] CGColor];textView.layer.shadowOffset=CGSizeMake(0, 0);textView 我想在UITextVIEw上应用阴影,看起来像UITextFIEld.Any IDea?
我在用

textVIEw.layer.shadowOpacity=0.8;textVIEw.layer.shadowcolor=[[UIcolor lightGraycolor] CGcolor];textVIEw.layer.shadowOffset=CGSizeMake(0,0);textVIEw.layer.shadowRadius=3;textVIEw.layer.cornerRadius=3;

但如果UITextVIEw背景是透明的,它会给UITextVIEw的文本带来阴影.
所以有任何想法如何给像这样的UITextVIEw层提供阴影 – >

解决方法
// Add shadow    [textVIEw.layer setBackgroundcolor: [[UIcolor whitecolor] CGcolor]];    [textVIEw.layer setbordercolor: [[UIcolor graycolor] CGcolor]];    [textVIEw.layer setborderWIDth: 1.0];    [textVIEw.layer setCornerRadius:12.0f];    [textVIEw.layer setMasksToBounds:NO];    textVIEw.layer.shouldRasterize = YES;    [textVIEw.layer setShadowRadius:2.0f];    textVIEw.layer.shadowcolor = [[UIcolor blackcolor] CGcolor];    textVIEw.layer.shadowOffset = CGSizeMake(1.0f,1.0f);    textVIEw.layer.shadowOpacity = 1.0f;    textVIEw.layer.shadowRadius = 1.0f;
总结

以上是内存溢出为你收集整理的iPhone – 将阴影应用于UITextView.layer?全部内容,希望文章能够帮你解决iPhone – 将阴影应用于UITextView.layer?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1083270.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存