相对缩放UIImageView

| 我有两个UIImageViews,我设法合并并保存了它们。但是我希望覆盖的图像相对于所选图像的比例进行缩放和定位。因此,您在屏幕上看到的UIImageView与其保存的UIImageView相同。
- (UIImage *)combineImages{

UIGraphicsBeginImageContext(CGSizeMake(theimageView.image.size.width,theimageView.image.size.height));

// Draw image1
[theimageView.image drawInRect:CGRectMake(0,0, theimageView.image.size.width,theimageView.image.size.height)];

// Draw image2
[Birdie.image drawInRect:CGRectMake(Birdie.center.x, Birdie.center.y, (theimageView.image.size.width / 2), (theimageView.image.size.height / 2))];

UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return resultingImage;
} theImageView和Birdie是两个UIImageViews。 先谢谢了!     
已邀请:
请尝试一下
  - (UIImage *)combineImages{



    // Draw image1
    [theimageView.image drawInRect:CGRectMake(0,0, theimageView.image.size.width,theimageView.image.size.height)];

    // Draw image2
    [Birdie.image drawInRect:CGRectMake(Birdie.frame.origin.x, Birdie.frame.origin.y, Birdie.frame.size.width, Birdie.frame.size.height)];
    //have you added Birdie over theimageView if not than do this. If your size is already set as you want then there is no need for above two lines of drawInRect.
    UIGraphicsBeginImageContext(theimageView.bounds.size);
    [theimageView.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return resultingImage;
    }
谢谢,     

要回复问题请先登录注册