title: half word is going on next line created using nsmutableattributedstring
body: <p>Before I start, <code>details_Label</code> is <code>UITextView</code>. I have wrong naming because earlier it was label but I changed to UITextView for copy text and other functionalities.</p>
  
  <p>Below is what I have</p>
  
  <pre><code>  details_Label.text = [NSString stringWithFormat:@"%@", [[[detailsArray objectAtIndex:0] valueForKey:@"Details"] substringToIndex:200]];
  
  NSMutableAttributedString *attributedString;
  attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@", details_Label.text] attributes:@{ NSFontAttributeName : [self adjustDefaultFont:85], NSLigatureAttributeName: @2}];
  
  NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init] ;
  [paragraphStyle setAlignment:NSTextAlignmentCenter];
  [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [details_Label.text length])];
  
  details_Label.editable = NO;
  details_Label.selectable = YES;
  details_Label.tintColor = pBlackColor;
  
  [details_Label sizeToFit];
  
  [details_Label layoutIfNeeded];
  [details_Label setTextContainerInset:UIEdgeInsetsMake(0, 0, 0, 0)];
  
  [details_Label.textContainer setSize:details_Label.frame.size];
  details_Label.frame = CGRectMake(50*iPhoneFactorX, startX, 980*iPhoneFactorX, details_Label.frame.size.height);
  </code></pre>
  
  <p>This is how I am displaying the text.</p>
  
  <p>The problem is <strong><em>half word is going in next line</em></strong> is as shown in below image...</p>
  
  <p><a href="https://i.stack.imgur.com/jLV4C.png" rel="nofollow"><img src="https://i.stack.imgur.com/jLV4C.png" alt="enter image description here"></a></p>
  
  <p>At the start I thought it was because of long text, however when I just take first 200 characters, still problem is coming.</p>
  
  <pre><code>details_Label.text = [NSString stringWithFormat:@"%@", [[[detailsArray objectAtIndex:0] valueForKey:@"Details"] substringToIndex:200]];
  </code></pre>
  
  <p><strong><em>Any idea what is going wrong?</em></strong></p>
  
  <hr>
  
  <h2>Edit 1</h2>
  
  <p>When I print the NSAttributedString, below is what I get.</p>
  
  <blockquote>
    <p>NSFont = " font-family: \"Arial-BoldMT\"; font-weight: bold; font-style: normal; font-size: 34.72pt";
        NSParagraphStyle = "Alignment 1, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n    28L,\n    56L,\n    84L,\n    112L,\n    140L,\n    168L,\n    196L,\n    224L,\n    252L,\n    280L,\n    308L,\n    336L\n), DefaultTabInterval 0, Blocks (\n), Lists (\n), BaseWritingDirection -1, HyphenationFactor 0, TighteningForTruncation NO, HeaderLevel 0";
    } </p>
  </blockquote>