iOS设置导航栏样式(UINavigationController)

//设置导航栏baritem和返回baiitem样式
UIBarButtonItem *barItem = [UIBarButtonItem appearance];

//去掉返回按钮上的字
[barItem setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
//把按钮设置为白色
barItem.tintColor = [UIColor whiteColor];

UINavigationBar *navBar = [UINavigationBar appearance];
//设置导航栏 字体颜色
[navBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];//设置导航栏标题颜色
[navBar setBarTintColor:[UIColor blueColor]];//设置导航栏背景色
navBar.tintColor = [UIColor whiteColor];//设置导航栏返回按钮颜色

appdelegate设置
//设置全局状态栏字体的颜色
application.statusBarStyle = UIStatusBarStyleLightContent;
时间: 2024-08-14 04:22:33

iOS设置导航栏样式(UINavigationController)的相关文章

iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)

                  #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface Ap

iOS 设置导航栏的颜色和导航栏上文字的颜色

#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface AppDelegate () @end

iOS - 设置导航栏之标题栏居中、标题栏的背景颜色

本章实现效果: Untitled.gif 前言: 项目中很多需求是要求自定义标题栏居中的,本人最近就遇到这中需求,如果用系统自带的titleView设置的话,不会居中,经过尝试,发现titleview的起点位置和尺寸依赖于leftBarButtonItem和rightBarButtonItem的位置.下面给出我的解决方案 首先自定义一个标题View #import <UIKit/UIKit.h> @interface CustomTitleView : UIView @property (no

IOS设置导航栏字体大小及颜色

方法一: 自定义视图,定义一个lable,相关属性在lable里设置 核心方法: self.navigationItem.titleView = titleLabel; 方法二:用系统方法直接设置 [self.navigationController.navigationBar setTitleTextAttributes:@{ NSFontAttributeName:[UIFont systemFontOfSize:20], NSForegroundColorAttributeName:Whi

iOS设置导航栏透明度

As I support Colin's answer, I want to give you an additional hint to customize the appearance of an UINavigationBar including the alpha. The trick is to use UIAppearance for your NavigationBar. This enables you to assign an UIImage to your Navigatio

[iOS微博项目 - 1.1] - 设置导航栏主题(统一样式)

A.导航栏两侧文字按钮 1.需求: 所有导航栏两侧的文字式按钮统一样式 普通样式:橙色 高亮样式:红色 不可用样式:亮灰 阴影:不使用 字体大小:15 github: https://github.com/hellovoidworld/HVWWeibo 2.实现效果 默认样式: 统一使用样式: 3.思路 在创建item的时候逐个设置:代码超级冗余 抽取创建公共父类:稍好的选择,但是继承了此公共父类的控制器,就不能操作其去继承系统自带的控制器类了,造成很大的隐患.iOS中控制器不建议提取公共父类,

02---按钮的设置 控制器拥有导航栏包装一层导航控制器 添加子控制器 UIBarButtonItem导航按钮 设置导航栏UINavigationBar主题 设置状态栏样式

一.按钮的设置 1.设置背景图片 [btn setBackgroundImage:image forState:UIControlStateNormal]; 2.内部UIImageView 1> 设置内部UIImageView的图片 [btn setImage:image forState:UIControlStateNormal]; // 不能写成btn.imageView.image = image; 2> 调整内部图片的内容模式 self.imageView.contentMode =

仿新浪微博IOS客户端(v5.2.8)——设置导航栏外观

转载请标明出处:http://blog.csdn.net/android_ls/article/details/45849447 声明:仿新浪微博项目,所用所有图片资源都来源于官方新浪微博IOS客户端,编写本应用的目的在于学习交流,如涉及侵权请告知,我会及时换掉用到的相关图片. 一. 在Xcode6下添加.pch文件 对于使用惯了之前版本Xcode的朋友来说,在系统提醒之下升级到Xcode 6之后,发现新建项目后Xcode不再帮我们创建.pch文件了.可是我们已经习惯了,把一些在很多地方都用的宏

iOS不得姐项目--appearance的妙用,再一次设置导航栏返回按钮,导航栏左右按钮的封装(巧用分类)

一.UI_APPEARANCE_SELECTOR 彩票项目中appearance的用法一直没有搞明白,这次通过第二个项目中老师的讲解,更深一层次的了解到了很多关于appearance的作用以及使用方法. 在iOS属性后有UI_APPEARANCE_SELECTOR标志都可以一次性统一设置.这种情况还有很多.比如说统一设置UITabbarItem的文字颜色 通过appearance来同意设置属性最好是在+ (void)initialize;方法里面. 项目中设置导航栏背景图片的代码: 项目中设置T