在我的应用程序中,用户将向客户请求数字化的手写签名.
当用户在触摸屏上"写入"时,我需要能够捕获签名.我还需要存储数字化签名的图像以备将来使用.
我需要帮助或指针来使我的应用程序具有数字签名?
Cal*_*leb 16
由于您真的在谈论在iOS设备上录制用户的"模拟"签名,所以您需要做的就是在用户围绕视图移动手指或手写笔时创建图像.网上有很多教程可以说明这一点(这是Ray Wenderlich网站上的一个).
基本思想是在跟踪视图中的触摸时通过添加点来构建路径.用户完成后,您可以保存生成的图像本身,或只保存路径.所以,你可能会创建一个子类UIView
叫像SignatureView
,你会实现触控相关的应答方法-touchesBegan:withEvent:
,-touchesMoved:withEvent:
,-touchesEnded:withEvent:
和-touchesCancelled:withEvent:
.触摸开始时,您将创建一个新的贝塞尔曲线路径.每次触摸移动时,向该路径添加一个点.触摸结束时,将新路径添加到视图记录的路径列表中.您可能还需要一种通过清除路径列表来擦除视图的方法,以及-drawRect:
绘制路径的方法以及视图控制器检索路径或图像的某种方法.
此外,不言而喻,您需要非常小心使用用户的签名.避免存储签名的未加密图像,也许避免将签名存储在设备上.您可以将签名发送到可能更容易保护的服务器.
Ran*_*man 12
我猜这些以下链接可以帮到你!无论如何,当我在互联网上寻找相同的目的时,我找到了那些!希望这对我们所有人都有用!
以下链接涉及相同的资源:在iOS设备上捕获手写签名.
注意:
截至今天(2015年11月13日),我注意到上面提供的第一个链接(altamiracorp.com)由于某些未知原因不可用,可能是他们已经放下了他们的网站.所以我想公开分享我在EverNote中保存的一份副本,因为它有一些明智的教育价值理论.所以请在这里访问它.
猜猜这个答案对你有帮助!:(Y)
请使用苹果研究套件(http://www.apple.com/in/researchkit/)
查看更多详情:
https://github.com/researchkit/researchkit
ViewController.h
#import <UIKit/UIKit.h>
#import <ResearchKit.h>
@interface ViewController : UIViewController<ORKTaskViewControllerDelegate> // Delegate
@property (strong, nonatomic) IBOutlet UIImageView *signImageview;
@property (nonatomic, strong, readonly) ORKConsentDocument *consentDocument;
@property (nonatomic, strong, readonly) ORKConsentSignature *signature;
Run Code Online (Sandbox Code Playgroud)
ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_consentDocument = [[ORKConsentDocument alloc] init];
_signature = [[ORKConsentSignature alloc] init];
ORKConsentReviewStep *signatureStep = [[ORKConsentReviewStep alloc] initWithIdentifier:@"sign" signature:_signature inDocument:_consentDocument];
ORKOrderedTask *task =
[[ORKOrderedTask alloc] initWithIdentifier:@"task" steps:@[signatureStep]];
ORKTaskViewController *taskViewController = [[ORKTaskViewController alloc] initWithTask:task taskRunUUID:nil];
taskViewController.delegate = self;
[self presentViewController:taskViewController animated:YES completion:nil];
}
#pragma mark - ORKTaskViewController delegate method
- (void)taskViewController:(ORKTaskViewController *)taskViewController
didFinishWithReason:(ORKTaskViewControllerFinishReason)reason
error:(NSError *)error {
ORKConsentDocument *documentCopy = [_consentDocument copy];
ORKConsentSignatureResult *signatureResult =
(ORKConsentSignatureResult *)[[[taskViewController result] stepResultForStepIdentifier:@"sign"] firstResult];
[signatureResult applyToDocument:documentCopy];
self.signImageview.image = signatureResult.signature.signatureImage;
// Then, dismiss the task view controller.
[self dismissViewControllerAnimated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22231 次 |
最近记录: |