Signature in UIView

前端 未结 1 659
-上瘾入骨i
-上瘾入骨i 2021-02-10 08:55

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 wa

1条回答
  •  孤独总比滥情好
    2021-02-10 09:16

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

    0 讨论(0)
提交回复
热议问题