Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to split text into separate UITextView pages?
    primarykey
    data
    text
    <p>A subquestion is:</p> <p>How do I determine what the built-in internal margins of a UITextview are?</p> <p>I have a long master string of text that I am trying to split into separate UITextView pages that I can then scroll from page to page inside a UIScrollView. I use the following method to determine what the height of a string in a UITextView is and whether the string is over the height limit:</p> <pre><code>-(NSNumber *)getHeightByWidth: (NSString *) myString mySize: (UIFont *) mySize myWidth: (NSNumber *) myWidth { int intMyWidth = [myWidth intValue]; CGSize boundingSize = CGSizeMake(intMyWidth, CGFLOAT_MAX); CGSize requiredSize = [myString sizeWithFont:mySize constrainedToSize:boundingSize lineBreakMode:UILineBreakModeWordWrap]; NSNumber *retNumber = [[NSNumber alloc] initWithFloat:requiredSize.height]; return retNumber; [retNumber release]; } </code></pre> <p>I call the getHeightByWidth method using the following cellFont as the input for mySize:</p> <pre><code>UIFont *cellFont = [UIFont fontWithName:@"Arial" size:14.0]; </code></pre> <p>The UITextView is 320 pixels wide, but I notice that the text doesn't go from the left edge to the right edge as there are internal margins which look to be around 10 pixels on each side. So when I call getHeightByWidth I set myWidth = (320 - 10 - 10); But after building strings to fit within the UITextView, there are usually gaps on the last row that could be filled with the next words in the master string.</p> <p>Can anyone tell me why these gaps on the last row of the text occur using this process for UITextView?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload