how to exchange one imageview with another imageview
i am displaying 3 images on image views.
i am getting image position by using the fallowing code.
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
// get touch event
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
NSLog(@"%f %f",touchLocation.x,touchLocation.y);
here in console i got the image positions.
Now what i need is when ever imageview is dragged over the imageview2 i need to exchange imageview2 in the place of image view and imageview in the place of imageview2.
can any one please help m开发者_开发问答e.
Thank u in advance.
I wouldn't be replacing the entire imageView2, I would just change the image in imageView2 to the image in imageView.
First, establish that imageView2 is on top of imageView. Second, create an animation block and remove the image from imageView2, change the image in the imageView to the old image from imageView2, and possibly add a nice smooth transition. I would highly recommend a transition animation, it makes the action much more fluid. Use the positions of the imageViews, it wouldn't matter where the image was placed, it would animate as long as it was over top of imageView2.
Remember, there's nothing wrong with faking it. As long as it looks and acts like you want it to, then it works.
精彩评论