[英]Customizing iOS Navigation Bar height, add background, menu button (Swift)
I've started developing in iOS last week and I've been trying to accomplish the following design to the Nav bar of my iOS app. 我上周开始在iOS上开发,我一直在尝试将以下设计完成到我的iOS应用程序的导航栏中。 So far, all I can do is change the background and add an image in the center. 到目前为止,我所能做的就是改变背景并在中心添加图像。 How do I resize the height of the navigation bar, add background and the buttons? 如何调整导航栏的高度,添加背景和按钮?
You can easily do this in a storyboard, or adding constraints via code. 您可以在故事板中轻松完成此操作,或通过代码添加约束。
Place a toolbar on top with these constraints: 使用这些约束将工具栏放在顶部:
Place navigation bar below the toolbar with these constraints: 使用以下约束将导航栏放在工具栏下方:
Add items to you Toolbar starting from the left: 从左侧开始向您添加项目工具栏:
Add items to your Navigation Bar: 将项目添加到导航栏:
I don't believe Apple allows you to change the height of the navigation bar. 我不相信Apple允许您更改导航栏的高度。 However, certain visual attributes can be altered, such as background image. 但是,某些视觉属性可以更改,例如背景图像。
Refer to this document: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationBar_Class/index.html#//apple_ref/doc/uid/TP40006887-CH3-SW16 请参阅此文档: https : //developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationBar_Class/index.html#//apple_ref/doc/uid/TP40006887-CH3-SW16
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.