IOS比较两个图片是否相同的方法

来源:互联网 发布:nginx重定向url域名 编辑:程序博客网 时间:2024/05/16 09:17
 NSString *patha =  [[NSBundle mainBundle] pathForResource:@"a" ofType:@"png"];    NSString *pathb =  [[NSBundle mainBundle] pathForResource:@"b" ofType:@"png"];        UIImage *imagea = [UIImage imageWithContentsOfFile:patha];    UIImage *imageb = [UIImage imageWithContentsOfFile:pathb];        NSData *dataa =    UIImagePNGRepresentation(imagea);    NSData *datab =    UIImagePNGRepresentation(imageb);        if ([dataa isEqual:datab]) {        NSLog(@"OK");    }else{        NSLog(@"NO");    }

0 0
原创粉丝点击