Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xArtx

macrumors 6502a
Original poster
Mar 30, 2012
764
1
Hi Guys,
I have some links in a textview that work, but are ugly.

Is it possible to replace the links with Human readable text
as you do on a website, say by changing the text that appears from:

http://www.blablabla.com.au

to:

Click Me

?

Thanks :)
 
Not sure if this answers your question, but I've done that by writing a replacement TextView class that supports a NSAttributedString and renders it using CoreText. Then you can apply blue colour and underline to the sections you want. My class implements firstRectForNSRange: and closestPositionToPoint: for hit testing. Then you can do whatever your heart desires when the link is tapped.

There is native support for NSAttributedString in UITextView in iOS 6, but I needed to "roll my own" for iOS 5 compatibility.
 
I have my own textview, and just got everything down, except no
horiz or vert scrollers, and no web links at all. Also not editable.
Did it because I'm sure I'm going to want different fonts and colours
at some stage.

Might give the web view a go, haven't tried using one for text yet.
 
If it doesn't need to be editable, I would think a UIWebView would be a better approach.

It's worth a shot because I think it's controls would be similar,
and no, not editable, it's supposed to be a simple documentation/credits screen,
but I have to present this to the user... in code to preserve fixed width..

Code:
The algorithm for Moon rise and Moon
set calculation is based on a BASIC
program that appeared in
Sky & Telescope Magazine, July 1989,
Page 78. It's original author is
unknown, and cannot be credited.
The original BASIC language listing
"moonrise.bas" can be found here:
http://www.schoepski.com/states/illino
is/solunar/code/moonrise.htm
The BASIC source was ported to C in
Jan 2008. That is what is used in this
iOS implementation.

The links wrap like that, and I have to allow it, or they break.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.