[iOS 第三方]画图保存 获取Image(适用签名)

在支付后 需要用的签名
这里适用一个别人的绘图类
这里写图片描述

viewController.m 代码如下

#import "ViewController.h"
#import "ACEDrawingView.h"

#import "Utils.h"

@interface ViewController ()<ACEDrawingViewDelegate>
@property (nonatomic,strong) ACEDrawingView *V;
@property (nonatomic,strong) UIImageView *showImageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    _V = [[ACEDrawingView alloc] initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width, self.view.bounds.size.height-100)];
    _V.delegate = self;
    _V.lineWidth = 9.0;
    _V.lineColor = [UIColor whiteColor];
    _V.backgroundColor = [UIColor darkGrayColor];
    [self.view addSubview:_V];


    _showImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 300, 50, 50)];
    [_V addSubview:_showImageView];



}


- (IBAction)clearBtn:(id)sender {
    [_V clear];

}


- (IBAction)saveBtn:(id)sender {
    _showImageView.image = _V.image;
    [self channgeASII:_V.image];
}

//获取图片后 的一些处理  更具后台需求
-(void)channgeASII:(UIImage*)img{
    NSData *imgData = [NSData dataWithData:UIImagePNGRepresentation(img)];
    NSLog(@"imgData ===== is %@",imgData);

    //md5加密 ( D91D783DC491E66F85A835C472A953AB )
    NSString *imgStringMD5 = [Utils md5WithData:imgData];
    NSLog(@"imgStringMD5  is %@",imgStringMD5);


    NSMutableString *handsignString = [NSMutableString stringWithCapacity:([imgData length] * 2)];
    const unsigned char *dataBuffer = (unsigned char *) [imgData bytes];
    for (int i = 0; i < [imgData length]; ++i) {
        [handsignString appendFormat:@"%02X", (unsigned) dataBuffer[i]];
    }

    NSLog(@"handsignString is %@",handsignString);
}

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值