0

我正在使用自定义动画来展示我的视图控制器。这是代码:

-(void)launchCustomModal:(id)sender
{
    UIButton *buttonClicked = (UIButton *)sender;
    int selection;
    selection = buttonClicked.tag;
    [ticker removeFromSuperview];
    ticker = nil;

    if (selection == 3)
    {
        MyViewController *myVC = [[MyViewController alloc]initWithNibName:nil bundle:nil];
        modalViewController= [[UINavigationController alloc]initWithRootViewController:myVC];
        modalViewController.navigationBarHidden = YES;
        [modalViewController setToolbarHidden:YES];

        CGRect result = self.view.bounds;
        result.origin.y = -result.size.height;
        modalViewController.view.frame=result;
        [self.view addSubview:modalViewController.view];

        [UIView animateWithDuration:.375 
                         animations:^{ 
                             modalViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
                         }
                         completion:^(BOOL finished) {
                             NSLog(@"Finished");          
                         }];
    }

    return;
}

我注意到这种方法会导致非常滞后的过渡。如果我以正常模式启动 VC,它工作得非常顺利。此外,如果我只为独立于视图控制器的视图设置动画,它也可以完美地运行。我想知道是否有关于 VC 的某些东西可能导致它的动画效果如此糟糕?如果它是我正在做的事情的症状,或者视图控制器不应该以这种方式处理,等等。任何输入都非常感谢。谢谢!

4

1 回答 1

0

这是 CALayer 阴影。删除它们,它工作正常。

于 2012-08-22T20:31:13.127 回答