2015-02-10 44 views
1

我有一个动画显示UIView像下拉菜单一样缓慢的问题。我尝试了下面的代码,但它太快了。慢下来UIView动画像iOS中的下拉菜单

你能帮我改正吗?谢谢。

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.5]; 

blockView.frame = CGRectMake(newFrame.origin.x, newFrame.origin.y , newFrame.size.width, newFrame.size.height + *h); 


[blockView addSubview:dropDownView]; 
[UIView commitAnimations]; 

我想让UIView像Expedia应用一样慢下来。请给我一些建议。

在此先感谢。

回答

4

只需增加AnimationDuration,这取决于你想让你的下拉速度有多慢。

〔实施例:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:5.5]; 

self.blackView.frame = CGRectMake(newFrame.origin.x, newFrame.origin.y , newFrame.size.width, newFrame.size.height + h); 

[self.blackView addSubview:self.dropDownView]; 

[UIView commitAnimations] 

如果妳觉得你dropDownView附动画变得完整意味着u可以使用下面的代码在动画完成的一端连接到dropDownView连接之前。

[UIView animateWithDuration:5.5 
       animations:^{ 
        self.blackView.frame = CGRectMake(newFrame.origin.x, newFrame.origin.y , newFrame.size.width, newFrame.size.height + h); 
       } 
       completion:^(BOOL finished){ 
        [self.blackView addSubview:self.dropDownView]; 
    }]; 
0

使用选项的UIView动画

[UIView animateWithDuration:0.5 
        delay:0.0 
       options:UIViewAnimationOptionCurveEaseOut 
      animations:^{ 
       // ... do stuff here 
      } completion:NULL];