0

我想向视图添加多个动画。我只能添加一个,...我不想连接

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kAnimationDuration];
//self.square.bounds = CGRectMake(0, 0, self.square.bounds.size.height, 200);
//self.transform = CGAffineTransformMakeScale(2, 1);


CGAffineTransform scaleTrans1 = CGAffineTransformMakeScale(2, 1);

self.transform = scaleTrans1;
[UIView commitAnimations];
4

2 回答 2

2

您可以使用 UIView 中的 animateWithDuration (在其任何变体中),只要您尝试动画的属性实际上是可动画的(查看UIView / Animations)。

例如:

[UIView animateWithDuration:1.0f
animations: ^ {
    self.square.bounds = CGRectMake(0, 0, self.square.bounds.size.height, 200);
    self.transform = CGAffineTransformMakeScale(2, 1);
}];

希望能帮助到你!

于 2013-03-07T21:11:32.763 回答
0

我确实喜欢这个及其工作

- (void)drawRect:(CGRect)rect
{    
    [UIView animateWithDuration:4.0f animations:^{
        self.transform = CGAffineTransformMakeScale(2, 1);
    } completion:^(BOOL finished){
        [UIView animateWithDuration:4.0f animations:^{
           self.transform = CGAffineTransformMakeScale(0.75, 1);
        } completion:^(BOOL finished){
            [UIView animateWithDuration:4.0f animations:^{
              self.transform = CGAffineTransformMakeScale(2, 1);  
            } completion:^(BOOL finished) {
                [UIView animateWithDuration:4.0f animations:^{
                    self.transform = CGAffineTransformMakeScale(0.75, 1);
                }];
            }];
        }];
    }];


}
于 2013-03-10T18:29:59.580 回答