I want to add Image on text view and want proper spacing as shown in screenshot.
I have tried to add image on textview but I m having problem in placing text as per requirement. Please provide me help regarding same.
Add the below code after defining textView and imageView.
import CoreText.Framework
UIBezierPath *exclusionPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height)];
textView.textContainer.exclusionPaths = @[exclusionPath];
[textView addSubview:imageView];
to have a clear idea on core text tutorial see raywenderlich
In SWIFT:
var exclusionPath:UIBezierPath = UIBezierPath(rect: CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height))
textView.textContainer.exclusionPaths = [exclusionPath]
textView.addSubview(imageView)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With