use*_*228 5 objective-c uiimage ios
我想获得UIImage Object真正的内存大小.有3种方法
NSUInteger s1 = UIImagePNGRepresentation(thumbImage).length;
NSUInteger s2 = UIImageJPEGRepresentation(thumbImage, 1).length;
NSUInteger s3 = CGImageGetHeight(thumbImage.CGImage) * CGImageGetBytesPerRow(thumbImage.CGImage);
NSLog(@"s1:%u",s1);
NSLog(@"s2:%u",s2);
NSLog(@"s3:%u",s3);
Run Code Online (Sandbox Code Playgroud)
和结果
S1:62734
S2:175939
S3:578816
哪一个是对的?
最后一个(第3个)是正确的:
| 归档时间: |
|
| 查看次数: |
3944 次 |
| 最近记录: |