我有一个在应用程序委托中创建的标签栏。通过从标签栏中加载的其中一个视图调用操作表单按钮,我打开帮助屏幕,但加载后有一个抽搐动作。
请原谅我非正式地说话。过去几个小时我一直在挑选我的大脑试图解决这个问题。
-(void)flipToHelp {
HelpViewController *helpVariable = [[HelpViewController alloc] initWithNibName:@"HelpView" bundle:nil];
[self setHelpViewController:helpVariable];
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:_window cache:YES];
[_window removeFromSuperview];
[helpVariable release];
self.window.rootViewController = self.HelpViewController;
[UIView commitAnimations];
}
答案 0 :(得分:0)
-(void)flipToHelp {
HelpViewController *helpVariable = [[HelpViewController alloc] initWithNibName:@"HelpView" bundle:nil];
[self setHelpViewController:helpVariable];
[helpVariable release];
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.window
cache:YES];
self.window.rootViewController = self.HelpViewController;
[UIView commitAnimations];
}
这段代码怎么样?它还有动画片吗?
答案 1 :(得分:0)
从评论主题重申一下,你不应该从超级视图中删除窗口(它在技术上没有超视图,所以它可能会导致问题)。 设置窗口的显然,急动来自于更改窗口的rootViewController
属性应该换掉视图层次结构,rootViewController
属性,所以解决方案可能是避免使用该属性。以下是我认为应该足以实现这一目标:
-(void)flipToHelp {
HelpViewController *helpVariable = [[HelpViewController alloc] initWithNibName:@"HelpView" bundle:nil];
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:_window cache:YES];
[self.tabBarController removeFromSuperview];
[_window addSubview:helpVariable];
[UIView commitAnimations];
}