How can I animate zoom in / zoom out on iOS using Objective C?

后端 未结 4 2037
情歌与酒
情歌与酒 2021-01-14 06:14

I\'m looking to replicate the zoom in / zoom out animations so common in iOS applications (example #1, #2). I am specifically looking for a source that can provide some comm

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-14 07:09

    Use following code for zoom in and zoom out animation.

    For Zoom In:

    - (void)popUpZoomIn{
    popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
    [UIView animateWithDuration:0.5
                     animations:^{
                         popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
                     } completion:^(BOOL finished) {
    
                     }];
    }
    

    For Zoom Out:

    - (void)popZoomOut{
    [UIView animateWithDuration:0.5
                     animations:^{
                         popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
                     } completion:^(BOOL finished) {
                         popUpView.hidden = TRUE;
                     }];
    }
    

提交回复
热议问题