我了解您使用PreferredPrimaryColumnWidthFraction和/或maximumPrimaryColumnWidth,它位于您的AppDelegate下,但是我的问题是,如果MasterViewController不是您的根viewcontroller,那该怎么办。我知道是否可以,您可以输入:
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let splitViewController = window!.rootViewController as! UISplitViewController
splitViewController.maximumPrimaryColumnWidth = 300
如果在MasterViewController之前有一个Navigation控制器,则可以放置:
let rootViewController = window!.rootViewController as UINavigationController
let splitViewController = rootViewController.viewControllers[0] as UISplitViewController
但是,如果您有多个viewControllers,那么在掌握之前,这两个导航都基本。如何启动MasterViewController?任何帮助表示赞赏,我意识到答案可能非常基础。谢谢。