gpt4 book ai didi

iPhone签名捕捉

转载 作者:行者123 更新时间:2023-12-03 19:09:40 24 4
gpt4 key购买 nike

是否可以通过电缆 (USB) 连接将签名从 iPhone 传输到 .xls 文件?

最佳答案

所以,这可能不完全是您正在寻找的内容,但这就是我捕获用户(用他们的手指/手写笔)绘制的签名的方式。您的 UIImageView 将具有绘制的签名。我没有考虑过如何将签名图像传输到 .xls,但您可以将图像保存到设备的照片库,然后像导出任何其他图像一样将其导出,然后将其放入 .xls(我知道,这是一本手册)过程)。我希望这有帮助。

SignatureViewController.h

IBOutlet UIImageView *signatureImageView;

//Signature Drawing Items
CGPoint lastPoint;
BOOL mouseSwiped;
int mouseMoved;

SignatureCaptureViewController.m

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {      
mouseSwiped = NO;
UITouch *touch = [touches anyObject];

//Clear Signature on Double Tap
if ([touch tapCount] == 2) {
signatureImageView.image = nil;
return;
}

lastPoint = [touch locationInView:signatureImageView];

}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
mouseSwiped = YES;

UITouch *touch = [touches anyObject];

CGPoint currentPoint = [touch locationInView:signatureImageView];

UIGraphicsBeginImageContext(signatureImageView.frame.size);
[signatureImageView.image drawInRect:CGRectMake(0, 0, signatureImageView.frame.size.width, signatureImageView.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());

signatureImageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

lastPoint = currentPoint;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [touches anyObject];

//Clear Signature on Double Tap
if ([touch tapCount] == 2) {
signatureImageView.image = nil;
return;
}

if(!mouseSwiped) {
UIGraphicsBeginImageContext(signatureImageView.frame.size);
[signatureImageView.image drawInRect:CGRectMake(0, 0, signatureImageView.frame.size.width, signatureImageView.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 0.0);
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
CGContextFlush(UIGraphicsGetCurrentContext());
signatureImageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
}

关于iPhone签名捕捉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4132877/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com