1.设置导航栏标题

self.title = @"dylan_李伟宾";

2.设置导航栏样式

设置方法:

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];

UIBarStyle的样式:

typedef NS_ENUM(NSInteger, UIBarStyle) {
UIBarStyleDefault = 0,
UIBarStyleBlack = 1, UIBarStyleBlackOpaque = 1, // Deprecated. Use UIBarStyleBlack
UIBarStyleBlackTranslucent = 2, // Deprecated. Use UIBarStyleBlack and set the translucent property to YES
};

UIBarStyleDefault是默认样式,UIBarStyleBlack是黑色不透明。UIBarStyleBlackOpaqueUIBarStyleBlackTranslucent这两个已经废弃了。

假设想设置导航栏透明,能够加上以下这句代码:

self.navigationController.navigationBar.translucent = YES;

3.改动返回buttontitle

self.navigationItem.title = @"test";

4.隐藏返回buttontitle

比較笨的方法是:

self.navigationItem.title = @"";

还能够这样设置:

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

5.设置leftBarButtonItem

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStylePlain target:self action:@selector(back:)];

- (void)back:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}

6.左滑返回手势失效了怎么办

假设按上一步设置leftBarButtonItem之后,左滑返回手势就会失效。

设置一下UIGestureRecognizerDelegate代理就可以:

self.navigationController.interactivePopGestureRecognizer.delegate = self;

iOS - 导航栏UINavigationController经常使用属性的更多相关文章

  1. IOS 导航栏属性设置

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

  2. IOS导航栏颜色渐变与常用属性

    (转:http://www.cnblogs.com/Lingchen-start/archive/2015/10/23/4904361.html) 今年很忙,忙的写日志的时间都很少.  少的可怜. 自 ...

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

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

  4. iOS导航栏标题颜色

    按钮的颜色 [self.navigationBar setTintColor:[UIColor whiteColor]]; 标题颜色.字体 [self.navigationBar setTitleTe ...

  5. 转:ios导航栏设置

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

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

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

  7. iOS导航栏NavigationBar的颜色,按钮和标题以及字体颜色

    首先,层级关系: leftBarButtonItem.rightBarButtonItem.title都是加在UINavigationItem上的,UINavigationItem再加在Navigat ...

  8. iOS 导航栏 工具条

    导航栏最常见的例子就是返回按钮的所在 在AppDelegate.m中,代码布局最开始定义窗口的时候, _window.rootViewController就应该为一个UINavigationContr ...

  9. iOS导航栏的正确隐藏方式【转】

    简介:在项目中经常碰到首页顶部是无限轮播,需要靠最上面显示.有的设置导航栏为透明等一系列的方法,这个可以借助第三方.或者干脆简单粗暴的直接隐藏掉导航栏.可是push到下一个页面的时候是需要导航栏的,如 ...

随机推荐

  1. 嵌入web字体

    @font-face模块         可以帮助我们轻松解决Web页面中使用优雅字体的方式,而且我们可以根据需要自定义多种字体,但是每个@font-face只能定义一种,若需要多个字体就启用多个@f ...

  2. SQLiteOpenHelper 源码

    package com.tongyan.common.db; /** * Copyright (C) 2007 The Android Open Source Project * * Licensed ...

  3. spring下载和安装

    下载和安装Spring请按例如以下步骤进行.   (1)登录网站,下载Spring的最新稳定版本号.最新版本号为spring-framework-4.0.建议下载spring-framework-sp ...

  4. 关于DevOps你必须知道的11件事

    转自:http://www.infoq.com/cn/articles/11devops 关于作者 Gene Kim在多个角色上屡获殊荣:CTO.研究者和作家.他曾是Tripwire的创始人并担任了1 ...

  5. excel 的几个函数使用

    =IF(表1[[#此行],[state]]="修改",        IF(                ISBLANK(                    VLOOKUP( ...

  6. kettle--组件(1)--值映射

    组件:值映射 如下如所示: 首先,给出官方给出的文档: 个人理解: Target field name:可以理解为将source column的字段复制为另一个target column的名字. De ...

  7. Android 4.4KitKat Sound System

    Alsa Lib: File path:external/tinyalsa Audio Hal Library: Core File path:hardware/libhardware_legacy/ ...

  8. LAMP架构二

    安装PHP7 1.查看php配置文件信息(phpinfo),php有两个配置文件开发环境和生产环境 [root@localhost php-5.6.30]# /usr/local/php/bin/ph ...

  9. Asp.net2.0里的SessionPageStatePersister

    备注: ASP.NET 页可在处理和提供任何网页所必需的原本无状态 HTTP 请求与响应之间存储 Page 状态信息.此状态称为“视图状态”. ASP.NET 的默认持久性机制是使用 HiddenFi ...

  10. memcache基础知识-stats参数

    安装memcache: #tar -xvf libevent-1.4.13-stable.tar.gz#cd libevent-1.4.13-stable#./configure && ...