WWDC
「UIViewControllerContainmentの実装」に関する2011年のプレゼンテーションを見たばかりです(ここにビデオへのリンクがあります)
彼らはviewControllersを画面に追加するこれらの方法の両方に言及しました、そして私はベストプラクティスに関するいくつかの説明をいただければ幸いです...
addChildViewController /
removeFromParentViewController @property(nonatomic、readonly)NSArray*childViewControllersおよび[self transitionFromViewController:currentView toViewController:nextView duration: options: animations: completion:];
pushViewController:animated:/ popViewControllerAnimated
彼らは、プレゼンテーションでこれをすり抜けてすぐにスキミングしました
私のアプリでは、すべてのカスタムviewControllerを使用しており、今日まで、常に次の方法でそれらを管理してきました。
[nextController performSelector:@selector(setDelegate:) withObject:self];
[currentPageController.view removeFromSuperview];
[self.view addSubview:nextController.view];
しかし、これは悪い習慣であることがわかりました。「addChildViewController」の正しい使用方法と「pushViewController」の正しい使用方法は何でしょうか。
この件についてのあなたの考えに本当に感謝します!