我是iPhone开发人员的新手,
点击按钮,我想导航到包含此动画的新页面UIViewAnimationTransitionFlipFromLeft
我该怎么做?
-(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动画时,我无法导航到新页面。
任何帮助都会受到欢迎!
答案 0 :(得分:4)
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是您要导航到的页面。
流行:
[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];
答案 1 :(得分:3)
您没有指定要交换的视图。目前,您只是设置动画发生的位置以及动画的类型。
你需要这样的东西。
[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
关系。在ViewControllers
和个人views
之间有不同的转换方式。
如果您使用此方法,则view1
将为LicAppViewController.view
,并假设您PlanPage
为视图,则view2
仅为PlanPage
。< / p>