IOS-导航栏风格

导航控制器可以用几种不同的风格来显示自身。默认风格就是标准的灰色外观。目前支持三种不同的风格。

风    格

描    述

UIBarStyleDefault

默认风格;灰色背景,白色文字

UIBarStyleBlack

纯黑色背景,白色文字

UIBarStyleBlackOpaque

纯黑色背景,白色文字

UIBarStyleBlackTranslucent

透明黑色背景,白色文字

风格是通过barStyle属性来设置的。这个属性属于导航控制器,而不是视图控制器,因此在各个视图之间来回切换时,此属性可以保持一致:

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

IOS中原文档如下:

UIBarStyle
Defines the stylistic appearance of different types of views.

typedef enum {
    UIBarStyleDefault          = 0,
    UIBarStyleBlack            = 1,
 
    UIBarStyleBlackOpaque      = 1, // Deprecated
    UIBarStyleBlackTranslucent = 2, // Deprecated
} UIBarStyle;
Constants
UIBarStyleDefault
Use the default style normally associated with the given view. For example, search bars and tool bars typically use a blue gradient background.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

UIBarStyleBlack
Use an opaque black style.
Available in iOS 3.0 and later.
Declared in UIInterface.h.

UIBarStyleBlackOpaque
Deprecated. Use UIBarStyleBlack instead.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

UIBarStyleBlackTranslucent
Deprecated. Use UIBarStyleBlack and set the translucent property to YES instead.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

导航控制器可以用几种不同的风格来显示自身。默认风格就是标准的灰色外观。目前支持三种不同的风格。

风    格

描    述

UIBarStyleDefault

默认风格;灰色背景,白色文字

UIBarStyleBlack

纯黑色背景,白色文字

UIBarStyleBlackOpaque

纯黑色背景,白色文字

UIBarStyleBlackTranslucent

透明黑色背景,白色文字

风格是通过barStyle属性来设置的。这个属性属于导航控制器,而不是视图控制器,因此在各个视图之间来回切换时,此属性可以保持一致:

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

IOS中原文档如下:

UIBarStyle
Defines the stylistic appearance of different types of views.

typedef enum {
    UIBarStyleDefault          = 0,
    UIBarStyleBlack            = 1,
 
    UIBarStyleBlackOpaque      = 1, // Deprecated
    UIBarStyleBlackTranslucent = 2, // Deprecated
} UIBarStyle;
Constants
UIBarStyleDefault
Use the default style normally associated with the given view. For example, search bars and tool bars typically use a blue gradient background.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

UIBarStyleBlack
Use an opaque black style.
Available in iOS 3.0 and later.
Declared in UIInterface.h.

UIBarStyleBlackOpaque
Deprecated. Use UIBarStyleBlack instead.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

UIBarStyleBlackTranslucent
Deprecated. Use UIBarStyleBlack and set the translucent property to YES instead.
Available in iOS 2.0 and later.
Declared in UIInterface.h.

iOS 导航栏风格的更多相关文章

  1. iOS 屏幕原点坐标 && 导航栏风格的自定义

    其一 屏幕原点坐标 (x ,y) 受 self.navigationController. navigationBar 的 setTranslucent (BOOL) 属性控制 在 iOS7 以后   ...

  2. 转:ios导航栏设置

    原帖:http://www.cocoachina.com/industry/20131104/7287.html 本文提供的代码需要用Xcode 5来执行.如果你还在使用老版本的Xcode,那么在运行 ...

  3. IOS 导航栏属性设置

    IOS 7 以上系统导航栏: [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; // 返回按钮颜色 [UINaviga ...

  4. IOS导航栏的使用方法

    本文是使用纯代码实现一个导航栏的效果.单击按钮并且产生事件.基本思路是: 1.创建一个导航栏(UINavigationBar对象) 2.创建一个导航栏集合(UINavigationItem对象) 3. ...

  5. 保持UIImagePickerController后导航栏风格统一

    1. UIImagePickerController 状态栏始终保持某一种风格. -(void)navigationController:(UINavigationController *)navig ...

  6. 【Swift】iOS导航栏错乱的原因

    #iOS开发高级技巧#导航栏错乱,也就是导航栏的显示效果与内容区不匹配,引发原因很多,其中最重要的有两个原因: 1.在viewwillappear,viewwilldisappear两个函数中,设置导 ...

  7. iOS导航栏背景,标题和返回按钮文字颜色

    在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Col ...

  8. iOS 导航栏黑线,UIImage 枚举处理方式

      ios 找出导航栏下面的黑线(可隐藏,改变样式等) http://www.jianshu.com/p/effa4a48f1e3     设置UIImage的渲染模式:UIImage.renderi ...

  9. ios 导航栏的显示和隐藏切换

    从简单的一个没有导航栏的界面A push到另一个有导航栏的界面 B,在界面A的逻辑中加入下面逻辑: 屏幕快照 2016-03-30 上午10.35.24.png 这样完美的处理了这个场景变换需求.引起 ...

随机推荐

  1. JSP 注释的详解及简单实例

    转自:https://www.jb51.net/article/124727.htm JSP 注释的详解及简单实例 一 三种格式 二 举例 ? 1 2 3 4 5 6 7 8 9 10 11 12 1 ...

  2. 【196】Dell 移动工作站系统安装方法

    会出现找不到硬盘的情况,解决方法:安装系统的时候需要加载阵列卡驱动 下载阵列卡驱动,以 Dell T7610 为例根据安装系统进行选择,地址:http://zh.community.dell.com/ ...

  3. Metasloit渗透测试魔鬼训练营

    总结一句话  漏洞  攻击   拿权限  维持访问 课程目标 掌握黑客渗透攻击流程 掌握常用攻击软件     渗透测试工程师 掌握常见windows漏洞挖掘和攻击 掌握常见linux漏洞挖掘和攻击 参 ...

  4. vi常用设置

    vi不能使用退格键和上下左右键 因为ubuntu默认安装的是vim-tiny,所以需要安装完整版本 apt-get install vim 安装完再使用就可以了 vi本身是不带颜色的,vim带颜色,使 ...

  5. Ruby  Array类

    Array类 更新: 2017/06/03 更新: 2017/08/31 更新sort的详细内容 更新: 2017/09/07 增加each_with_index, each.with_index(o ...

  6. CI框架中一个类中调用另一个类中已经加载对象测试

    controller.php <?php class CI_Controller { private static $instance; public function __construct( ...

  7. springboot(五) 加载配置文件优先级顺序

    github代码地址:https://github.com/showkawa/springBoot_2017/tree/master/spb-demo/spb-brian-query-service ...

  8. html语义化与前端页面排版规则

    1.使用div进行布局,不要用div进行无意义的包裹  span行内常见元素 2.可以使用div和p的情况下,尽量用p.p有默认上下间隔字体加粗等,可以对终端有适配 3.需要强调的文本,可以包含在st ...

  9. 理解Javascript的闭包【转】

    什么是闭包 闭包是什么?闭包是Closure,这是静态语言所不具有的一个新特性.但是闭包也不是什么复杂到不可理解的东西,简而言之,闭包就是: 闭包就是函数的局部变量集合,只是这些局部变量在函数返回后会 ...

  10. _bzoj1503 [NOI2004]郁闷的出纳员【Splay】

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1503 由于初始工资未达到下限而离开的员工不算在离开人数之内...坑爹... 然后就是写kth ...