파일 시스템에서 투명도가 적용된 이미지가 일부 있습니다 (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입니다. 그러나 그들은 불평등합니다.
왜 이런 일이 발생합니까?
다니엘 감사합니다! –