iOS FileSize 转成string

来源:互联网 发布:中国人开发的编程语言 编辑:程序博客网 时间:2024/06/06 19:18

    NSString *fileURLString = [self.docInteractionController.URL path];

    NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:fileURLString error:nil];

    NSInteger fileSize = [[fileAttributes objectForKey:NSFileSize] intValue];

    NSString *fileSizeStr = [NSByteCountFormatter stringFromByteCount:fileSize

                                                           countStyle:NSByteCountFormatterCountStyleFile];


0 0
原创粉丝点击