title: iOS NSTextAttachment image not showing
body: <p>NSTextAttachment lock image cut off at the edge but when the line does not breaks at the edge then the lock icon can be seen. I want the icon to move to the next line like a word move to the next line.</p>
  
  <p>Here are the example:</p>
  
  <pre><code>    NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
      attachment.image = [UIImage imageNamed:@"lock.png"];
      NSString *stringHeadline = @"This is a example sample sentence. Why I do";
      NSAttributedString *attachmentLock = [NSAttributedString attributedStringWithAttachment:attachment];
      NSAttributedString *myText = [[NSMutableAttributedString alloc] initWithString:stringHeadline];
      NSMutableAttributedString *lockString = [[NSMutableAttributedString alloc] initWithAttributedString:myText];
  
      [lockString appendAttributedString:attachmentLock];
      lblHeadline.attributedText = lockString;
      [lblHeadline sizeToFit];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/mWjmt.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/xuscz.png" alt="Lock icon gone missing when the text near the edge."></p>
  
  <p>Lock icon gone missing when the text near the edge.</p>