I've got two UIImageView: the first one is laying on the top of the other (eg. an overlay). I want now to take a screenshot of the whole thing. Note that before that step, I allow the user to change the overlay by panning,scaling and ROTATING it, so I must 开发者_JAVA技巧keep track of his editing.
So, here's the homework:
- rotating the context basing on the view's transform rotation value
- positioning on the origin, where the user finished to pan the overlay
- calculate the size of the overlay view (it's always a rectangle, however!)
I'm gonna merge them inside a similar piece of code:
UIGraphicsBeginImageContext...
...
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
but... what does "best fit" instead of the "..."?
Example code is well accepted! Thanks
UIGraphicsBeginImageContext(firstImage.size);
[firstImage drawAtPoint:CGPointMake(0,0)];
[secondImage drawAtPoint:CGPointMake(0,0)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
精彩评论