Skip to content

Instantly share code, notes, and snippets.

@cathandnya
Last active December 27, 2015 06:08
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 cathandnya/7279009 to your computer and use it in GitHub Desktop.
Save cathandnya/7279009 to your computer and use it in GitHub Desktop.
GIFかどうかを判断
#import "NSData+GIF.h"
@implementation NSData(GIF)
- (BOOL) isGIF {
char *bytes = (char *)[self bytes];
return [self length] >= 6 && (strncmp(bytes, "GIF87a", 6) == 0 || strncmp(bytes, "GIF89a", 6) == 0);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment