[英]how to stop animation and sliding subviews while flipleft animation in iphone?
我正在使用以下代码在iPhone应用程序中从一个视图导航到另一个视图。
-(IBAction)navigateToInfo:(id)sender
{
InfoDetailViewController *vc=[[InfoDetailViewController alloc]init];
//[self.navigationController pushViewController:vc animated:YES];
// [vc release];
self.view.backgroundColor=[UIColor blackColor];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
for(UIView *view1 in self.view.subviews)
{
[view1 removeFromSuperview];
}
[self.view addSubview:vc.view];
[UIView commitAnimations];
}
-(IBAction)navigateToMainScreen:(id)sender
{
MainVC *vc=[[MainVC alloc]init];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
[UIView setAnimationDuration:1.0];
self.view.backgroundColor=[UIColor blackColor];
for(UIView *view1 in self.view.subviews)
{
[view1 removeFromSuperview];
}
[self.view addSubview:vc.view];
[UIView commitAnimations];
}
但是它会与主视图一起滑动子视图,如导航栏按钮项,按钮等。如何防止子视图改变位置?
This solved the issue.
-(IBAction)navigateToInfo:(id)sender
{
InfoDetailViewController *vc=[[InfoDetailViewController alloc]init];
self.view.backgroundColor=[UIColor blackColor];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view.window cache:YES];
[UIView commitAnimations];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.