1

私のアプリケーションでは、ほとんどどこからでもビデオを開くことができます。ビデオ プレーヤーは、MPMoviePlayerController を含む UIViewController サブクラスであり、アプリケーションの rootViewController に表示されます。

次のコードを使用して、アプリに ViewController を表示します。

// When the glitch occurs, the rootViewController still has a presentedViewController
if (self.rootViewController.presentedViewController)
     [self.rootViewController dismissViewControllerAnimated:NO completion:^{}];

CATransition* transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;

UIWindow* window = self.appDelegate.window;
[window.layer addAnimation:transition forKey:nil];
[self.rootViewController presentViewController:viewController animated:NO completion:^{}];

99% の場合、これは問題なく動作し、望ましい結果が得られますが、非常にランダムに非常に奇妙な不具合が発生することがあります。ビデオ プレーヤーの ViewController が表示され、アプリの rootViewController がビデオ プレーヤーの右上からスライドします。

基本的に、遷移はビデオ ViewController ではなく rootViewController に適用されます。この時点で、rootViewController がビデオ プレーヤー ViewController の上で右から左への遷移を行うため、アプリでビデオを開くことができなくなります。

この不具合の発生を防ぐにはどうすればよいですか? 新しいものを提示する前に、アクティブなpresentedViewControllerをrootViewControllerから却下しようとしましたが、問題は解決しません。

前もって感謝します。

4

0 に答える 0