如何在 iOS 上绘制带有文本换行的图像? [英] How Can I Draw Image with Text Wrapping on iOS?

查看:34
本文介绍了如何在 iOS 上绘制带有文本换行的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按照以下样式绘制文本——图像始终在右上角,文本在图像周围.

I want to draw text just like the following style -- the image is always on the top right corner, and the text is around the image.

谁能告诉我如何在 iOS 上实现它?我需要使用核心文本吗?

Could anyone tell me how to implement this on iOS? Do I need to use Core Text?

提前致谢!

推荐答案

是的,CoreText 是做到这一点的最佳方式.在这里发布的代码有点长.文章 将 CGRect 剪辑为 CGPath"中的一些代码可能会为您指明正确的方向. 如果这样做的过程仍然令人困惑,请 ping 我,我终于写了我一直想写的关于该主题的博客文章.

Yes, CoreText is the best way to do this. The code to do it is a little long to post here. Some code that may point you in the right direction is in the article "Clipping a CGRect to a CGPath." If the process for doing it is still confusing, ping me and I finally write the blog post I've been meaning to write on the subject.

这篇关于如何在 iOS 上绘制带有文本换行的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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