- (NSString *)stringFromFileSize:(int)theSize { float floatSize = theSize; if (theSize<1023) return([NSString stringWithFormat:@"%i bytes",theSize]); floatSize = floatSize / 1024; if (floatSize<1023) return([NSString stringWithFormat:@"%1.1f KB",floatSize]); floatSize = floatSize / 1024; if (floatSize<1023) return([NSString stringWithFormat:@"%1.1f MB",floatSize]); floatSize = floatSize / 1024; // Add as many as you like return([NSString stringWithFormat:@"%1.1f GB",floatSize]); }
You need to create an account or log in to post comments to this site.