0

I'm using a custom animation to present my view controllers. Here's the code:

-(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;
}

I've noticed this method makes for a very laggy transition. If I launch the VC in a normal modal, it works quite smoothly. Also, if I animate just a view independent of a view controller, it also works perfectly smoothly. I'm wondering if there is something about the VC that might be causing it to animate so poorly? If its a symptom of something I'm doing or if view controllers are just not meant to be handled this way, etc. Any input is greatly appreciated. Thanks!

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90

1 Answers1

0

It was the CALayer shadows. removed them and it worked fine.

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90