I have long text and 2 textViews. I need to insert this text to 2 textViews(they have no scrolling). It's like book pages(first page is a one textView, second page is a another textView). So, question is: how to determine which text length I need insert to first textView?
Asked
Active
Viewed 59 times
2 Answers
0
You can set the complete text to the first textView, calculate the visible text range and set the remaining text to the second textView. An alternative is to manually calculate the range of the text that will be visible in the first textView, however it requires ugly recursion with sizeWithFont
that i can't believe is so fast, i'd follow the first way.
See this answer to learn how to get the visible text range.
0
First figure out length of each line, font, and how many lines you can fill into the each textview. Use following to do this
CGFloat stringWidth = [text sizeWithFont:[UIFont fontWithName:your_textview_font_name size:your_textview_font_size]].width;
Then use substrings operation.
Shouldn't be difficult to do this!

Paresh Masani
- 7,474
- 12
- 73
- 139