所以我正在尝试创建一个iOS应用程序。第一个视图只是一个主屏幕,它分成第二个视图,其中包含所有内容和标签栏。我正在尝试添加programmaticaly标签栏,所以我通过app委托文件来完成它。这是我到目前为止的简化版本:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds);
let storyboard = UIStoryboard(name: "Main", bundle: nil);
let vc1 = UIViewController();
let vc2 = UIViewController();
let tabBarController = UITabBarController();
tabBarController.viewControllers = [vc1,vc2];
window?.rootViewController = tabBarController;
window?.makeKeyAndVisible();
return true
}
这个问题是它试图将标签栏添加到主屏幕。我希望将其添加到第二个视图中。我该怎么做呢?
提前致谢!
准备Segue方法:
let storyboard = UIStoryboard(name: "Main", bundle: nil);
let vc1 = UIViewController();
let vc2 = UIViewController();
let tabBarController = UITabBarController();
tabBarController.viewControllers = [vc1,vc2];
segue.destinationViewController = tabBarController;//This doesnt work