[Code Note] iOS-Transition animation, note ios-transition

Source: Internet
Author: User

[Code Note] iOS-Transition animation, note ios-transition

1. Engineering Drawing.

Ii. Code.

RootViewController. h

#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end

 

RootViewController. m

# Import "RootViewController. h "# import" FirstViewController. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. self. title = @ "Homepage"; self. view. backgroundColor = [UIColor redColor];/* transition effect fade // cross fade transition (transition direction not supported) push // The New View pushes the old view out of moveIn // The New View is moved to the old view and reveal // removes the old view, show the following new view cube // cube tumble effect oglFlip // top, bottom, left, and right flip effect suckEffect // contraction effect, such as a piece of cloth being drawn (transition direction not supported) rippleEffect // drip effect (transition direction not supported) pageCurl // page up effect pageUnCurl // page down effect cameraIrisHollowOpen // camera lens opening effect (transition direction not supported) cameraIrisHollowClose // camera lens Closing effect (transition direction not supported) * // * transition direction fromRight; fromLeft; fromTop; fromBottom; */}-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {CATransition * transition = [CATransition animation]; // animation time control transition. duration = 0.3f; // the speed at which the animation starts and ends. timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut]; // whether to proxy transition. delegate = self; // After the animation is executed, it is automatically removed. The default value is true transition. removedOnCompletion = NO; // various animation effects transition. type = kCATransitionMoveIn; // specifies the animation direction. subtype = kCATransitionFromTop; FirstViewController * viewCon = [[FirstViewController alloc] init]; [self. navigationController pushViewController: viewCon animated: NO]; // Add the Code [self. navigationController. view. layer addAnimation: transition forKey: nil];}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}

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.