如何将文本阴影应用于UITextView? [英] How to apply text shadow to UITextView?

查看:87
本文介绍了如何将文本阴影应用于UITextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我喜欢 UILabel 。他们很甜蜜。现在我不得不去 UITextView ,因为 UILabel 没有将文本垂直对齐到顶部。该死的。我真正需要的是文字阴影。 UILabel 有它。 UITextView 似乎没有它。但我猜那家伙只是使用相同的底层 UIKit NSString 添加?也许有人已经有解决这个问题的方法?我会覆盖什么?

Actually I love UILabel. They're sweet. Now I had to go to UITextView because UILabel is not aligning text vertically to the top. Damn. One thing I really need is a text shadow. UILabel has it. UITextView seems to not have it. But I guess that guy just uses the same underlying UIKit NSString additions?? Maybe someone already has a solution for that problem? What would I overwrite?

推荐答案

text.layer.shadowColor = [[UIColor whiteColor] CGColor];
text.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
text.layer.shadowOpacity = 1.0f;
text.layer.shadowRadius = 1.0f;

并且不要忘记加上顶部:

And don't forget to add up top:

#import <QuartzCore/QuartzCore.h>

这篇关于如何将文本阴影应用于UITextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆