あなたのアニメーションを得る別のアプローチを提案するかもしれません。最初theAppScreen
にコントローラーに移動し、ユーザーがログインする必要がある場合は、コントローラーに を実行させます(ログイン画面に直接移動したように見せたい場合は、このステップをアニメーション化する必要はありません)。そうすれば、ログインに成功すると、loginScreen ができて、アニメーションを main に戻すことができます。(明らかに、フェード効果が必要な場合は、コントローラーをに設定することを忘れないでください。)presentViewController
loginScreen
dismissViewControllerAnimated
theAppScreen
modalTransitionStyle
UIModalTransitionStyleCrossDissolve
あなたがあなたrootViewController
の .
MainAppViewController *controller = [[MainAppViewController alloc] initWithNibName:@"MainAppViewController" bundle:nil];
// animate the modal presentation
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.window.rootViewController presentViewController:controller
animated:YES
completion:^{
// and then get rid of it as a modal
[controller dismissViewControllerAnimated:NO completion:nil];
// and set it as your rootview controller
self.window.rootViewController = controller;
}];
最初のテクニックは、私にはずっときれいに思えます。