简体   繁体   中英

large scrollable “something” with TTStyledText in it

im searching for a solution of the following problem:

i got a "larger" XHTML string that i want to display in an area that is scrollable. I already used TTStyledTextLabel for a small text-caption and it works pretty well.

But now i want display it more like a UITextView that scrolls or a UIScrollView with my TTStyled Content in it. i think TTStyledTextLabel isnt the right thing to view such a large (with large i mean about 900px height) content.

i need a TTStyledTextView , or something like that. Does something exist? How to work with it. My Content has a variable length so i cannot setup a UIScrollView with a TTStyledTextLabel in it.

Any hints for me ?

Thanks!

You can determine the height needed to display the whole XHTML string by doing this:

htmlLabel.text = [TTStyledText textFromXHTML:htmlText];
[htmlLabel sizeToFit];
CGFloat height=htmlLabel.height;

I do this to create dynamic table cells that include these labels. You can use this height to set the contentSize of a parent scrollview.

You might however run into problems if your view is higher than 1024pixels on iPhone OS 2.x:

Note: Prior to iPhone OS 3.0, UIView instances may have a maximum height and width of 1024 x 1024. In iPhone OS 3.0 and later, views are no longer restricted to this maximum size but are still limited by the amount of memory they consume. Therefore, it is in your best interests to keep view sizes as small as possible. Regardless of which version of iPhone OS is running, you should consider using a CATiledLayer object if you need to create views larger than 1024 x 1024 in size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM