获取文件属性
答
如果要计算你的资源文件在运行时的大小基本上你可以做以下(省略错误检查等):
// Get path for resource file
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"myPDFFile" ofType:@"pdf"];
// Get file attributes
NSDictionary* attributeDict = [[NSFileManager defaultManager] attributesOfItemAtPath:resourcePath error:nil];
// Get size attribute
NSNumber* fileSizeObj = [attributeDict objectForKey:NSFileSize];
long long fileSizeVal = [fileSizeObj lonLongValue];
感谢您的重播,但我有一个问题,我可以得到文件的创建日期? – milanjansari 2010-03-19 09:32:52
看到这个问题 - http://stackoverflow.com/questions/1140696/cant-get-filecreationdate,这个键可能在iPhoneOS中不被支持 – Vladimir 2010-03-19 10:09:14