打开和关闭表单动画

Opening and closing form animation

此动画是否可以在 iOS 中使用,任何第三方 API 都可以吗?

用嵌套动画弄清楚自己

-(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;
                         }];
                     }];


}