簡體   English   中英

在AppDelegate Swift中更改初始ViewController

[英]Change initial viewcontroller in AppDelegate swift

我創建了第一個Swift應用,其中在AppDelegate函數中設置了一個viewController:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

 var tableVC:FriendsTableViewController = FriendsTableViewController(className: "Friend")
    tableVC.title = "FriendFamz"

    UINavigationBar.appearance().tintColor = UIColor(red: 0.05, green: 0.47, blue: 0.91, alpha: 1.0)
    UINavigationBar.appearance().barTintColor = UIColor(red: 0.05, green: 0.47, blue: 0.91, alpha: 1.0)
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
    UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent


    var navigationVC:UINavigationController = UINavigationController(rootViewController: tableVC)

    let frame = UIScreen.mainScreen().bounds
    window = UIWindow(frame: frame)

    window!.rootViewController = navigationVC
    window!.makeKeyAndVisible()

現在,我想更改應用程序的第一個視圖:我想創建一個登錄視圖(使用登錄ViewController),但是我不知道如何創建該視圖,該視圖隨后將調用我的FriendTableViewController ...

有人能幫忙嗎? 太好了,我已經被封鎖了幾個小時了……非常感謝

最簡單的方法是進入設置並將初始視圖設置為該第一個視圖。

如果您使用情節提要,則只需按住Control並單擊一個視圖即可查看另一個。 命名segue。

在您的登錄名中,如果成功,請使用標識符執行搜索。 有數百本教程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM