iphone - iPhone uiimageview 中的跑马灯效果

标签 iphone uiimageview marquee

如何在UIImage中实现跑马灯效果动画。

我有一张云的图像(320*480)。我需要从右到左连续地对其进行动画处理,而不会出现任何滞后和消失。下面是一个 html 示例。

http://www.quackit.com/html/codes/html_marquee_code.cfm

从上往下数第二个(连续滚动文本:)。

请帮忙

最佳答案

UIImage *clouds = [UIImage imageNamed:@"Clouds"];
UIImageView *cloudView = [[UIImageView alloc] initWithImage:clouds];
CGRect origin = CGRectMake(320, 0, clouds.size.width, clouds.size.height);
CGRect destination = CGRectMake(0, 0, clouds.size.width, clouds.size.height);
cloudView.frame = origin;
[self.view addSubview:cloudView];
[UIView animateWithDuration:5 delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear animations:^{
    cloudView.frame = destination;
} completion:nil];

关于iphone - iPhone uiimageview 中的跑马灯效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12613982/

相关文章:

ios - 如何关闭 PushViewController?

ios - UITableview单元格向下滚动不平滑

android - 即使尝试了所有方法,我也无法在 Android 中获得字幕效果

iphone - 在 iTunes 中向我的应用添加评论或星标

objective-c - 时钟指针旋转问题

iphone - 如何将 UIView 图像 UIImageView 设置为背景?

iphone - 从 appdlication 中的缓存目录加载图像在 App 委托(delegate)中完成方法

javascript - 如何检查 jQuery 插件和函数是否存在?

php - 突发新闻显示,在选框代码中带有类别库

iphone - 在 iPhone 上模拟发送短信