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のアニメーションが不十分になる原因が何かあるのではないかと思いますが、それが私がしていることの症状である場合、またはView Controllerがこのように処理されることを意図していない場合など、どのような入力でも大歓迎です。ありがとう!

4

1 に答える 1