我创建了第一个 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()
现在我想更改应用程序的第一个 View :我想创建一个登录 View (带有登录ViewController),但我不知道如何创建这个 View ,然后它会调用我的 FriendTableViewController ...
有谁能帮忙吗?太好了,我已经被屏蔽了好几个小时了…… 非常感谢
最佳答案
最简单的方法是转到您的设置并将初始 View 设置为第一个 View 。
如果您使用 Storyboard,则只需按住 Control 并单击一个 View 即可切换到另一个 View 。为 Segue 命名。
在您的登录中,如果成功,请使用标识符执行segue。有数百个关于此的教程。
关于ios - 快速更改 AppDelegate 中的初始 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31466246/