Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c Swift语言中的UIAbbarController、UINavigationController和UIViewController间距_Objective C_Uiviewcontroller_Uitabbarcontroller_Swift_Bounds - Fatal编程技术网

Objective c Swift语言中的UIAbbarController、UINavigationController和UIViewController间距

Objective c Swift语言中的UIAbbarController、UINavigationController和UIViewController间距,objective-c,uiviewcontroller,uitabbarcontroller,swift,bounds,Objective C,Uiviewcontroller,Uitabbarcontroller,Swift,Bounds,我在使用UIAbbarController启动的应用程序正确布局时遇到了持续问题,而每个选项卡都填充了一个UINavigationController,其中包含一个根子类UIViewController: self.window = UIWindow(frame: UIScreen.mainScreen().bounds) let controller_1 = subclassed_view_controller() let controller_navi_1 = UI

我在使用UIAbbarController启动的应用程序正确布局时遇到了持续问题,而每个选项卡都填充了一个UINavigationController,其中包含一个根子类UIViewController:

    self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

    let controller_1 = subclassed_view_controller()
    let controller_navi_1 = UINavigationController(rootViewController: subclassed_view_controller);
    //repeat for 2-4

    let view_controllers = [controller_navi_1, controller_navi_2, controller_navi_3, controller_navi_4]
    let tab_bar_controller = UITabBarController()
    tab_bar_controller.viewControllers = view_controllers

    //set up each tab's aesthetics (image and name)

    self.window!.rootViewController = tab_bar_controller;

    self.window!.backgroundColor = UIColor.whiteColor()
    self.window!.makeKeyAndVisible()
出于某种原因,每个视图控制器的“我的内容”的底部由swift中的选项卡覆盖。我非常致力于通过编程而不是通过IB来实现这一点,但我显然缺少一些推断布局

感谢您的澄清,特别是关于不涉及使用“-20或-44”逻辑的方法;我觉得它太粗糙了,我不喜欢

注1:我尝试过操纵.bounds和.clipsToBounds,但没有成功


注2:objective-C中也存在同样的问题,在自定义视图控制器中具有可比代码,设置:

    self.edgesForExtendedLayout = .None
这将让操作系统知道不要在这些条下扩展控制器内容