我想在转换幻灯片的视图控制器中切换视图。我在网上找到了以下代码。幻灯片UIView转换
// 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:PlayingView];
PlayingView.frame = CGRectMake(0, 0, 320, 460);
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:1];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
这个代码字很好,但是底部有一个非常恼人的白色条!我发现代码:
PlayingView.frame = CGRectMake(0, 0, 320, 460);
这似乎不工作。
所以,链接到的地方,我发现http://www.iphonedevsdk.com/forum/iphone-sdk-development/13427-uiview-slide-transition.html
我很确定这段代码不是问题。 – Dair 2011-04-09 00:31:54
@anon你认为那是什么? – 2011-04-09 00:33:41