【问题标题】:Change initial viewcontroller in AppDelegate swift快速更改 AppDelegate 中的初始视图控制器
【发布时间】:2015-07-16 23:33:16
【问题描述】:

我创建了第一个 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 ...

有人可以帮忙吗?太好了,我已经被屏蔽了好几个小时了... 非常感谢

【问题讨论】:

    标签: ios iphone swift viewcontroller appdelegate


    【解决方案1】:

    最简单的方法是转到您的设置并将您的初始视图设置为第一个视图。

    如果您使用情节提要,您可以按住 Control 并单击一个视图到另一个视图。命名segue。

    在您的登录中,如果成功,请使用标识符执行 segue。这方面的教程有数百个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多