链接TTTAttributedLabel的点击颜色 [英] Link tap color for TTTAttributedLabel

查看:240
本文介绍了链接TTTAttributedLabel的点击颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用TTTAttributedLabel。我已经设法通过修改链接属性来更改我创建的任何链接的默认颜色和下划线。

I am using a TTTAttributedLabel in my project. I have managed to change the default color and underlining for any link that I create by modifying the link attributes.

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;

然而,我注意到当我点击链接时,它会随着任何其他链接暂时变为红色点击时会这样做。我需要改变这种颜色。如何做到这一点的任何线索?

However, I have noticed that when I tap on the link, it turns red momentarily as any other link does when tapped. I need to change this color. Any clues to how that might be done?

推荐答案

你想看看 TTTAttributedLabel文档,特别是在activeLinkAttributes

You will like to look at TTTAttributedLabel documentation, specifically at activeLinkAttributes


activeLinkAttributes

activeLinkAttributes

@property(nonatomic,strong)NSDictionary * activeLinkAttributes
讨论

@property (nonatomic, strong) NSDictionary *activeLinkAttributes Discussion

包含NSAttributedString属性的字典,当它们处于活动状态时应用于
链接。如果为nil或空
NSDictionary,则不会设置活动链接的样式。默认的活动链接
样式为红色并带下划线。

A 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.

声明在

TTTAttributedLabel.h

TTTAttributedLabel.h

这篇关于链接TTTAttributedLabel的点击颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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