UIImageView滑过

时间:2012-03-29 06:06:07

标签: ios5 uiimageview cocos2d-iphone xcode4.2

如何创建UIImageViews幻灯片?我在View的两个视图中都有一个按钮和两个UIImageViews,当按下按钮时,两个UIImageViews应该从两侧滑过视图。有些身体可以给我一个开始吗?

1 个答案:

答案 0 :(得分:1)

[UIView animateWithDuration:durationOfAnimation animations:^{
    CGRect imageView1Frame = imageView1.frame;
    imageView1Frame.origin.x += 100 //or whatever number of pixels you want to slide them
    imageView1.frame = imageView1Frame;

    CGRect imageView2Frame = imageView2.frame;
    imageView2Frame.origin.x += 100 //or whatever number of pixels you want to slide them
    imageView2.frame = imageView2Frame;
}];

durationOfAnimation在几秒钟内您需要多长时间。