Skip to content

Instantly share code, notes, and snippets.

@cppforlife
Created August 27, 2011 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cppforlife/1175040 to your computer and use it in GitHub Desktop.
Save cppforlife/1175040 to your computer and use it in GitHub Desktop.
Comparing UIImages
@interface UIImage (ToEqualByBytes)
- (BOOL)toEqualByBytes:(UIImage *)otherImage;
@end
@implementation UIImage (ToEqualByBytes)
- (BOOL)toEqualByBytes:(UIImage *)otherImage {
NSData *imageData = (NSData *)CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage));
NSData *otherImageData = (NSData *)CGDataProviderCopyData(CGImageGetDataProvider(otherImage.CGImage));
return [imageData isEqualToData:otherImageData];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment