动态包装多个UIImageView周围的文本 [英] Dynamically wrapping text around multiple UIImageView

查看:103
本文介绍了动态包装多个UIImageView周围的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPad应用程序页面中,用户可以手动输入文本,并在页面上放置图像/其他媒体,使文本在媒体间动态流动。例如,请参阅此图片。我也相信苹果说,他们没有使用未记录的API,任何开发人员可以理论上重新创建一个应用程序,如Pages。



如何在我的应用程序?



它似乎不像 CTFrame类有这样的包装与UIImageViews / UIWebViews / etc。的任何机制,我的Cocoa API的知识有点有限,所以我' c> path 参数,你可以用来包装对象周围的文本。



基本上,你必须构造一个路径包含要用文本填充的总面积,减去应该保留的面积(您的图像)。


In the iPad application Pages, the user can manually enter text and place images/other media on the page- making the text flow dynamically around the media. As an example, see this picture. I also believe Apple said they're not making any use of undocumented APIs, and any developer could theoretically recreate an app like Pages.

How can I recreate this within my app?

It doesn't seem like the CTFrame class has any mechanism for this kind of wrapping with UIImageViews/UIWebViews/etc., and my knowledge of the Cocoa APIs is a bit limited, so I'm not sure where to look.

解决方案

The CTFramesetterCreateFrame function has a path argument that you can use to wrap text around objects.

Basically, you will have to construct a path that contains the total area that is to be filled with text, subtracting the areas that should be left free (your images).

这篇关于动态包装多个UIImageView周围的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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