在视图控制器之间提供转换
我是iphone应用程序开发的新手。 我有一个mainmenu视图控制器,它有一个登录按钮。 一旦我通过调用这个在视图控制器之间提供转换
LoginController *lc2=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:lc2];
[self presentModalViewController:navigationController animated:YES];
点击登录按钮i显示下一个登录视图控制器但是,这种观点似乎来自屏幕的右侧,我想提供像,卷曲或翻转效果,当我从一个视图控制器导航到另一个。 请帮助我的代码来提供这种效果
也许这样的事情,从模态视图控制器的演示代码分离动画代码:
LoginController *lc2=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];
UINavigationController *navigationController =
[[UINavigationController alloc]initWithRootViewController:lc2];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];
[self presentModalViewController:navigationController animated: NO];
[UIView commitAnimations];
我十分luvieere同意,但我认为,视图中
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];
规定必须是容器视图,在至极子视图将被添加或删除,我不知道,如果是navigationController.view容器视图。我会尝试不同的组合,包括self.view,self.view.superview(这取决于“presentModalViewController”的行为)。
感谢您的及时回复..但我看到的按钮或标签显示效果,我希望整个页面,以显示效果 – shreedevi 2009-11-14 10:52:07
检查来自Apple SDK的节拍器示例。它在这里发布的代码太多了,所以我想指出你的例子。 基本思想是使用父视图控制器来处理两个或多个子视图控制器之间的转换。这包括建立一个协议,顺利地让子视图控制器通知根视图控制器关于要做的转换。有点模糊,我知道 - 所以请跳入示例代码。
非常感谢谢谢! 它的工作.... – shreedevi 2009-11-14 17:25:18
感谢您的及时回复..但我看到的按钮或显示效果的标签,我希望整个页面,以显示效果 – shreedevi 2009-11-14 09:44:46