在UIView签名 [英] Signature in UIView
问题描述
我正在寻找一个允许用户绘制的课程?(主要目的是获得他们的签名)。
I am looking for a class that will allow the user to draw?(the main purpose is to get their signature).
我检查了Cocoa Controls但却没有找到这样一个班级。在我开始自己编写之前,只想现在就知道了。
谢谢
I checked Cocoa Controls but couldn't find such a class. Just want to now if there's any before I start writing it myself. Thanks
推荐答案
看看这个教程: http://www.ifans.com/forums/showthread.php?t=132024
要获取JPG或PNG文件,您可以使用函数 UIImageJPEGRepresentation
或 UIImagePNGRepresentation
。他们将 UIImage
作为输入。要从 UIView
获得 UIImage
,你可以使用类似的东西。
To get a JPG or PNG file, you can use the functions UIImageJPEGRepresentation
or UIImagePNGRepresentation
. They take a UIImage
as input. And to get a UIImage
from a UIView
, you can use something like this.
UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这篇关于在UIView签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!