简体   繁体   English

UITextView中的发光效果

[英]Glow effect in UITextView

Can glow effects be applied on text inside UITextView? 可以在UITextView内的文本上应用发光效果吗? If so, how? 如果是这样,怎么办?

Here is some code to add a red glow to a UITextView. 这是一些向UITextView添加红色发光的代码。 Requires iOS 6+. 需要iOS 6+。 Adjust parameters to taste: 调整参数以品尝:

NSShadow *shadow         = [NSShadow new];
shadow.shadowBlurRadius  = 5;
shadow.shadowColor       = [UIColor redColor];
shadow.shadowOffset      = CGSizeMake(0, 0);

NSDictionary *attributes = @{NSShadowAttributeName:shadow};

textView.attributedText  = [[NSAttributedString alloc]
                                        initWithString:title
                                            attributes:attributes];

Not really. 并不是的。 You might be able to use a CSS-styled (using the text-shadow property) <textarea> in a UIWebView , though. 不过,您可以在UIWebView使用CSS样式的(使用text-shadow属性) <textarea>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM