如何在 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];
}
但它也会随主视图一起滑动子视图,例如导航栏按钮项目、按钮等。如何防止子视图更改其位置 ?
i am using following code for navigating from one view to another view in iphone app.
-(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];
}
But it slides subviews like uinavigation bar button item,button etc also along with the main view.How to prevent subviews from changing their positions
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)