Code:
Rootviewcontroller.m
#import "RootViewController.h" @interface Rootviewcontroller () @end @implementation rootviewcontroller-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{self = [Super Initwithnibname: Nibnameornil Bundle:nibbundleornil]; if (self) {//Custom initialization} return to self;} -(void) viewdidload{[Super Viewdidload]; Do any additional setup after loading the view. Initialize the background map [self initbackgroundview];} #pragma-mark-functions-(void) initbackgroundview{[email protected] "The realization of the effect of book-flipping"; Self.view.backgroundcolor=[uicolor Redcolor]; UpButton UIButton *upbutton = [UIButton buttonwithtype:uibuttontypecustom]; Upbutton.frame = CGRectMake (20, 420, 50, 26); Upbutton.backgroundcolor=[uicolor Bluecolor]; [UpButton settitle:@ "up" forstate:uicontrolstatenormal]; [UpButton addtarget:self Action: @selector (Doclickupbutton) forcontrolevents:uicontroleventtouchupinside]; [Self.view Addsubview:upbutton]; //downbutton UIButton *downbutton = [UIButton buttonwithtype:uibuttontypecustom]; Downbutton.frame = CGRectMake (250, 420, 50, 26); Downbutton.backgroundcolor=[uicolor Bluecolor]; [DownButton settitle:@ "Down" forstate:uicontrolstatenormal]; [DownButton addtarget:self Action: @selector (Doclickdownbutton) forcontrolevents:uicontroleventtouchupinside]; [Self.view Addsubview:downbutton];} #pragma-mark-doclickaction-(void) doclickupbutton{[UIView Beginanimations:nil Context:nil]; [UIView setanimationduration:0.7]; [UIView Setanimationtransition:uiviewanimationtransitioncurldown ForView:self.view Cache:yes]; [UIView commitanimations];} -(void) doclickdownbutton{[UIView Beginanimations:nil Context:nil]; [UIView setanimationduration:0.7]; [UIView Setanimationtransition:uiviewanimationtransitioncurlup ForView:self.view Cache:yes]; [UIView commitanimations];} -(void) didreceivememorywarning{[Super didreceivememorywarning]; Dispose of any resourcesThat can is recreated.} @end
The implementation of "code note" book-Flipping effect