I had a UITextView that detects phone numbers ans links, but this overrides my fontColor and change it to blueColor. Is there a way to format the color of auto detected links, or should I try a manual version of this function?
A:
Anyone have an answer to this? I can't imagine that you can change the overall font color but not the auto-detected link font color. I've got light colored text on a dark background and the blue link color does not have enough contrast.
Thanks!
Jeff
2010-01-08 20:09:01
Instead of using an UITextView, I used an UIWebView and enabled the "auto-detect links". To change the link color, just created a regular CSS for the <a> tag.
2010-03-08 19:40:23
+3
A:
Instead of using an UITextView, I used an UIWebView and enabled the "auto-detect links". To change the link color, just created a regular CSS for the tag.
I used something like this:
NSString * htmlString = [NSString stringWithFormat:@"<html><head><script> document.ontouchmove = function(event) { if (document.body.scrollHeight == document.body.clientHeight) event.preventDefault(); } </script><style type='text/css'>* { margin:0; padding:0; } p { color:black; font-family:Helvetica; font-size:14px; } a { color:#63B604; text-decoration:none; }</style></head><body><p>%@</p></body></html>", [update objectForKey:@"text"]];
webText.delegate = self;
[webText loadHTMLString:htmlString baseURL:nil];
+1
A:
you need to make a stylesheet for that. Define a class there with the color combination you need-
.headercopy {
font-family: "Helvetica";
font-size: 14px;
line-height: 18px;
font-weight:bold;
color: #25526e;
}
a.headercopy:link {
color:#ffffff;
text-decoration:none;
}
a.headercopy:hover {
color:#00759B;
text-decoration:none;
}
a.headercopy:visited {
color:#ffffff;
text-decoration:none;
}
a.headercopy:hover {
color:#00759B;
text-decoration:none;
}
now use the class 'headercopy' into you html page like this-
<b>Fax:</b><a href="tel:646.200.7535" class="headercopy"> 646-200-7535</a><br />
this will display the phone number in the color you need with click functionality.
Vaibhav Saran
2010-10-23 08:46:08