2014-09-28 43 views
0

我創建了一個自定義segue來創建垂直滑動動畫。它在iOS7中工作正常。但它在動畫結束時會發出警告和閃爍效果。自定義塞恩在動畫結束時閃爍並在iOS8中發出警告

警告消息:不平衡通話開始/結束的外觀轉換爲destinationViewController

以下是我的代碼

-(void)perform{ 

    NSTimeInterval delayinterval = 0.0; 

    UIViewController *sourceViewController = self.sourceViewController; 
    UIViewController *destinationViewController = self.destinationViewController; 

    destinationViewController.view.center = sourceViewController.view.center; 
    destinationViewController.view.transform = sourceViewController.view.transform; 
    destinationViewController.view.bounds = sourceViewController.view.bounds; 

    CGRect destination = destinationViewController.view.frame; 
    destinationViewController.view.frame = CGRectMake(destination.origin.x, destination.size.height, destination.size.width, destination.size.height); 

    [sourceViewController.view.superview addSubview:destinationViewController.view]; 

    [UIView animateWithDuration:0.2 delay:delayinterval options:UIViewAnimationOptionTransitionNone animations:^{ 

     CGRect orginator = sourceViewController.view.frame; 
     sourceViewController.view.frame = CGRectMake(orginator.origin.x, -orginator.size.height, orginator.size.width, orginator.size.height); 
     destinationViewController.view.frame = orginator; 

    } completion:^(BOOL finished) { 

     // remove from temp super view 
     [destinationViewController.view removeFromSuperview]; 

      if ([self.identifier isEqualToString:@"UnWindCustomSettingsSegue"]){ 
       [sourceViewController dismissViewControllerAnimated:NO completion:NULL]; 
      }else { 
       [sourceViewController presentViewController:destinationViewController animated:NO completion:NULL]; 
      } 

    }]; 

} 

回答

0

看看這個職位接受的答案SO後: Unbalanced calls when performing a custom segue

該問題中的OP通過添加正在被刪除的視圖的屏幕截圖來修復閃爍。此外,接受的答案解釋了你是否收到警告。

+1

感謝您的及時回覆。抱歉,延遲迴復。另一個線程中的解決方案已幫助刪除警告消息。但我仍然對解決方案感到困惑,以消除閃爍。 – Ran 2014-09-30 13:43:29