在iPhone中导航到新页面
我是iPhone开发者的新手 单击按钮,我想导航到带有此动画的新页面UIViewAnimationTransitionFlipFromLeft 我该怎么做在iPhone中导航到新页面,iphone,animation,navigation,uibutton,buttonclick,Iphone,Animation,Navigation,Uibutton,Buttonclick,我是iPhone开发者的新手 单击按钮,我想导航到带有此动画的新页面UIViewAnimationTransitionFlipFromLeft 我该怎么做 -(void)btnClick{ [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.7]; [UIView setAnimationBeginsFromCurrentState:YES];
-(void)btnClick{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.7];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
[UIView commitAnimations];
}
当我点击btn动画发生,但我无法导航到新页面
任何帮助都将受到感谢 您没有指定要交换哪些视图。目前,您正在设置动画发生的位置以及动画的类型 你需要这样的东西
[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];
我建议您阅读本文档,因为我认为您并不完全理解ViewController和View之间的关系。在视图控制器和各个视图之间有不同的转换方式
在使用此方法的情况下,view1将是LicAppViewController.view,并且假设您的PlanPage是一个视图,那么view2就是PlanPage
viewController是您要导航到的页面
流行音乐:
写什么来代替view1和view2?我想从LicAppViewController页面导航到PlanPage[LicAppViewController removeFromSuperview];[self.view addSubview PlanPage];当我写这篇文章时,我在第一行得到警告,因为找不到+removefromsuperview方法,在第二行我得到了预期的错误:。你不能删除ViewController,你要删除的必须是它的视图,所以LicAppViewController.viewdude它正在工作,但当我在第二页中单击“上一步”按钮时,动画应该从右侧翻转,但它就像popViewController一样。我应该在哪里编写编辑?但我的后退按钮不是自定义的,它是导航控制器的一部分,所以,我应该在哪里添加?给我这个答案,我会接受你的ans.lol…。如果你想添加额外的代码,你需要自定义它。自定义,因为它不会对你的导航控制器造成任何伤害。在view2中的链接中编写代码,然后在弹出“添加动画”。
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];
[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];