Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to animate view zoom and bounce like popup in objectiveC

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 795
    Comment on it

    This blog includes zoom and bouncing In animation on view. If we want to present view like popUp alert then it include two animation-

    first is zoom and second is bouncing.These two animation can be achieved by affinity transform.Scaling, rotation, and translation are the most commonly used manipulations supported by affine transforms.

     

    Here is the code-

     

    
    //Initialize a view with frmae or you can use any of the view
    UIView *popUpView=[[UIView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    
    //set background color of view
    [popUpView setBackgroundColor:[UIColor blueColor]];
    
    //transform the popup in constant i.e identity
    popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
    
    //add as a subview
    [self.view addSubview:popUp];
    
    [UIView animateWithDuration:0.3/1.5 animations:^{
        popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.3/2 animations:^{
            popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.3/2 animations:^{
                popUpView.transform = CGAffineTransformIdentity;                            
            }];
        }];
    }];
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: