我正在尋找一種使用Storyboard以編程方式設置我的初始視圖控制器的方法。我發現這個解決方案:Programmatically set the initial view controller using StoryboardsSwiftSpinner不再工作
這個作品只是喜歡我想它,但使用該主題中提供的斯威夫特後回答:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var exampleViewController: ExampleViewController = mainStoryboard.instantiateViewControllerWithIdentifier("ExampleController") as! ExampleViewController
self.window?.rootViewController = exampleViewController
self.window?.makeKeyAndVisible()
return true
}
當裝載了第一次用於工作框架圖將不再工作:SwiftLoader。 https://github.com/leoru/SwiftLoader
但是,當我第二次加載相同的視圖時,SwiftLoader插件沒有激活。
我加載SwiftLoader像這樣:
SwiftLoader.show(title: "Loading...", animated: true)
我認爲它與代碼做上面創建的UIWindow,而不是任何腳本中使用到的感覺(UIView的?)做的,但我不想法如何解決這個問題?
當您顯示指標視圖時,您能否就您的問題報告部分代碼? – LuckyStarr