Multiple TTStyle definitions for a TTStyledLinkNode - Issue + workaround

9 views
Skip to first unread message

Justin Searls

unread,
May 27, 2009, 10:24:00 PM5/27/09
to Three20
Interesting problem I'm having. Default link nodes look like standard
links and work great on white backgrounds. Unfortunately, part of one
of my screens has a dark background, and I need a lighter link text
for that specific zone (which of course be interspersed with normal
white backgrounds requiring normal links).

The naïve solution is to have multiple TTStyles, a new one in addition
to TTDefaultStyleSheet's linkText:

The issue is that adding a class attr to an < a > tag doesn't get
picked up in the layout.

My workaround for now is to use my TTStyledTextTouchDelegate that I've
added to TTStyledText in my fork: http://github.com/searls/three20/tree/master

For alternate links I'm not using < a > at all, and am instead just
using < span > element. It'll trigger an event for me
(styledNodeWasTouched:(TTStyledNode*)node) that I can use to treat the
same way I treat a link touch event (in this case, also a custom
delegate method).

Figured I'd point out this workaround to anyone interested. If
somebody knows a correct way to do this as Three20 currently is, feel
free to enlighten me! I'd love to clean this up.

Justin Searls

unread,
May 27, 2009, 11:13:06 PM5/27/09
to Three20
Ignore all that mess. Adding two lines to the TTStyledTextParser was
all it took to resolve this issue for me. Hopefully Joe pulls :)

The commit:
http://github.com/searls/three20/commit/bad53eadf11a8fac93f3f9a3f6c360256bcf870c
Reply all
Reply to author
Forward
0 new messages