Wrapping Text in a UITextView Around a UIImage WITHOUT CoreText

只谈情不闲聊 提交于 2019-11-26 09:27:02

问题


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.


回答1:


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.




回答2:


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

I've been struggling with this my self a while ago and the was very helpfull to me. http://robnapier.net/blog/wrapping-text-around-shape-with-coretext-540 It is CoreText though.



来源:https://stackoverflow.com/questions/13216135/wrapping-text-in-a-uitextview-around-a-uiimage-without-coretext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!