In iOS 8, I\'m trying to add a UIImageView as a subview of a UITextView, similar to what\'s shown here - but with the text below the image.
I tried too hard toying with exclusion path.
My problem was that top level exclusion path never worked, it pushed content towards the top instead of center, while bottom content had double the exclusion path margin.
Here is what worked for me:
UITextView
Init it with your textcontainer by putting this inside init
:
super.init(frame: frame, textContainer: textContainer)
As per Daniel's answer, put inside layoutSubviews
:
self.textContainerInset = UIEdgeInsets.init(top: t, left: l, bottom: b, right: r)
Inside your UITextView
subclass init()
or in storyboard, disable scrolling.
self.isScrollEnabled = false
For more details, read this super-helpful thread.