Starting in OS X 10.8 and iOS 6, you can use NSByteCountFormatter.
Your example would look like this:
[NSByteCountFormatter stringFromByteCount:20000000 countStyle:NSByteCountFormatterCountStyleFile];
More Related Contents:
- @class vs. #import
- How to read data from NSFileHandle line by line?
- How to Check if an NSDate occurs between two other NSDates
- NSInvocation for Dummies?
- Number of occurrences of a substring in an NSString?
- Hidden Features of Xcode
- @synthesize vs @dynamic, what are the differences?
- What exactly is a so called “Class Cluster” in Objective-C?
- Why are umbrella frameworks discouraged? [closed]
- Regular expressions in an Objective-C Cocoa application
- How to Write OS X Finder plugin
- View-based NSTableView with rows that have dynamic heights
- NSMutableArray – force the array to hold specific object type only
- Best way to remove from NSMutableArray while iterating?
- Difference between NSString literals
- Why is my transformable Core Data attribute not using my custom NSValueTransformer?
- Cocoa Custom Notification Example
- Dispatch queues: How to tell if they’re running and how to stop them
- Embed font in a mac bundle
- What is the cost of using autorelease in Cocoa?
- What is an NSCFDictionary?
- NSTextField waits until the end of a loop to update
- NSString is integer?
- Call instance method from class method
- Mac Mountain Lion send notification from CLI app
- Flatten an NSArray
- Creating breakpoint in Xcode for unrecognized selector
- How to get the width of an NSString?
- How to Get the Display Name with the Display ID in Mac OS X?
- Executing shell commands with NSTask – Objective-C Cocoa