iOS 设置导航栏的颜色和导航栏上文字的颜色
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
#import "AppDelegate.h"
#import "KeyViewController.h"
@interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
//初始化导航
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:[[KeyViewController alloc] init]]; //设置导航栏的背景颜色(iOS7之后)
[[UINavigationBar appearance] setBarTintColor:[[UIColor alloc] initWithRed:/255.0 green: blue:/255.0 alpha:]]; //使用背景图片来设置导航栏的颜色(iOS7之后)
// [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"顶栏背景"] forBarMetrics:UIBarMetricsDefault]; //设置导航栏上文字的颜色(iOS7之后)
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]}];
self.window.rootViewController = navi; [self.window makeKeyAndVisible];
return YES;
} @end
#import <UIKit/UIKit.h> @interface KeyViewController : UIViewController @end
#import "KeyViewController.h" @interface KeyViewController () @end @implementation KeyViewController - (void)viewDidLoad {
[super viewDidLoad];
self.title = @"提取现金"; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
iOS 设置导航栏的颜色和导航栏上文字的颜色的更多相关文章
- iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicati ...
- [BS-03] 统一设置UITabBarController管理的所有VC的tabBarItem图标文字的颜色大小等属性
1. 统一设置UITabBarController管理的所有VC的tabBarItem图标文字的颜色大小等属性 . 统一设置UITabBarController管理的所有VC的tabBarItem图标 ...
- ios - 设置一个VC的navigationController的显示图案或文字,其他navigationController依旧不变
1. override func viewDidLoad() { super.viewDidLoad() self.navigationController?.delegate = self } 2. ...
- MPAndroidChart柱子上的文字的颜色dataSet.setValueTextColors
版本:MPAndroidChart v3.1.0 这是个很强大的图表,不同的版本对应的API会不一样. 需求描述: 用了柱状图,但要实现这样的功能,通过不同的门店来区分不同的柱子的颜色,并且柱子上文字 ...
- iOS之旅--隐藏(去除)导航栏底部横线
iOS之旅--隐藏(去除)导航栏底部横线 iOS开发大部分情况下会使用到导航栏,由于我司的app导航栏需要与下面紧挨着的窗口颜色一致,导航栏底部的横线就会影响这个美观,LZ使用了以下方法.觉得不错,分 ...
- iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
iOS精选源码 APP启动视频 自定义按钮,图片可调整图文间距SPButton 一款定制性极高的轮播图,可自定义轮播图Item的样式(或只... iOS 筛选菜单 分段选择器 仿微信导航栏的实现,让你 ...
- iOS侧滑返回到隐藏导航栏的VC,导航栏会闪现一次
VCA:是一个隐藏导航栏的页面:VCA在ViewWillAppear生命周期函数中设置导航栏隐藏: //隐藏导航栏 [self.navigationController setNavigationBa ...
- android 开发 修改系统背景(状态栏颜色、导航栏颜色、标题栏颜色等等)
1.打开values下的styles.xml 发现有以下代码: <resources> <!-- Base application theme. --> <style n ...
- iOS开发UI篇—多控制器和导航控制器简单介绍
iOS开发UI篇—多控制器和导航控制器简单介绍 一.多控制器 一个iOS的app很少只由一个控制器组成,除非这个app极其简单.当app中有多个控制器的时候,我们就需要对这些控制器进行管理 有多个vi ...
随机推荐
- CSS3:过渡大全
代码 地址:http://jsbin.com/moquyesumi/edit?html,output <!DOCTYPE HTML> <html> <head> & ...
- 只要项目是maven构建的,pom.xml中依赖的jar包全都默认去你电脑本地仓库去找
只要项目是maven构建的,pom.xml中依赖的jar包全都默认去你电脑本地仓库去找
- django通过middleware计算每个页面的详细执行时间
你可以自定义一个MiddleWare类,然后在settings.py引用这个中间件,添加到MIDDLEWARE_CLASSES里,然后在公共模板里添显示代码即可. 添加到公共模板里的代码: <d ...
- 利用反射得到android存储路径
获得android手机的存储路径: public String getPrimaryStoragePath(){ try{ StorageManager sm = (StorageManager) c ...
- DirectX 常用选项(转)
内存池表面和其它一些Direct3D资源被放在多种内存池中.内存池的种类由D3DPOOL枚举类型的一个成员来指定.可用到的内存池有下列几种:D3DPOOL_DEFAULT--表示Direct3D将根据 ...
- Java 常见问题思考
Java中的成员变量是选择在声明时赋值还是在构造函数中赋值? // 通过构造函数赋值 public class UserRequestImpl extends ModuleImplBase { pri ...
- VS C++ 从一个窗口创建另一个窗口
一.在stdafx.h文件中,添加: #include "Form2.h" / stdafx.h : 标准系统包含文件的包含文件, // 或是经常使用但不常更改的 // 特定于项目 ...
- 实例讲述PHP面向对象的特性;;;php中const与define的使用区别
php中const与define的使用区别 1.const:类成员变量定义,一旦定义且不能改变其值. define:定义全局常量,在任何地方都可以访问.2.define:不能在类中定义,而const可 ...
- openssh-server 安装
sudo apt-get update sudo apt-get install openssh-server 1:ssh-keygen -t rsa -f ~/.ssh/id_rsa 这里会提示输入 ...
- ThreadPoolExecutor 分析
一.从用法入手 Creates a thread pool that creates new threads as needed, but will reuse previously construc ...