iphonethree20ttstyledtextlabel

How can I make Three20's TTStyledTextLabel work with external images?


I found an old post in the three20 Google Group about external image support not being implemented yet, but that's a few months old and it looks like TTStyledText is trying to support external images in the newer releases.

I'm pulling out my hair trying to figure out why it isn't working for me. To reproduce, you can change the sample text in the TTCatalog/ StyledTextTestController.m to point to an external image rather than a bundle image. Stepping through, I can see that the image is actually downloaded over the network and once loaded, TTStyledText calls styledTextNeedsDisplay on its delegate (TTStyledTextLabel), but the display is never updated to show the new image.

If I close the app and restart it, the image is loaded properly from the cache, but it never works when it has to download it inline. Has anyone found a solution to this problem?


Solution

  • Ugh. Figured it out. You have to specify a height and width in your img tag or when it loads it has a has a rect of CGRectZero and doesn't show.