UIImageView *image = [[UIImageView alloc] initWithFrame:self.view.bounds];
image.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"BluePin.png"],
[UIImage imageNamed:@"GreenPin.png"],
[UIImage imageNamed:@"RedPin.png"],
[UIImage imageNamed:@"YellowPin.png"],
nil];
image.animationRepeatCount = 0;
image.animationDuration = 1.0;
[image startAnimating];
[image setFrame: CGRectMake(point.x-(image.bounds.size.width/2), point.y- (image.bounds.size.width/2), image.bounds.size.width, image.bounds.size.height)];
[self.view addSubview: image];
[UIView animateWithDuration:2.0 delay:1.0 options:UIViewAnimationOptionCurveLinear animations:^{
[image setAlpha:0.0];
} completion:^(BOOL finished) {
[image removeFromSuperview];
}];
图像太大了,需要原始大小 基本上创建用户触摸的图像动画,并在x秒后逐渐消失
答案 0 :(得分:0)
您希望图片视图与其包含的图片尺寸相同,对吗?
UIImage *image = [UIImage imageName:@"BluePin.png"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,image.size.width,image.size.height];
请注意,我使用的是与您不同的变量命名方案,以区分图像和图像视图。