Ara*_*and 8 iphone transition view uinavigationbar uinavigationcontroller
我有一个具有中心视图的应用程序,每个视图都有两个视图.我想要左右两个导航栏按钮,它们将新的导航控制器从左侧或右侧推到视图上.
通过使用NavigationController的pushviewController:方法推送新视图来更改视图时,视图似乎从右侧滑入.我如何改变它从左边滑入?
当我们推动viewcontroller时,我已经完成了更改动画方向.你可以在这里改变动画类型[animation setSubtype:kCATransitionFromRight];
ViewController *elementController = [[ViewController alloc] init];
// set the element for the controller
ViewController.element = element;
// push the element view controller onto the navigation stack to display it
CATransition *animation = [CATransition animation];
[[self navigationController] pushViewController:elementController animated:NO];
[animation setDuration:0.45];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[elementController.view layer] addAnimation:animation forKey:@"SwitchToView1"];
[elementController release];
Run Code Online (Sandbox Code Playgroud)
我只是移动视图而不是使用导航控制器.
CGRect inFrame = [currentView frame];
CGRect outFrame = firstFrame;
outFrame.origin.x -= inFrame.size.width;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[newView setFrame:inFrame];
currentView setFrame:outFrame];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)