title: How to align an image embedded in UITextView
body: <p>Because of my app logic I need to present some text with images within <code>UITextView</code>. It's not a problem to embed an image (working solution is given, for example, here <a href="https://stackoverflow.com/questions/24010035/how-to-add-image-and-text-in-uitextview-in-ios">How to add image and text in UITextView in IOS?</a>). But I absolutely have no clue how to align the image. I try to set attributes </p>
  
  <pre><code>var attributedString: NSMutableAttributedString!
  let textAttachment = NSTextAttachment()
  let image = UIImage(named: imageName)            
  
  textAttachment.image = image
  let attrStringWithImage = NSAttributedString(attachment: textAttachment)
  
  let style = NSMutableParagraphStyle()
  style.alignment = NSTextAlignment.justified
  let attrs = [NSParagraphStyleAttributeName: style]
  
  attributedString = NSMutableAttributedString(attributedString: attrStringWithImage)
  let text = NSAttributedString(string: myText, attributes: attrs)
  attributedString.append(text)
  
  myTextView?.attributedText = attributedString
  </code></pre>
  
  <p>but it doesn't influence on image. The text is aligned good, but the image always get stuck to the left edge of the view.
  How to fix it? Thanks in advance.</p>