NSData *imagedata1=UIImagePNGRepresentation(btn.currentBackgroundImage);//按钮背景图片转NSData NSData *imagedata2=UIImagePNGRepresentation([UIImage imageNamed:@"资讯默认"]);//未选图片转NSData if([imagedata1 isEqualToData:imagedata2]){ // }
NSData *imagedata1=UIImagePNGRepresentation(btn.currentBackgroundImage);//按钮背景图片转NSData NSData *imagedata2=UIImagePNGRepresentation([UIImage imageNamed:@"资讯默认"]);//未选图片转NSData if([imagedata1 isEqualToData:imagedata2]){ // }