当前位置: 代码迷 >> Iphone >> 获取iphone手机内存以及硬盘存储空间大小的有关问题
  详细解决方案

获取iphone手机内存以及硬盘存储空间大小的有关问题

热度:38   发布时间:2016-04-25 06:25:26.0
获取iphone手机内存以及硬盘存储空间大小的问题

请问谁知道获取iphone手机内存以及硬盘存储空间大小的方法,,紧急求救啊。。。 小弟这里先谢谢了。。

?

?

?

?

问题已解决。

?

- (NSString *)commasForNumber:(long long) num?

?{

//Produce a peroperly formatted number string

//Alternatively use NSNumberFormatter

if(num < 1000) return [NSString stringWithFormate:@"%d",num];

return [[self commasForNumber:num/1000] stringByAppendingFormat:@",%03d",(num % 1000)];

}

?

- (void) action:(UIBarButtonItem *)bbi

{

NSFileManager *fm = [NSFileManager defaultManager];

NSDictionary *fattributes = [fm fileSystemAttributesAtPath:NSHomeDirectory()];

NSLog(@"System space: %@",[self commasForNumber:([[fattributes objectForKey:NSFileSystemSize] longLongValue])]);

NSLog(@"System free space: %@",[self commasForNumber:([[fattributes objectForKey:NSFileSystemFreeSize] longLongValue])]);

}

  相关解决方案