Discussion Forums  >  Uncategorized

Replies: 19    Views: 1695

DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
02/06/11 11:47 AM (15 years ago)

Blue underline link in custom text

I am making an app that uses the custom text function quite a bit. When I download the source code and run it in the simulator, some of the text is underlined (as if it's a link). An example is Mesa, AZ 85210. If that is in custom text, the whole phrase will be underlined and blue when it is run in the simulator. How do I get around this?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/06/11 12:56 PM (15 years ago)
Hm... it sounds like iOS thinks the text is an address and is adding the link to open the Maps app. Maybe try to change the text so it's not 'looking' like a mailing address.
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
02/06/11 07:30 PM (15 years ago)
I get the same thing when I type in [Tue - Sat: 10:00 AM - 9:00 PM] it interprets [Tue - Sat] and [10:00 AM - 9:00 PM] as time events. (I'm trying to figure out how to post store hours in the custom text without having it underlined)
 
elaine
buzztouch Evangelist
Profile
Posts: 385
Reg: Dec 26, 2010
Ireland
3,850
like
02/07/11 03:38 PM (15 years ago)
same for me, for 2-4pm.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/07/11 04:50 PM (15 years ago)
@DanielH and @Elaine What versions are the apps this is happening in: 1.4 or 1.5. I can post a simple fix for you but need to know what version so I can direct you to the right line of source-code to adjust. Again, super easy, it's a matter of doing this in the right file: webView.dataDetectorTypes = UIDataDetectorTypeNone
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
02/07/11 04:56 PM (15 years ago)
I've been doing it with 1.4. Thanks for the help!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/07/11 05:01 PM (15 years ago)
v1.4 a) Screen_CustomHTML > CustomHtmlViewController line 47. Look for webView.dataDetectorTypes = UIDataDetectorTypeAll and change to UIDataDetectorTypeNon b) Screen_CustomText > CustomTextViewController line 47. Same thing c) Screen_CustomURL > CustomUrlViewController line 42. Same thing. You can set these to any of these values: UIDataDetectorTypeAll UIDataDetectorTypeNone UIDataDetectorTypePhoneNumber UIDataDetectorTypeLink
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
02/07/11 05:53 PM (15 years ago)
That worked great! Thanks.
 
MattChgo
I hate code!
Profile
Posts: 15
Reg: Jan 20, 2011
Chicago
150
like
02/12/11 11:24 AM (15 years ago)
Hey David, How about for 1.5? :)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/12/11 02:32 PM (15 years ago)
To disable all auto-linking of Phone, Address, and other info (done by mobile Safari) in v1.5, make the same adjustment... webView.dataDetectorTypes = UIDataDetectorTypeNone In BT_screen_webView.m AND / OR depending on your needs BT_screen_customHTML.m However, there is a better way. If you have control over the HTML you are using, or the URL you are pointing to, you can easily add a meta-tag in the head section of the document to control what types of things safari should turn into links. The meta tag would look something like this... You can find more info in this discussion: http://stackoverflow.com/questions/226131/how-to-disable-phone-number-linking-in-mobile-safari
 
R2-D2
Apple Fan
Profile
Posts: 95
Reg: Jan 20, 2011
East Coast USA
950
like
02/27/11 10:35 AM (14 years ago)
That discussion cleared it up on linking telephone numbers, but it doesn't seem that there is a meta tag that will do the same for locations or events (times, dates). Any ideas on this? I'd rather not have to dig into the source code, but just on a per-page basis in the custom html.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/27/11 08:45 PM (14 years ago)
There doesn't appear to be a way to do one type without the other. To disable address, you'll have to disable all with: UIDataDetectorTypeNone
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
03/03/11 08:00 PM (14 years ago)
this was super helpful...thanks again!
 
elaine
buzztouch Evangelist
Profile
Posts: 385
Reg: Dec 26, 2010
Ireland
3,850
like
05/22/11 07:57 AM (14 years ago)
I have to do the same: Found these lines in the webview.m file: //data detector types... if([[BT_strings getStyleValueForScreen:self.screenData:@dataDetectorType:@1] isEqualToString:@0]){ self.webView.dataDetectorTypes = UIDataDetectorTypeNone; }else{ self.webView.dataDetectorTypes = UIDataDetectorTypeAll; Exactly what bits do I change? Thanks!
 
elaine
buzztouch Evangelist
Profile
Posts: 385
Reg: Dec 26, 2010
Ireland
3,850
like
05/22/11 07:58 AM (14 years ago)
More or less the same issue in the customhtml.m file: //data detector types... if([[BT_strings getStyleValueForScreen:self.screenData:@dataDetectorType:@1] isEqualToString:@0]){ self.webView.dataDetectorTypes = UIDataDetectorTypeNone; }else{ self.webView.dataDetectorTypes = UIDataDetectorTypeAll; THANKS!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/22/11 09:32 AM (14 years ago)
Yup, same logic in both files. The control panel should allow you turn off the auto-detector (ios putting a blue underline on what it thinks needs it). If you want to bypass the conrol panel, just remove that conditional check you pasted above and use: self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
 
elaine
buzztouch Evangelist
Profile
Posts: 385
Reg: Dec 26, 2010
Ireland
3,850
like
05/22/11 12:40 PM (14 years ago)
David - incredible!!! I turned the setting off in the ctrl panel and low & behold not a blue letter in sight. THANK YOU!!!!!!!!!!!!!!
 
wendymadeit
Apple Fan
Profile
Posts: 82
Reg: Jan 12, 2011
location unknow...
820
like
09/03/11 09:35 PM (14 years ago)
Just the solution I was looking for!! Thanks for this thread! Now, if only there were a way to preserve the font colour & style (no underline), while also preserving the 'make an event' or other detection functionality!! :)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
09/05/11 10:07 PM (14 years ago)
@wendymadeit: Maybe a little CSS to get the links to 'look' the way you want? Not sure what you're using to write the HTML. The control panel editor is bogus (darned thing drives my crazy) and a simple HTML editor and a copy-paste is usually better? Anyway...generic link with no CSS: <a href='mysite.com/page.html'>click here to see my page</a> Link with CSS to make it 'blue' and 'underlined': <a href='mysite.com/page.html' style='color:blue;text-decoration:underline;'>click here to see my page</a> For colors you could use a hexidecimal color code instead of the generic 'blue' work. Tons of HEX codes here for any color you can imagine: http://www.december.com/html/spec/color.html
 
wendymadeit
Apple Fan
Profile
Posts: 82
Reg: Jan 12, 2011
location unknow...
820
like
09/05/11 10:22 PM (14 years ago)
hmmmm.... good info!!! I was doing a bit of both - control panel & editor... will take ur advice! Tanx a million!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.