@ Interface rootviewcontroller () {uiview * view1; uiview * view2; int flag;} @ end @ implementation rootviewcontroller-(void) viewdidload {[Super viewdidload]; flag = 1; uibutton * button = [[uibutton alloc] initwithframe: cgrectmake (130, 65, 50, 35)]; [Button settitle: @ "click" forstate: uicontrolstatenormal]; [Button settitlecolor: [uicolor greencolor] forstate: uicontrolstatenormal]; [Button addtarget: Self action: @ selector (click) forcontrolevents: uicontroleventtouchupinside]; [self. view addsubview: button]; view1 = [[uiview alloc] initwithframe: cgrectmake (0,100,320,480)]; view1.backgroundcolor = [uicolor graycolor]; view2 = [[uiview alloc] initwithframe: cgrectmake (0,100,320,480)]; view2.backgroundcolor = [uicolor orangecolor];}-(void) Click {[uiview beginanimations: Nil context: Nil]; [uiview setanimationduration: 0.6f]; [uiview setanimationtransition: uiviewanimationtransitionflipfromleft forview: Self. view cache: No]; If (flag = 1) {[self. view addsubview: view1]; flag = 2;} else if (flag = 2) {[self. view addsubview: view2]; flag = 1;} [uiview commitanimations];}