移动,旋转和缩放UIImages,然后合并它们!在iphone中

时间:2014-02-14 10:48:40

标签: ios iphone objective-c uiimage

旋转图像合并但不在此代码中工作 我发布我的代码 请给我解决方案

- (void)mergeImage :(UIImage *)imageA withImage:(UIImage *)imageB ###
{
    UIImage *image0 = imageA;
    UIImage *image1=overlayimg.image;

    CGSize newImageSize = CGSizeMake(overlayimg.frame.size.width, overlayimg.frame.size.height);
    UIGraphicsBeginImageContext(newImageSize);

    [image0 drawInRect:CGRectMake(overlayimg.frame.origin.x,overlayimg.frame.origin.y,newImageSize.width,newImageSize.height)];

    NSLog(@"Last Rotation:%f",templastrotate);

    overlayimg.transform = CGAffineTransformMakeRotation(templastrotate);
    CGContextConcatCTM(UIGraphicsGetCurrentContext(), overlayimg.transform);

    [image1 drawInRect:CGRectMake(overlayView.frame.origin.x, overlayView.frame.origin.y,overlayView.frame.size.width,overlayView.frame.size.height)];

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    imageView.contentMode = UIViewContentModeScaleAspectFill & UIViewContentModeScaleAspectFit;
    imageView.image=newImage; 
    UIGraphicsEndImageContext();
}

0 个答案:

没有答案