I found this useful class for base64 encoding / decoding. It is written by Kiichi Takeuchi Base64.h @interface Base64 : NSObject { } + (void) initialize; + (NSString*) encode:(const uint8_t*) input length:(NSInteger) length; + (NSString*) encode:(NSData*) rawBytes; + (NSData*) decode:(const char*) string length:(NSInteger) inputLength; + (NSData*) decode:(NSString*) string; @end Sample Usage [Base64 initialize]; NSData * [...]
iPhone SDK generate MD5 Hash of a string
This function will help you generate MD5 hash of a given string Class.h + (NSString *)getMD5FromString:(NSString *)source; Class.m + (NSString *)getMD5FromString:(NSString *)source{ const char *src = [source UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5(src, strlen(src), result); NSString *ret = [[[NSString alloc] initWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], result[10], result[11], result[12], result[13], result[14], [...]
iPhone SDK convert hex color string to UIColor
This function will help you to convert hex color string to UIColor Class.h + (UIColor *) colorWithHexString: (NSString *) stringToConvert; Class.m + (UIColor *) colorWithHexString: (NSString *) stringToConvert{ NSString *cString = [[stringToConvert stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; // String should be 6 or 8 characters if ([cString length] < 6) return [UIColor blackColor]; // strip 0X if [...]
Auto Increment Build Number & Date in XCode iPhone Project
While developing application we keep sharing the builds with others. It is very difficult to find out which version they are using and the date it was build. To overcome this I was searching for methods that can used to auto increment build numbers and set the application build date. I found this article really [...]
To create rounded rectangular views using iPhone SDK
To create view with rounded corners is really simple in iPhone SDK 3.0 in just 2 steps Step 1: Include QuartzCore #import <quartzcore/QuartzCore.h> Step 2: You can now add corner radius to any view //Create a Imageview UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 100, 300, 225)]; //Load some image [imageView setImage:[UIImage imageNamed:@"candle.jpg"]]; //Enable maskstobound [...]
Add UIActivityIndicatorView to UINavigationBar
For me it took sometime to figure out how to show activity indicator in the navigation bar. Later I found it was very simple. When you push a view to the navigation you get to play with navigationItem property on the view that is being pushed. In your viewWillAppear method you can add this code. [...]