我正在使用UITextView并且我想更改我在此组件中使用的超链接的颜色。例如,如果UITextView显示www.gmail.com,则显示为蓝色。我想改变那个颜色。
26097 次
2 回答
137
嘘!Apple 已经发布了适用于 iOS7 的解决方案!如本答案中所述,您可以使用linkTextAttributesa 的属性UITextView。带下划线的白色链接看起来像这样:
yourTextView.linkTextAttributes = @{
NSForegroundColorAttributeName: [UIColor whiteColor],
NSUnderlineStyleAttributeName: [NSNumber numberWithInt:NSUnderlineStyleSingle]
};
或者您可以更改tintColor, 因为UITextView继承UIView并使用该tintColor属性为链接着色 - 请参阅:
yourTextView.tintColor = [UIColor whiteColor];
现在您的链接看起来很壮观!
于 2014-01-09T17:40:08.077 回答
-8
于 2012-11-15T20:25:51.850 回答