【发布时间】:2015-09-14 14:37:31
【问题描述】:
在我的应用程序中,我声明了我的导航控制器 在我的应用程序委托类之前,它在 ios7 和 iOS 8 上运行良好。但是一旦升级到 iOS 9 和 Xcode 7,它似乎不想工作。
当我的导航控制器在我的应用委托类之前声明时,如下所示:
var navigationController = UINavigationController()
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDelegate, CLLocationManagerDelegate {
它不允许我在我的应用程序中访问我的导航控制器确实完成了启动功能:
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let rootViewController: ViewController = ViewController()
navigationController = UINavigationController(rootViewController: rootViewController)
navigationController.setNavigationBarHidden(true, animated: false)
navigationController.view.layer.cornerRadius = 8
navigationController.view.layer.masksToBounds = true
//navigationController.shouldAutomaticallyForwardRotationMethods()
window!.rootViewController = navigationController
window!.makeKeyAndVisible()
难倒我的是我可以毫无问题地在任何其他视图中调用我的导航控制器。在 Xcode 7、iOS 9 和 swift 2 之前,这也可以正常工作。
有什么东西改变为 swift 不允许这样做吗?我该如何继续这样使用我的导航控制器?
【问题讨论】:
标签: xcode uinavigationcontroller swift2 ios9 xcode7