문제

Is there a way to wrap text from a UITextView around a UIImage without using CoreText?

I have been playing around with attributed strings without much luck, and CoreText just seems extremely complicated so I would rather stay out of it.

도움이 되었습니까?

해결책

This seems to do the trick:

UIBezierPath * imgRect = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 100, 100)];
self.textView.textContainer.exclusionPaths = @[imgRect];

Works only from iOS 7 and up.

다른 팁

In Swift 4:

self.textView.textContainer.exclusionPaths = [UIBezierPath(rect: imageView.frame)]

The short answer is you can't without CoreText pre iOS 7.

I've been struggling with this myself a while ago and this post was very helpful to me.

It is CoreText though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top