2016-05-16 18 views
0

我是使用Swift進行編程的新手。我想知道如何從頭開始創建應用程序(從一開始就沒有啓動畫面,沒有第一頁,也沒有故事板) - 我刪除了所有ViewController及其相關故事板以及啓動屏幕。我設法使啓動屏幕工作,但我無法過渡到第一頁(目前也存在)。如何在Swift中從LaunchScreen過渡到主頁面?

我做過的事情: 創建了新的故事板,其中包含主頁的視圖控制器和擴展UIViewController的相關swift文件。還將這兩者聯繫起來。

但我不能讓lauchscreen過渡到主頁面。任何與此有關的幫助將不勝感激。我也嘗試過與其他Swift項目進行比較,但我不知道如何繼續。

編輯:

import UIKit 

class MyViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     // Do any additional setup after loading the view. 
    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 


    /* 
    // MARK: - Navigation 

    // In a storyboard-based application, you will often want to do a little preparation before navigation 
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 
     // Get the new view controller using segue.destinationViewController. 
     // Pass the selected object to the new view controller. 
    } 
    */ 

} 

這是我的主要頁面視圖控制器。我的故事板非常基本,沒有UI元素,只是視圖控制器。問題已由@nobre回答。

+0

取決於您是如何過渡到LaunchScreen的,您是否可以在問題中添加更多信息,例如您編寫的代碼? –

回答

3

您必須將您的目標的Main Interface指向您的故事板。 enter image description here

在代碼中,你將不得不在AppDelegate,創建一個UIWindow實例與框設置爲NSScreen.mainScreen.bounds,編程創建視圖控制器,設置你的控制器作爲窗口的rootViewController,然後調用makeKeyAndVisible的窗口。

+0

謝謝!看起來還有很多東西需要了解IDE,如果問題太簡單,道歉。 – user1841702