How to replicate the Scale Up Animation when an app starts regularly (push app icon on HomeScreen) on an iPhone

后端 未结 2 460
走了就别回头了
走了就别回头了 2020-12-29 00:23

i want to replicate the animation when an app starts on iPhone. There is the first view scaling up from 50 % to 100% i think. later I want to use this as a transition betwee

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 01:13

    You can apply a scale transform to the UIView and then animate it back to it's normal state.

    // Set the the view's scale to half
    [viewToScale setTransform:CGAffineTransformMakeScale(0.5,0.5)];
    
    // Set the transform back to normal (identity) in an animation when you're
    // ready to animate
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [viewToScale setTransform:CGAffineTransformIdentity];
    [UIView commitAnimations];
    

    The trick will be you will need to set the view to the smaller scale in a separate run cycle from the animation or you won't see the view animate. So you can set the smaller scale and then call -performSelector:withObject:afterDelay: to actually perform the animation.

提交回复
热议问题