现在的位置: 首页 > 综合 > 正文

iphone视图之间的过度

2016年08月29日 ⁄ 综合 ⁄ 共 722字 ⁄ 字号 评论关闭
//
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

抱歉!评论已关闭.