What exactly I have to do is I have 2 images one is mask and another is Photo. Mask.png is just the layout of the person and Photo.png is the image of the person in the position as per the mask.png.
Now the main problem is I want the Photo.png to be resized and moved in such a way that it can be adjusted in that Mask.png.
below is the example of mask and Photo
Now I want that red color must come on the below two legs of the star for that I need to move the Flowers image as per my convininece and then save them whole as one Image. Im my case theres a outlay of person instead of star and the Photo of person instead of flowers image.
Kindly help... Any help would realy be appre开发者_Python百科ciated.
Thanks in advance.
I was recently working on something similar. You could override touchesMoved, but I would recommend using UIGestureRecognizers which you would add to the UIImages themselves.
UIRotationGestureRecognizer *rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];
[rotationRecognizer setDelegate:self];
[someImageView addGestureRecognizer:rotationRecognizer];
then implement some rotate: method
There is a sample project by apple called Touches which should have all you need to get started.
Hope this helps.
At first you have to decide how to let the user move and resize your image in a user-friendly manner. If your image were rectangular, you could decide for resizing when the user drags on one of the edges and for moving when he drags from a point inside the rectangle.
You might do the same with your star shape, but I doubt that it will be intuitive enough for the users.
Then you can implement moving and dragging by overriding touchesMoved
, checking whether the first touch is inside your shape (or on the edge), and move (or resize) to the last touch.
You will find that the calculations are not so easy, but that is the only way [I know] to do it.
精彩评论