如题,如果有一个logo.jpg的文件,我在获得这个图片文件的指针的同时想得到这个图片文件的大小(B或者KB),应该怎么做啊?NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"logo"ofType:@"jpg"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
我只有22分,就给20分吧,虽然少点,诚意在。谢谢了!
UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
我只有22分,就给20分吧,虽然少点,诚意在。谢谢了!
NSFileManager * filemanager = [[NSFileManager alloc]init];
if([filemanager fileExistsAtPath:[self getCompletePath] isDirectory:&isDirectory]){
NSDictionary * attributes = [filemanager attributesOfItemAtPath:[self getCompletePath] error:nil];
// file size
NSNumber *theFileSize;
if (theFileSize = [attributes objectForKey:NSFileSize])_fileSize= [theFileSize intValue];
}ORIETechhttp://www.orietech.com
UIImage或者UIImageView有个size的属性,可以获取的。