Низкая производительность настоящего ViewController

я используюUIViewControllerTransitioningDelegate для создания пользовательских переходов между двумя контроллерами представления (изMKMapView) на пользовательскую камеру, построенную на (AVFoundation). Все идет хорошо, пока я не позвонюpresentViewController и телефон кажется зависает около 1 секунды (когда я выхожу из системы). Это даже, кажется, происходит, когда я перехожу к гораздо более простому представлению (у меня есть контроллер представления, который отображает толькоUITextview и даже при этом, как представляется, задержка составляет около 0,4-5 секунд, прежде чем переход действительно будет вызван).

Это в настоящее время, как я называю переход

 dispatch_async(dispatch_get_main_queue(), ^{
        UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        CameraViewController *cvc2 = [sb instantiateViewControllerWithIdentifier:@"Camera"];

        cvc2.modalPresentationStyle = UIModalPresentationFullScreen; // Needed for custom animations to work
        cvc2.transitioningDelegate = self; //Conforms to the UIViewControllerTransitioningDelegate protocol
        [self presentViewController:cvc2 animated:YES completion:nil];
    });

Вот мойanimateTransition метод для этого вызова. Очень прямолинейно и в настоящее время представление, которое представляет это, имеет толькоMkMapView на нем (без дополнительных взглядов или методов).

-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {

if (self.type == MapAnimationTypePresent) {//From map to another view

    UIView *containerView = [transitionContext containerView];
    UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];

// Amazing category for iOS 7 compatibility found here - http://stackoverflow.com/a/25193675/2939977 
    UIView *toView = [toViewController viewForTransitionContext:transitionContext];
    UIView *fromView = [fromViewController viewForTransitionContext:transitionContext];

    toView.frame = self.view.frame;
    fromView.frame = self.view.frame;

    //Add 'to' view to the hierarchy
    toView.alpha = 0;
    [containerView insertSubview:toView aboveSubview:fromView];

    [UIView animateWithDuration:.5 animations:^{

        toView.alpha = 1;

    }completion:^(BOOL finished) {
        [transitionContext completeTransition:YES];
    }];
}

Любая помощь очень ценится.

Ответы на вопрос(0)

Ваш ответ на вопрос