【发布时间】:2009-12-19 14:04:03
【问题描述】:
这是我的代码,我正在尝试拖放一张将在 touchesBegan 上进行动画处理的卡片,但动画图像大于触摸开始前的初始卡片图像。
如何更改 UIImageView 以适应 animateImages 大小?
cardAnimationArray 是一个包含 19 幅图像 xxx1.png、xxx2.png... 的数组,它们的大小各不相同。
cardMovedImage 是 19 张图片系列中的最后一张。 提前谢谢你!
- (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];
}
【问题讨论】:
-
UIImageView 比我的 animationImages 小...
标签: iphone xcode iphone-sdk-3.0 xcode3.2