Using few lines of code we can add one image over another image. It is useful when we need to add a watermark image over an image.
-(UIImage *)imageWithWaterMarkImage :(UIImage*)topImage  originalImage:(UIImage*)image
{
   CGSize size = image.size;
    UIGraphicsBeginImageContext( size );
    [image drawInRect:CGRectMake(0,0,size.width,size.height)];
    [topImage drawInRect:CGRectMake( image.size.width-topImage.size.width , image.size.height-topImage.size.height, topImage.size.width, topImage.size.height)]; // Watermark image will be added to bottom right corner
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
                       
                    
0 Comment(s)