Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 设置图像动画_Iphone_Objective C_Iphone Sdk 3.0 - Fatal编程技术网

Iphone 设置图像动画

Iphone 设置图像动画,iphone,objective-c,iphone-sdk-3.0,Iphone,Objective C,Iphone Sdk 3.0,我正在创建一个游戏,因为我想使用一些动画,但我对动画不熟悉。 我想创建一个图像,只要我点击imageview,图像就会像一个球一样反弹,那么有可能吗???图像是为游戏预定义的。它必须在触摸开始事件发生后出现,有人能帮我吗??? 当做 病毒性。你可以像 imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease]; imageview.image = [[UIImage imageNamed

我正在创建一个游戏,因为我想使用一些动画,但我对动画不熟悉。 我想创建一个图像,只要我点击imageview,图像就会像一个球一样反弹,那么有可能吗???图像是为游戏预定义的。它必须在触摸开始事件发生后出现,有人能帮我吗??? 当做
病毒性。

你可以像

imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease];
    imageview.image = [[UIImage imageNamed: [NSString stringWithString:name]]autorelease];
    [self.view addSubview:imageview];
    imageview.frame = CGRectMake(imageview.frame.origin.x, (imageview.frame.origin.y), imageview.frame.size.width, imageview.frame.size.height);
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    //[UIView setAnimationWillStartSelector:@selector(Transform2)];


    [UIView setAnimationDuration:k_AnimateTime];

    [UIView setAnimationBeginsFromCurrentState:YES];
    //[UIView setAnimationDidStopSelector:@selector(increaseCount)];
    imageview.frame = CGRectMake(imageview.frame.origin.x - Ex, (imageview.frame.origin.y - Ey), imageview.frame.size.width, imageview.frame.size.height);
    [UIView commitAnimations];

这将移动您的图像从一个坐标到另一个坐标动画。。。设置适当的坐标,使其看起来像弹跳效果…

这一问题的答案相当复杂。你需要阅读计算机动画或游戏编程。如果你能想象,那么它几乎可以被编码,你尝试过什么代码?我没有添加任何动画代码,现在我一接触图像视图就显示简单的值,但我想要一些不同的图像动画。