DropDown Menu Animation

@interface ViewController ()
{
    BOOL Condi;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    viewPOPDown.frame = CGRectMake(viewPOPDown.frame.origin.x, viewPOPDown.frame.origin.y, viewPOPDown.frame.size.width, 0);
}

- (IBAction)ActionDown:(id)sender
{
    
    if (Condi == false)
    {
        viewPOPDown.hidden = NO;
        
        [UIView animateWithDuration:0.3f animations:^{
            viewPOPDown.frame =
            CGRectMake(viewPOPDown.frame.origin.x,
                       viewPOPDown.frame.origin.y,
                       viewPOPDown.frame.size.width,
                       300);
            Condi = true;

        }];
        
        
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);
        
    }
    else if (Condi == true)
    {
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);

        [UIView animateWithDuration:0.3f animations:^{
            viewPOPDown.frame =
            CGRectMake(viewPOPDown.frame.origin.x,
                       viewPOPDown.frame.origin.y,
                       viewPOPDown.frame.size.width,
                       0);
            Condi = false;
        }];
        
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s