This is my code, i'm trying to drag and drop a card which will animate on touchesBegan, but the animationImages are larger than the initial card image before touches begin.
How can i change the UIImageView to accomdate the animateImages sizes?
cardAnimationArray is an array with 19 images xxx1.png, xxx2.png... which have various sizes.
cardMovedImage is the last image in the series of 19 images. Thank you in advance!!
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
CGPoint pt = [[touches anyObject] locationInView:self.superview];
self.center = pt;
self.animationImages = [NSArray arrayWithArray:cardAnimationArray];
[cardAnimationArray release];
[self setAnimationRepeatCount:1];
self.animationDuration= 1;
[self startAnimating];
self.image = [UIImage imageNamed:cardMovedImageName];
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
CGPoint pt = [[touches anyObject] locationInView:self.superview];
CGRect frame = [self frame];
frame.origin.x += pt.x - self.center.x;
frame.origin.y += pt.y - self.center.y;
[self setFrame: frame];
}