UILabel cannot render too many words - ios

I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
Over 6000 Chinese,UILabel is blanked but it has content.In other word UILabel cannot render too manny words.
How can i solove it ?

I try to use core data to render large text only in one view, but it has no use. So I will use a few cells to show those word. And what I need to do is cut the large text in pieces. I think it is better for performance than using only one cell.

Related

Calculating the amount of text it will take to fill a given container

I am trying to develop a Greek Bible app and want to draw the attributed strings in pages using a UIView which will be swiped left or right like a book. The problem is I cannot for the life of me figure out how much text it will take to fill up each page before I draw it. I need to figure out where to start the text on the next or prev pages so no text is lost. Does anyone know how to do this? I have scoured the internet for clues but to no avail.

How to reduce the length of title in Blogger?

Aloha guys, I'm new here. I really want to reduce the length of the title (reduce the number of words) so that it blends in well with the theme. My website's default view is Grid View, and I want the titles to be changed to "..." when it overflows the limit and the text comes on image. I hope you get what I mean. The text is getting cut away... I seriously need help!
The website is
http://www.apps-mania.com/
If anyone is ready to help, please poke me up :)
Cheers,
Ayush
The CSS you are looking for is
text-overflow:ellipsis
http://quirksmode.org/css/user-interface/textoverflow.html

Render an arbitrarily large NSAttributedString

I need to render an (arbitrarily large) NSAttributedString, in this case ANSI-colored text from an (arbitrarily long) telnet session. The text need not be editable inline. I have explored a few options:
UITextView seems to have by far the best performance and, since I'm targeting iOS 6, it's very easy to use with attributed strings. However, the textview gets progressively slower to render as more text is added, as it hits an HTML DOM parser each time I call setAttributedString: and blocks the UI.
I've tried a few core text rendering frameworks, TTTAttributedLabel and OHAttributedLabel, that also get progressively slower with more text. To be fair, they're labels probably not intended for this sort of thing!
UIWebView (gag) has some issues with rotation and keeping the text properly sized and framed, but I think I could work around it. I can convert my attributed string to HTML and use JavaScript to append (inject) new text as it is received. Surprisingly good performance here.
A friend suggested I think of the user's current scroll position as a viewport into a larger document and (probably with core text) render only the visible part of my attributed string. I'm worried about how this might impact scrolling performance.
So I turn to you, brave interwebs. Ideas for an indie developer? Is a webview my best bet?
You could use a UITableView and split the NSAttributedString into an array of substrings that would each fit a cell's label width. The table view's data source would index into the array of substrings to determine which line of the original string should be placed in each cell.

Efficiently Computing Text Widths

I need to compute the width of a column with many rows (column AutoSize feature). Using Canvas.TextWidth is far too slow.
Current solution: My current solution uses a text measurer class that builds a lookup table for a fixed alphabet once and then computes the width of a given string very fast by adding up character widths retrieved from the lookup table. For characters not contained in the lookup table, the average character width is used (also computed once).
Problem: This works well for European languages but not for Asian languages.
Question: What's the best way to tackle this problem? How can such an AutoSize feature be realized without the relatively slow Canvas functions and without depending on a specific alphabet?
Thanks for any help.
You said you want to get the maximum text width for a column. Can't you, say, take only the 4 or 5 longest strings and get their widths? That way you won't have to find the width for all items and can save quite some time.
Or you use your cache to find the rough length of the strings and then refine that by getting the actual width for the top 4 or 5 items you found.
I don't think it matters a lot whether you use Canvas.TextWidth or GetTextExtentPoint32. Just use one of these to get the exact widths, after you used one of the methods above to guesstimate the longest/widest strings.
To those who think this doesn't work
If the poster of the original question thinks it could work, I have no reason to think it won't. He knows best what kind of strings can be in the columns he has.
But that is not my main argument. He already wrote that he does a preliminary textwidth by adding the predetermined individual widths of the characters. That does not take into account any kerning. Well, kerning can only make a string narrower, so it still makes sense to check only the top 4 or 5 items for the exact width. The biggest problem that can occur is that the column could be a few pixels too wide, no more. But it will be a lot faster than using TextWidth or GetTextExtentPoint32 or similar functions on each entry (assuming more than 5 entries), and that is what the original poster wanted. I suggest that those who don't believe me simply try it out.
As for using the pure string length: even that is probably good enough. Yes, 'WWW' is probably wider than '!!!!!', but the original poster will probably know best wat kind of string material he has, and if it is feasible. '!!!!!' or 'WWW' are not the usual entries one expects. Especially if you consider that not only one single string is checked, but the longest 4 or 5 strings (or whatever number turns out to be optimal). It is very unlikely that the widest string is not among them. But the original poster can tell if that is possible or feasible. He seems to think it is.
So stop the downvoting and try it out for yourself.
I'm afraid you have to use Canvas.TextWidth, or your implementation will be imprecise. The width of text depends on the font kerning, where different character sequences may have different widths (not just the total of individual character widths).
Me, I cut out the middle-man and use the Windows API directly. Specifically, I use GetTextExtentPoint32 with the .Handle of the Canvas. There's nothing you can do to be faster, other than caching results in some way, and frankly you'll just add overhead.

How to put large text into multiple UITextViews or UILabels?

I am facing a problem placing a large text into multiple UITextView/UILabel.
Example: Please see the attached picture ,it explains my problem.
assume three boxes are UITextViews or UILabels. Text will get from server as a complete one NSString, Now challenge is to place the text in the boxes (UITextView/UILabel).
could anyone please help me in solving this problem.
A UIWebView might be more suitable for the task of laying out a page. You could then use html with CSS floats to achieve the effect you're looking for.
If you do not want to use UIWebView, I suggest looking at Core Text for layout.
If you have bounding box for those elements, than you can easily implement this logic by iterating usage of method - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode and removing by one word from string till returned size will fit into bounding box for corresponding section, than truncate text to place where you stop removing words and complete with other sections.

Resources