[英]navigate to new page in iPhone
I am new to iPhone developer, 我是iPhone开发人员的新手,
On click of button, i want to navigate to a new page with this animation, UIViewAnimationTransitionFlipFromLeft
单击按钮时,我想使用此动画UIViewAnimationTransitionFlipFromLeft
导航到新页面
How should i do this ? 我应该怎么做?
-(void)btnClick{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
[UIView commitAnimations];
}
When i click on btn Animation happens but i am unable to navigate to new page. 当我单击btn时,发生动画,但是我无法导航到新页面。
Any Help Will be Appriciated ! 任何帮助都将适用!
ViewController *viewController = [[ViewController alloc]initWithNibName:@"View" bundle:nil];
[UIView beginAnimations:@"Flip" context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationCurve:UIViewAnimationOptionCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:viewController animated:YES];
[UIView commitAnimations];
[viewController release];
viewController is the page u want to navigate to. viewController是您要导航到的页面。
Pop: 流行:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];
You aren't specifying which views you want to swap in and out. 您没有指定要交换的视图。 At the moment you are just setting where the animation happens and what type of animation it is. 目前,您只需要设置动画发生的位置以及动画的类型。
You need something like this. 您需要这样的东西。
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
[view1 removeFromSuperview];
[self.view addSubview view2];
[UIView commitAnimations];
I recommend reading this documentation as I dont think you understand the ViewController
and View
relationship entirely. 我建议您阅读本文档,因为我认为您不完全了解ViewController
和View
关系。 There are different ways of transitioning between ViewControllers
and individual views
. 在ViewControllers
和各个views
之间有不同的转换方式。
Just in the case of using this method your view1
would be LicAppViewController.view
and assuming you PlanPage
is a view then view2
is just PlanPage
. 就在使用此方法的情况下,您的view1
将是LicAppViewController.view
并假设您的PlanPage
是一个视图,那么view2
就是PlanPage
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.