Opening and closing form animation

97 views Asked by At

Is this animation possible in iOS, any third party API's for that?

enter image description here

1

There are 1 answers

1
Syed Ismail Ahamed On BEST ANSWER

Figured out myself with nested animations

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


}