iOS custom scene toggle animation.

Source: Internet
Author: User

In iOS we can use Storyborad and segue to implement our own scene switching animations, and the new project uses the single View application template and is named Mycustomsegue.

Use storyboard to hold out another uiviewcontroller and set the two controller's view color and set the segue of the jump page to custom

    

  

Set up

  

New file Mycustomchangesegue and re-perform method

  

1 @implementationMycustomchangesegue2 3-(void) Perform4 {5Uiviewcontroller *sourceviewcontroller =Self.sourceviewcontroller;6Uiviewcontroller *destviewcontroller =Self.destinationviewcontroller;7     8[UIView animatewithduration:1animations:^{9Cgpoint CenterPoint =SourceViewController.view.center;TenSourceViewController.view.frame = CGRectMake (Centerpoint.x,centerpoint.y,0,0); OneSourceViewController.view.alpha =0; A} completion:^(BOOL success) { -UIView *destview =Destviewcontroller.view; -SourceViewController.view.hidden =YES; the [[Sourceviewcontroller.view Superview] addsubview:destview]; -CGRect Destrect =Destview.frame; -Cgpoint CenterPoint =Destview.center; -Destview.frame = CGRectMake (Centerpoint.x,centerpoint.y,0,0); +Destview.alpha =0; -[UIView animatewithduration:0.3animations:^{ +Destview.frame =Destrect; ADestview.alpha =1; at} completion:^(BOOL success) { -Destview.alpha =1; -Destview.frame =Destrect; -SourceViewController.view.hidden =NO; - [Sourceviewcontroller presentviewcontroller:destviewcontroller animated:no Completion:nil]; -         }]; in     }]; - } to  + @end

Run the program click the Go button and we'll see a magical scene!

  

iOS custom scene toggle animation.

Related Article

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.