在UIIMAGEView中绘制符号和添加文本 [英] Draw Symbol and ADD Text in UIIMAGEView

查看:238
本文介绍了在UIIMAGEView中绘制符号和添加文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在UIImageView中绘制符号并添加文本。移动时它应该一起移动。如果它下次打开,它应该是可编辑的。请给我

I want to Draw a symbol and add text in UIImageView. when move it should move together. When it would get opened next time, it should be editable. pls needful for me

推荐答案

你可以通过访问CALayer(通过-layer方法)绘制UIView,并使用-DrawInContect:方法指定CGContext绘制。



有关在CGContext上绘制路径和文本的函数,请参阅CGContext参考。



如果你希望符号和文本一起移动,独立于一些背景图像,那么最好的办法是将它们放在UIImageView顶部的透明UIView上 - 然后你就可以将上部UIView移动到相反的位置而不是重绘数据。



至于让它们可编辑,那取决于你。一旦你知道如何创建它们,你总是可以把它们扔掉并创建新的。
You can draw into a UIView by accessing the CALayer (by the -layer method), and using the -DrawInContect: method to specify a CGContext to draw.

See the CGContext reference for functions that draw paths and text on CGContext.

If you want the symbol and text to move together, independent of some background image, then the best thing to do would be to put them on a transparent UIView that is on top of the UIImageView -- then you can just move the upper UIView around rather than redrawing the data.

As for making them editable, that up to you. Once you know how to create them, you can always throw them away and create new ones.


这篇关于在UIIMAGEView中绘制符号和添加文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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