Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use this code for set particular content height:</p> <pre><code> NSString *finalString=@"d jdsfhksd fsdfhjkds fkdhsfjkdsf kdsfhjkdsf sdjkfsdfh dsfhsfisudi udsifhisdhf sdhfkh sdkf dshf ksdh fkhsd khsdfh sdkhf sdhkfhsdjkfhdshf sdfhdshf hsdfh ksdhf kdhsf hsdkfhsdkhf sdf hsdkfh dsf sdkhf ksdhf hsdfh sdhfksdhf sd ksdhsdh ksdh dhs hsdh ksdh dhs fhsdfh dsfsdfdf sdf sd sd dsf sd fsdf ds"; int length =200; UIFont *font=[UIFont fontWithName:@"Helvetica" size:17.0f]; NSString *firstPartString=[NSString stringWithString:finalString]; CGSize firstPartStringSize = [firstPartString sizeWithFont:font constrainedToSize:CGSizeMake(195,MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping]; while(firstPartStringSize.height &gt; length) { firstPartString = [firstPartString substringWithRange:NSMakeRange(0, firstPartString.length-1)]; firstPartStringSize = [firstPartString sizeWithFont:font constrainedToSize:CGSizeMake(195,MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping]; } if(firstPartStringSize.height &lt;= length) { while(![[firstPartString substringToIndex:[firstPartString length]-1] isEqualToString:@" "]) { NSLog(@"%@",[firstPartString substringFromIndex:[firstPartString length]-1]); if([firstPartString substringFromIndex:[firstPartString length]-1].length !=0 &amp;&amp; ![[firstPartString substringFromIndex:[firstPartString length]-1] isEqualToString:@" "]) { firstPartString = [firstPartString substringWithRange:NSMakeRange(0, firstPartString.length-1)]; } else { break; } } } NSString *resultStr=firstPartString; int secondPartStringLength=[finalString length]-firstPartString.length; NSRange secondPartStringRange=NSMakeRange(firstPartString.length, secondPartStringLength); NSString *secondPartString=[finalString substringWithRange:secondPartStringRange]; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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