ios - 打开和关闭表单动画

ios - 打开和关闭表单动画,第1张

这个动画在iOS中是否可行,是否有任何第三方API?

ios - 打开和关闭表单动画,enter image description here,第2张

最佳答案:

1 个答案:

答案 0 :(得分:1)

使用嵌套动画计算自己

-(void)viewDidLoad
{

    expandiView = [[UIView alloc] initWithFrame:CGRectMake(137, 269, 30, 2
                                                            )];
    expandiView.backgroundColor = [UIColor redColor];
    [self.view addSubview:expandiView];
    expandiView.hidden=YES;

}

-(IBAction)Expand:(id)sender {

    expandiView.hidden=NO;


    [UIView animateWithDuration:0.5f
                     animations:^{

                         expandiView.frame = CGRectMake(60, 269, 200, 2);
                     }
                     completion:^(BOOL finished) {
                         [UIView animateWithDuration:1
                                          animations:^{
                                              expandiView.frame = CGRectMake(60, 269, 200, 100);

                                          }];
                     }];

}





-(IBAction)collapse:(id)sender {



    [UIView animateWithDuration:0.5f
                     animations:^{
                         expandiView.frame = CGRectMake(60, 269, 200, 2);

                     }
                     completion:^(BOOL finished) {
          [UIView animateWithDuration:0.5f animations:^{
                             expandiView.frame = CGRectMake(137, 269, 30, 2);
                         } completion:^(BOOL finished) {
                             expandiView.hidden=YES;
                         }];
                     }];


}
本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复