ファイルシステムから透明度のある画像をいくつか表示して、UIImageView
ビューにします。私の目的のためには、UIImageView
のイメージとファイルシステムのファイルを比較する必要があります。だから私は次のようなことをする:別のバイトを返すUIImagePNGRepresentation()
NSString *directoryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *imageFile = [NSString stringWithFormat:@"%@/image.png", directoryPath];
if ([[NSData dataWithContentsOfFile:imageFile] isEqualToData:UIImagePNGRepresentation([imageView image])]) {
NSLog(@"Equal");
} else {
NSString *dataDescription = [[[NSData dataWithContentsOfFile:feltFile] description] substringToIndex:100];
NSString *imageDescription = [[UIImagePNGRepresentation([backgroundImageView image]) description] substringToIndex:100]
NSLog(@"Unequal: %@ %@", dataDescription, imageDescription);
}
私は彼らがPNG画像であることを知っている。いずれの説明も印刷するとNULLになりません。しかし、彼らは不平等です。
どうしてですか?
ダニエルありがとう! –