ios - UItextview 自动换行,带有排除路径(swift)

标签 ios swift uitextview line-breaks exclusionpath

我正在开发一个应用程序,它允许用户添加图像并在 UITextView 中移动它。文本使用排除路径在图像周围流动,但如果该行的其余部分没有足够的空间,文字就会中断,而不是移动到下一行。

这就是我用来添加图像并为文本容器创建排除路径的内容

textView.addSubview(imageview)
let imagePath = UIBezierPath(rect: imageview.frame)
textView.textContainer.exclusionPaths = imagePath

This is what is happening, notice how the words will break up to the right of the image

This is what I want to happen. The words should move to the next line if there is not enough room on the current line

感谢您对此提供的任何帮助!

最佳答案

你可以使用 imageView.bounds 创建一个矩形,然后尝试一下吗?不确定但希望它能工作

关于ios - UItextview 自动换行,带有排除路径(swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52463087/

相关文章:

ios - 如何为forControlEvents 放置多个控制事件?

ios - 在 Swift 中更改导航栏的颜色

ios - 中断 UIView 转换

swift - 为什么我的 TextView 在滚动时是透明的以及如何禁用它?

ios - 根据不同的设备设置UITextView字体大小

ios - [登录 View Controller View Controller ] : unrecognized selector sent to instance 0x10942c3d0

ios 8模拟器,是否可以向模拟器发送推送通知

ios - Facebook 页面是否可以访问使用 Facebook Connect for iOS 的 'likes' 该页面的每个用户的 ID?

ios - 这个控制台警告对我的约束意味着什么?

html - 如何在 iOS 中使用 NSAttributedString 为 HTML 链接着色