Signature in UIView

折月煮酒 提交于 2020-01-01 03:22:45

问题


I am looking for a class that will allow the user to draw?(the main purpose is to get their signature).

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


回答1:


Look at this tutorial: http://www.ifans.com/forums/showthread.php?t=132024

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();


来源:https://stackoverflow.com/questions/6299690/signature-in-uiview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!