开发者

Glow effect in UITextView

开发者 https://www.devze.com 2023-01-06 17:43 出处:网络
Can glow effects be a开发者_StackOverflow中文版pplied on text inside UITextView?If so, how?Here is some code to add a red glow to a UITextView. Requires iOS 6+. Adjust parameters to taste:

Can glow effects be a开发者_StackOverflow中文版pplied on text inside UITextView? If so, how?


Here is some code to add a red glow to a UITextView. Requires 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消