0

我有一个相当简单的应用程序,有两个 UIViewControllers。一是主视图,二是选项页面。当我从一个动画到另一个动画时,UISwitches 和其他控件在旋转完成之前不会完全绘制。如果我不使用动画,那么就没有问题 - 一切都正确显示。这是代码:

[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

if (self.optionsViewController.view.superview == nil)
{
    if (self.optionsViewController == nil)
    {
        self.optionsViewController = [[OptionsViewController alloc] initWithNibName:nil bundle:nil];
    }
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

    [self.view insertSubview:self.optionsViewController.view atIndex:127];
}

[UIView commitAnimations];
4

1 回答 1

2

您是否尝试将缓存设置为否?缓存将视图保存为光栅化表单,这可能发生在 OptionsViewController 的子视图的绘制中间。

您还应该考虑在 iOS5 中使用更新更好的动画方法。

+ (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion
于 2012-05-05T02:42:11.317 回答