使用gif进行自定义转换

时间:2014-02-08 18:34:22

标签: objective-c ios7 uiviewcontroller

我正在开发一款应用程序,我需要使用按钮转换到车辆的每一侧。我想为每个过渡设置动画,以便显示车辆从一侧转向另一侧的gif。我的应用程序可以在以下github地址找到:https://github.com/rileylloyd24/Engine-Master。在引擎131下,您将在底部看到2个按钮。我想每个按钮左右旋转视图到卡车的前后,用gif动画。如果有更好的方法来做这个而不是gif,请告诉我你的想法。

1 个答案:

答案 0 :(得分:0)

我认为你应该使用一组图像代替gif。

-(void)animateButtonWithTimer:(float)timer{

self.btnRecordingIndicator.imageView.animationImages =
[NSArray arrayWithObjects:[UIImage imageNamed:@"rec-on"],
 [UIImage imageNamed:@"rec-off"],
 nil];//add more image to animate
self.btnRecordingIndicator.imageView.animationDuration = timer; //whatever you want (in seconds)
[self.btnRecordingIndicator.imageView startAnimating];
}