我有两张图片,第一张是前景,第二张是背景。我想将它们合并成一个图像。我希望能够将它们拖放frontImage
到唯一的background
可能吗?
1 回答
This can be super easy.
For example - You have a parent UIView and two image views:
UIView *_baseView; //as big as the screen.
UIImageView *_backgroundImageView; //as a subview on _baseView
UIImageView *_frontImageView; //as a subview on _baseView
Then You implement some kind of UIImageView movement by finger (for example How do you make an image follow your finger in objective-c? or search for something similar to know how to move UIView objects around if You don't know yet how).
And - once You release Your finger - You can take a screenshot from _baseView and get the image, where two subview ImageViews are combined in a way.
(How Do I Take a Screen Shot of a UIView? or search something similar).
If You don't like, that You have to take screenshot of _baseView, You could also add frontImageView as a subview to background image view and get the screenshot from backgroundImageView.
Hope this idea helps.