ios获得文件的大小
更新:HHH   时间:2023-1-7



获得文件路径

NSString *yourPath = [[NSBundlemainBundle] pathForResource:@"btn_change"ofType:@"png"];

NSFileManager *man = [NSFileManagerdefaultManager];

获得文件的相关属性

NSDictionary *attrs = [man attributesOfItemAtPath: yourPath error: NULL];

得到大小

unsignedlonglong result = [attrs fileSize];

打印

NSLog(@"%lld",result);


返回移动开发教程...