[Code note] the implementation of the page turning effect, and the code note page turning
I ,.
2. Engineering Drawing.
3. 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. // set the background color self. view. backgroundColor = [UIColor redColor]; self. title = @ "root";}-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {// click root, that is, anything in red, the page is flipped like a book flip. Flip to first, that is, the blue interface. When you click "root" on the top of the page, the page will go to the "root" page again, that is, the Red Page. FirstViewController * firstView = [[FirstViewController alloc] init]; UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController: firstView]; nav. modalTransitionStyle = UIModalTransitionStylePartialCurl; [self. navigationController presentViewController: nav animated: YES completion: nil];}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}
FirstViewController. h
#import <UIKit/UIKit.h>@interface FirstViewController : UIViewController@end
FirstViewController. m
# Import "FirstViewController. h "@ interface FirstViewController () @ end @ implementation FirstViewController-(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. // set the background color self. view. backgroundColor = [UIColor blueColor]; self. title = @ "first";}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}