导航栏未显示自动布局 [英] Navigation Bar not showing with Auto Layout

查看:102
本文介绍了导航栏未显示自动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用自动布局的故事板项目,设置为任意(大小)和任意(大小)。我嵌入了一个导航控制器(带有第一个viewController)。第一个viewController有一个导航栏(如预期的那样),但第二个viewController没有。它有一个顶部酒吧。我改变了导航控制器navBar的颜色,它们都改变了(如预期的那样)但是我不能添加UIBarButton,或者为第二个viewController创建一个标题。



(请不要在我之前的项目中,当我没有使用自动布局时,(我明确地为iphone制作了),所有viewControllers都有一个导航栏。



请不要太苛刻。我有点新鲜。



更新



刚刚意识到它有顶层布局指南,而不是顶栏

I have a project with the storyboard using auto Layout with the setting w any (size) y any (size). I embedded a navigation controller (with the first viewController). The first viewController has a navigation bar (as expected) but the second viewController doesn't. It has a top bar. I changed the color of the navigation controllers navBar, and they all change (as expected) but I cannot add a UIBarButton, or create a title for the second viewController.

(Please not that in my previous projects, when I didn't use auto layout, (I made it explicitly for the iphone,) all viewControllers had a nav bar.

Please don't be too harsh. I'm kinda new at this.

Update

Just realized it has top Layout guide, not top bar

推荐答案

导航栏是一个UI元素。你必须将一个拖入界面构建器中的控制器而不是填充它出来了。
The navigation bar is a UI element. You must drag one into the controller in the interface builder and than fill it out.


这篇关于导航栏未显示自动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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