ためにトラブルになります。私はUISplitViewController
のための拡張機能を削除して、このようなdestinationViewController
を準備しかしときUISplitViewControllerの拡張子は、私はシンプル<code>UISplitViewController</code>の拡張子を持つアプリ
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'The content view controller argument must be the root of its associated view controller hierarchy.'
:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let searchResultsViewController = (segue.destinationViewController as? UISplitViewController)?.masterViewController as? SearchResultsViewController {
searchResultsViewController.mode = mode
}
}
そしてそれdoesntの仕事エラーのため:セグエが行われているとき、私はこのように私のdestinationViewController
を準備します。
if let searchResultsViewController = ((segue.destinationViewController as? UISplitViewController)?.viewControllers.first as? UINavigationController)?.topViewController as? SearchResultsViewController {
//prepare controller
}
IT WORKS
What is the reason that it is not working in first case?
どこかに文書化されていますか? –
この問題を解決するために何をすべきか理解しています。なぜ私はこれをしなければならないのか説明が必要です。 –
@BartłomiejSemańczykこれは文書化されていませんが、[private headers](https://github.com/nst/iOS-Runtime-Headers/blob/1bdbef2afe228bd5e660e247cdb149e1b39a85c4/Frameworks/UIKit.framework/UISplitViewController)から問題のプロパティを見ることができます.h#L307) – venom889