Merging two images in objective-c

While researching about image manipulation for my next project, I came across an interesting piece of code, using which, we can merge two images into a single image. Here’s the code: -(UIImage*)mergeImage:(UIImage*)mask overImage:(UIImage*)source inSize:(CGSize)size{ //Capture image context ref UIGraphicsBeginImageContext(size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //Draw images onto the…

iPhone – How to find height of a label for dynamic string in it.

Here is a small but very useful function, which gives height of a label for which dynamic string is to be set: -(NSInteger) findHeightOfLabelString:(NSString *)textString{ UIFont *font = [UIFont systemFontOfSize:17]; CGSize size = CGSizeMake(175.0f, MAXFLOAT); CGSize labelSize=[textString sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap]; return labelSize.height;}

Objective C – Convert local time into GMT time.

These days m working on iPhone development and came across an interesting problem of converting GMT time into local time. After some research, I found this interesting function achieve it: -(NSString *)convertGMTDateFromLocalDate:(NSString *)gmtDateStr{ NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@”yyyy-MM-dd HH:mm”]; NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@”GMT”]; [formatter setTimeZone:gmt]; NSDate…