使用自定义间距和文本在UITextView上添加图像 [英] Add image on UITextView with custom spacing and text

查看:88
本文介绍了使用自定义间距和文本在UITextView上添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文本视图上添加图像,并想要适当的间距,如屏幕截图所示.

I want to add Image on text view and want proper spacing as shown in screenshot.

我尝试在textview上添加图像,但是在按要求放置文本时遇到问题. 请就此向我提供帮助.

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.

推荐答案

在SWIFT中:

var exclusionPath:UIBezierPath = UIBezierPath(rect: CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height))

textView.textContainer.exclusionPaths  = [exclusionPath]
textView.addSubview(imageView)

这篇关于使用自定义间距和文本在UITextView上添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆