UIViewController コンテインメントを (iPad アプリで) 動作させるために、いくつかのコードをいじっています。
シナリオは次のとおりです。2 つ目のビューをその上に表示したいビューがあります。2 番目の (別の) UIViewController で 2 番目のビューとのすべてのやり取りを管理したいと考えています。最初のビューは、ボタンを押すと 2 番目のビューをロードします。ボタンが押されると、次のコードが最初のコントローラーで実行されます。
-(void)displayPropertyView // <-button triggers this
{
// Need to instantiate a new view and add it to the main editor view.
HPSQuestionListController* questionListController = [ [ HPSQuestionListController alloc ] init ];
[self.view addSubview:questionListController.view];
[self.view bringSubviewToFront:questionListController.view];
[self pushViewController:questionListController animated:YES];
}
-(void)pushViewController:(UIViewController*)controller animated:(BOOL)animated
{
[self addChildViewController:controller];
//[controller didMoveToParentViewController:self];
if (YES)
{
[self transitionFromViewController:self
toViewController:controller
duration:1.0
options:nil
animations:^{}
completion:^(BOOL finished){
[controller didMoveToParentViewController:self];
}];
}
}
アプリは transitionFromViewController 行で次のようにクラッシュします。
子ビュー コントローラー。-[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]' を呼び出すときは、共通の親ビュー コントローラーが必要です。
誰でもこれを解決する方法を知っていますか? UIViewController コンテインメントについての私の理解では、2 つのビューを同時に管理する 2 つのコントローラーを持つことができます。これは間違っていますか?