【发布时间】:2012-02-18 10:37:35
【问题描述】:
我正在使用以下代码在 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];
}
但它也会与主视图一起滑动 uinavigation bar button item、button 等子视图。如何防止子视图改变它们的位置 ?
【问题讨论】:
标签: iphone animation subview flip