本文介绍了iPhone向左推View Controller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个应用程序,该应用程序具有中心视图,并且每侧都有两个视图.我想使用左右两个导航栏按钮,它们将一个新的导航控制器从左侧或右侧推到视图上.
I have an app that has a centre view with two views off to each side of it. I want to have two navigation bar buttons, left and right which push a new navigation controller onto the view from the left or the right.
当使用NavigationController的pushviewController:方法通过推入新视图来更改视图时,该视图似乎从右侧滑入.我如何更改它以从左侧滑入?
When you change views by pushing a new view using the pushviewController: method of NavigationController, the view appears to slide in from the right. how do i change this to slide in from the left?
推荐答案
我将移动视图,而不是使用导航控制器.
Instead of using a navigation controller, I would just move the view.
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];
这篇关于iPhone向左推View Controller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!