仅在第二个视图上的标签栏

时间:2016-01-20 20:09:38

标签: ios swift mobile uiviewcontroller uitabbarcontroller

所以我正在尝试创建一个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

0 个答案:

没有答案