iOS 5をお使いですか?
ので、あなたが見ている問題は、ここに文書の変更にある場合は、次のビューが持っていなかった場合は、
前のiOS 5.0へ:リンクしているページでhttp://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/parentViewController
重要なビットはこれです親ビューコントローラであり、モーダルで表示されていた場合は、それを表示していたビューコントローラが返されます。これはもはやケースではない。 presentingViewControllerプロパティを使用して、プレゼンテーションビューコントローラを取得できます。
したがって、self.presentingViewControllerに変更すると問題は解決する可能性がありますが、おそらくそうではありません。あなたの最初のモーダルから、このコードを使用して
:
[self dismissModalViewControllerAnimated:YES];
SecondViewController *sec = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
sec.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.presentingViewController presentModalViewController:sec animated:YES];
あなたが提示新しいビューコントローラが表示されません。
あなたは(iOS5をのような)新しいメソッドを使用したいの後にあなたが何であるかを取得するには:このメソッドは、presentModalViewControllerための推奨交換です
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion
を。
そして、あなたの最初のビューコントローラ上のカスタムメソッド、のようなもの:メソッドは、あなたの現在のモーダルを閉じ、新しいものを提示することができ、両方の
- (void)cycleModalViewControllersWithController:(UIViewController *)newViewController
、このような何か:使用
- (void)cycleModalViewControllersWithController:(UIViewController *)newViewController {
[self dismissViewControllerAnimated:YES completion:^{
[self presentViewController:newViewController animated:YES completion:NULL];
}];
}
新しいモーダルを開始するための補完ブロックは、古いモーダルがアニメーション化されるまで待ってください。したがって、2つ目のモーダルビューコントローラでは、最初のモーダルビューコントローラでカスタムメソッドを呼び出し、新しいものを解除して表示するようにします。
どのクラスが自己ですか? –
selfは、ページカールの下に表示されるモーダルビューです。 – Keller