After rotate the image how to merge the rotation image? I using the below code, It
If you want while device orientation use this code
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
//Your cgrectmake for landscape
}
else
{
//Your cgrectmake for Portrait
}
}
Add this method call this after rotation:
-(UIImage *)getMergedImage
{
UIImage mergedImage;
UIGraphicsBeginImageContext(backgroundImageView.frame.size)
[backgroundImageView.layer renderInContext:UIGraphicsGetCurrentContext];//bacgroundImageView here
UIImage overLappedImage = [self getOverlappedImage];
if(overLappedImage)
{
//CGRectMake(0,0,rsImageView.frame.width,rsImageView.frame.height)
[overLappedImage drawInRect:rsImageView.frame blendMode:kCGBlendModeNormal alpha:0.8];//TopMostImageView here
}
mergedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return mergedImage;
}
Add this method to get overlappped Image.
-(UIImage *)getOverlappedImage
{
UIImage overlappedImage;
UIGraphicsBeginImageContext(rsImageView.frame.size)
[rsImageView.layer renderInContext:UIGraphicsGetCurrentContext]; //TopMostImageView here
overlappedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return overlappedImage;
}