在TabBar及其控制器上添加SubView

时间:2015-09-28 14:26:25

标签: ios swift autolayout uitabbarcontroller addsubview

我试图在所有TabBarController上添加一个View,我试过这个:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    self.window = UIWindow(frame: CGRectMake(0, 0,
        CGRectGetWidth(UIScreen.mainScreen().bounds),
        CGRectGetHeight(UIScreen.mainScreen().bounds)))
    self.window!.backgroundColor = UIColor.whiteColor()
    let tabBar : UITabBarController = UITabBarControllerHelper.generate() //Create the TabBarController, works fine
    let videoController : UIViewController = VideoViewController()
    videoController.view.layer.zPosition = 1
    tabBar.view.addSubview(videoController.view)
    self.window!.rootViewController = tabBar
    self.window!.makeKeyAndVisible()
    return true
}

但这不起作用,只渲​​染TabBarController。我更改了self.window!.rootViewController以测试绘制videoController并且工作正常。问题是:我无法合并视图。

0 个答案:

没有答案