How can I make sure that the images that are within my scroller will be able to be dragged from the scroller to the imageview?
I also would like to implement a 'wiggle'. When a user taps an image within the scroller the images wiggles and follows the touch of the user to the other view. I started with making a subview, however when the image displays itself on the normal view its location changes to be on top of the view instead of on the bottom.
How can I make sure that when I touch an image:
- the image wiggles
- the images go to another view.
- the images follow my touch position
(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
image1.userInteractionEnabled = YES;
[self.view addSubview:image1];
if([touch view] == image1){
image1.center = location;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.14];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:1000000];
image1.transform = CGAffineTransformMakeRotation(69);
image1.transform = CGAffineTransformMakeRotation(-69);
[UIView commitAnimations];
image1.center = CGPointMake(30,870);
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *) event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
if([touch view] == image1){
image1.userInteractionEnabled = YES;
[self.view addSubview:image1];
image1.center = location;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.14];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:1000000];
image1.transform = CGAffineTransformMakeRotation(69);
image1.transform = CGAffineTransformMakeRotation(-69);
[UIView commitAnimations];
}