导航栏和子视图ios之间的差距? [英] Gap between navigation bar and subview ios?

查看:84
本文介绍了导航栏和子视图ios之间的差距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这里有一个问题:添加子视图会留下空白在子视图和导航栏之间

I understand there is this question: Adding subview leaves gap between subview and navigation bar

但是,没有答案,我以不同的方式处理我的方法,因此可能会有所不同.无论如何,当我向导航控制器中添加子视图时,导航栏和子视图之间也存在间隙,该导航器也具有标签栏控制器.我正在使用情节提要.我通过情节提要ID使用UIViewController.view类型添加子视图.

However, there is no answer, and I do my method a different way, so that might make it a bit different. Anyways, I as well have a gap between the navigation bar and subview when I add a subview to my navigation controller, which also has a tab bar controller. I am using storyboards. I am adding the subview using UIViewController.view type via storyboard id.

我的代码:

[self.view addSubview:[[self.storyboard instantiateViewControllerWithIdentifier:@"View"] view]];

这有效,并添加了视图,但视图上方有空白.有什么建议?谢谢.

This works, and adds the view, but with the gap above it. Any suggestions? Thanks.

推荐答案

在情节提要中定义的视图"视图控制器上,将从NIB调整视图大小"属性设置为未选中(已打勾)默认情况下).这为我解决了差距问题.

On your 'View' view controller defined in Storyboard, set the 'Resize View From NIB' property to unticked (this is ticked by default). This cured the gap problem for me.

这篇关于导航栏和子视图ios之间的差距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆