title: How to set margins (padding) in NSAttributedString?
body: <p>I am inserting an image into an UITextView using an NSAttributedString, but the problem is that I want to set the top padding to a few points(2/3), so that the image y center will be on the <a href="https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/Art/glyphterms_2x.png" rel="nofollow">baseline</a> of the text.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:currentMessage];
  NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
          textAttachment.image = [UIImage imageWithCGImage:[[imagesArray objectAtIndex:count] CGImage] scale:4.0 orientation:UIImageOrientationUp];
          NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
  
          int newPos = [[imagesPosArray objectAtIndex:count] intValue];
          [attributedString replaceCharactersInRange:NSMakeRange(newPos, 1) withAttributedString:attrStringWithImage];
          messageTextView.attributedText = attributedString;
  </code></pre>