我在我的项目中使用了TTTAttributedLabel.我设法通过修改链接属性来更改我创建的任何链接的默认颜色和下划线.
NSArray *pKeys = [[NSArray alloc] initWithObjects:(id)kCTForegroundColorAttributeName,(id)kCTUnderlinestyleAttributeName,nil]; NSArray *pObjects = [[NSArray alloc] initWithObjects:pAlertColor,[NSNumber numberWithInt: kCTUnderlinestyleNone],nil]; NSDictionary *pLinkAttributes = [[NSDictionary alloc] initWithObjects:pObjects forKeys:pKeys]; self.alertMessage.linkAttributes = pLinkAttributes; self.alertMessage.activeLinkAttributes = pLinkAttributes;
解决方法
你会喜欢看看
TTTAttributedLabel documentation,特别是在activeLinkAttributes
activeLinkAttributes
@property (nonatomic,strong) NSDictionary *activeLinkAttributes
discussionA dictionary containing the NSAttributedString attributes to be
applied to links when they are in the active state. If nil or an empty
NSDictionary,active links will not be styled. The default active link
style is red and underlined.Declared In
TTTAttributedLabel.h
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。