当实际加载栏向右移动时,如何在向左移动的栏内的条形图中制作动画

时间:2016-12-06 03:15:26

标签: ios objective-c animation

基本上我想制作类似于这个gmail栏http://i.stack.imgur.com/sYWhj.gif的东西。

现在我能够制作整个栏并使其进步

这些是3个视图属性。

@property (nonatomic, readwrite, strong) UIView *progressBarView;
@property (nonatomic, readwrite, strong) UIImageView *progressBarBackground;
@property (nonatomic, readwrite, strong) UIImageView *progressBar;

我在progressBarView中添加progressBarBackground和progressBar作为子视图。

对于酒吧进度动画我只使用

CGRect frame = self.progressBar.frame;
frame.size.width = MAX(kProgressBarMinWidth, kProgressBarWidth * self.progress);
[UIView animateWithDuration:duration
                 animations:^{
                     self.progressBar.frame = frame;
                 }];

但我在gif中添加左到右动画时遇到问题。谁知道怎么做?

1 个答案:

答案 0 :(得分:0)

我认为这是一种基于图案的颜色填充,然后为图案的原点设置动画。请查看UIColor类方法colorwithPatternImage