|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
NSArray *pathArr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); path = [[pathArr objectAtIndex:0]stringByAppendingPathComponent:[NSString stringWithFormat:@"imagename.png"]]; // Getting the path of the image, whose size is to be calculated. NSFileManager *fileManager = [NSFileManager defaultManager]; // Creating the object of file manager. NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path traverseLink:YES]; // Getting the attributes of the file in the path. if(fileAttributes != nil) { NSString *fileSize = [fileAttributes objectForKey:@"NSFileSize"]; // Getting the value corresponding to the key NSFileSize from the attributes array and storing it to a string.. NSLog(@"File size: %@ kb", fileSize); } |
Incoming search terms:
- check uiimage size kb iphone
- fileattributesatpath in magento
- how to get a file size programmatically in ios
- ipad image path programmatically
Tagged with: array • Attributes • Filemanager • Image • Image Size • kb • Path • Png • Programmatically • size • Size Kb
Filed under: Box 2d • Cocoa • Cocos2d • iPad • iPhone • Objective C • Tips and Tricks
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply