开发者

How can I have clickable links in UILabel while drawing text with a shadow?

开发者 https://www.devze.com 2022-12-23 08:04 出处:网络
I need to do data de开发者_开发问答tection of website URL\'s in live chat and display them in a UILabel NOT UITextView. They need to be clickable and will open a in-app browser. We have tried Craig Ho

I need to do data de开发者_开发问答tection of website URL's in live chat and display them in a UILabel NOT UITextView. They need to be clickable and will open a in-app browser. We have tried Craig Hockenberry's code, three20, and making our own, all of which didn't work. We need to use UILabel to take advantage of shadows. Anyone know what to do? Help!


Craig's implementation breaks a label down into a series of clickable buttons for the hyperlinks in the text. You'll need to replace the label on the UIButtons (through subclassing or otherwise) to enable the shadowing of the text.

If you need a UILabel subclass capable of arbitrary shadowing / glowing, I provide one in the sample code for the Quartz section of my iPhone class.


UILabel can only display plain text.

If you roll your own, you can use CGContextSetShadow or CGContextSetShadowWithColor to add the shadows.

(Also check the TTShadowStyle class.)

0

精彩评论

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