- // 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.codesnippet.cn/detail/241020136638.html
来源: http://www.codesnippet.cn/detail/241020136638.html