// get the view that's currently showing UIView *currentView = self.view; // get the the underlying UIWindow, or the view containing the current view view UIView *theWindow = [currentView superview]; // remove the current view and replace with myView1 [currentView removeFromSuperview]; [theWindow addSubview:view1]; // set up an animation for the transition between the views CATransition *animation = [CATransition animation]; [animation setDuration:0.5]; [animation setType:kCATransitionPush]; [animation setSubtype:kCATransitionFromRight]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];*/ //该代码片段来自于: http://www.sharejs.com/codes/objectc/3901