iOS View zoom display animation effect

Source: Internet
Author: User

Effect: View from large-small zoom display/small-large (only proportional problem)


Method 1: When you show the view directly,
Add the following code to Viewcontroller or view when it appears.

Self.view.transform = Cgaffinetransformmakescale (1.0f, 1.0f);//The view to be displayed is displayed in normal proportions
[UIView Beginanimations:nil Context:uigraphicsgetcurrentcontext ()];
[UIView Setanimationcurve:uiviewanimationcurveeaseinout]; InOut means to start an animation when entering and going out
[UIView setanimationduration:0.5f];//Animation time
Self.view.transform=cgaffinetransformmakescale (0.01f, 0.01f);//show the view to the minimum until it disappears
[UIView commitanimations]; Start animation
Conversely, if you want to display the effect from small to large, swap the scale
Uigraphicsgetcurrentcontext is rich in stuff.


——————————————————————————————————————————


Method 2.push a Viewcontroller:
Add the following code to the push method is OK
    catransition *mytranstiton = [Catransition animation];
    mytranstiton.duration = 0.5;
    mytranstiton.type = kcatransitionfade;   
     Mytranstiton.subtype = kcatransitionfromtop;   
    [ Self.view.superview.layer  addanimation:mytranstiton forkey:nil];   
     mainviewcontroller * _mainviewcontroller=[[mainviewcontroller alloc] init];
    [self Presentmodalviewcontroller:_mainviewcontroller Animated:NO];

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.