修改NavigationBar样式
iOS Tip: Change Status Bar Icon & Text Colors
When iOS 7 was introduced Apple allowed your application to extend all the way up into the status bar region. This was neat because you can scroll content behind it, change the color, and make the entire screen feel completely full. One thing that has upset me is that it isn’t really straight forward as to how to change the color of the time, carrier, battery, and other icons that live in the status bar. So here is my quick tips.
Launch Screen Colors
In general you can just hide the status bar at launch, but if you want the time to overlay on it you will need to head into your Info.plist file. You will find a Status Bar entry and you simply need to change it to Light Content and then it will display white text and icons. Or set this info in you info.plist.
Inside UIViewControllers
Now inside the UIViewControllers are a bit different. We first want to style the tint and the bar tint of the navigation bar. I am goign to set it to a blue background with a white tint. I do this in my FinishedLaunching where I create my UINavigationController in the AppDelegate:
navigationController.NavigationBar.TintColor = UIColor.White;
navigationController.NavigationBar.BarTintColor = UIColor.FromRGB(52,152,219);
Now were are getting closer, but still have 2 issues.
The text is black
The status bar icons and text are black
NavigationBar Text Appearance
To fix the text we head back to our AppDelegate and we have to update the “TitleTextAttributes” of our UINavigationBar.Appearance:
UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes
{
TextColor = UIColor.White
});
view rawtext.cs hosted with ❤ by GitHub
Status Bar
From my findings teh status bar on each UIViewController is actually controlled separatelly, which is very annoying. We must update the NavigationBar.BarStyle and set it to the BlackStyle to get the desired white text and icons. I do this on the ViewDidLoad method.
NavigationController.NavigationBar.BarStyle = UIBarStyle.Black;
There you have it! A nice new themed iOS app. If you find a better way of doign this please let me know in the comments.
Xamarin.Forms!
If you are using Xamarin.forms you must also set the BarTextColor = Color.White on your NavigationPage! - See more at: http://motzcod.es/post/110755300272/ios-tip-change-status-bar-icon-text-colors#sthash.rUVotNJp.dpuf
修改NavigationBar样式的更多相关文章
- MFC学习 修改窗口样式
1. 在PreCreateWindow中可用CREATESTRUCT cs, cs.lpszName修改窗口标题, cs.lpszClass = AfxRegisterWndClass 修改图标与样式 ...
- JS笔记一:动态修改css样式
---恢复内容开始--- 最近在学习CSS/JS的样式,两个合学习一起学习,加深JS的书写和了解. 一.通过Javasript修改图片大小 通过函数来传递图片id,height,width,使用doc ...
- ASP.NET中直接用C# 动态修改CSS样式
ASP.NET中直接用C# 动态修改CSS样式 wonsoft (wonsoft@163.com) 使用JavaScript控制CSS样式有点麻烦,还是觉得直接使用C#操作更方便快捷,本文通过两个B ...
- js介绍,js三种引入方式,js选择器,js四种调试方式,js操作页面文档DOM(修改文本,修改css样式,修改属性)
js介绍 js运行编写在浏览器上的脚本语言(外挂,具有逻辑性) 脚本语言:运行在浏览器上的独立的代码块(具有逻辑性) 操作BOM 浏览器对象盒子 操作DOM 文本对象 js三种引入方式 (1)行间式: ...
- vue-cli —— 局部修改Element样式
最近在做vue项目时用到了Element,发现这玩意儿用起来很舒服,很新颖,上手也很快,而且效果足够酷炫.但是后面发现一个很大的问题,那就是Element的样式有限,这极大地限制了项目的应用广度,所以 ...
- vue修改框架样式/deep/
/deep/ 父元素的样式名 /deep/ 要修改的样式名 使用 ... 貌似不行
- 【转】如何修改 video 样式
我们这里说的“修改 video 样式”并不是要自己实现一套 controls,而是尝试修改 video 的默认样式 隐藏全屏按钮 这个很容易查到 video::-webkit-media-contro ...
- Android spinner默认样式不支持换行和修改字体样式的解决方法
在spinner中显示的数据过多,需要换行,而Android自身提供的android.R.layout.simple_spinner_dropdown_item样式不支持换行,因此参考android提 ...
- 修改placeholder样式
/* 修改placeholder样式,兼容性 新版火狐,IE10+ */ .login-input::-webkit-input-placeholder { color: #000; font-siz ...
随机推荐
- 简单的java程序通过对话框输出 计算加减乘除运算(运算方法可选择)
import javax.swing.JOptionPane; // import class JOptionPane public class Addition { public static vo ...
- 32bit程序在64bit操作系统下处理重定向细节(转自http://bbs.pediy.com/showthread.php?t=89054)
1. 64bit操作系统的重定向机制以及目的 在64bit操作系统中,为了无缝兼容32bit程序的运行,64bit的Windows操作系统采用重定向机制.目的是为了能让32bit程序在64bit的操作 ...
- 将图片设置给ImageView时的属性配置
将图片设置给ImageView的时候,由于图片大小和逻辑需求的不确定会造成实际产生的效果和我们实际的需求不符的情况,这时需要对imageVIew控件添加scaleType属性,下面我用两张图片帮大家轻 ...
- 触发器实现对插入数据的字段更改 Oracle+SQL Server
最近有个使用触发器实现对插入数据的某个列做更改的需求,因此整理了Oracle和SQL Server对于此类需求的触发器写法,本文仅提到了Insert触发器. 首先我们创建一张表: --创建Test表 ...
- Python查询MySQL进行远程采集图片实例
这是四五年以前做小说站采集图片时写过唯一一次 Python 代码 #!/usr/bin/python #-*-coding:utf-8-*- import MySQLdb, os, socket, t ...
- 计算机网络课程优秀备考PPT之第五章网络层(五)
为了记录自己从2016.9~2017.1的<计算机网络>助教生涯,也为了及时梳理和整写笔记! 前期博客是, 计算机网络课程优秀备考PPT之第一章概述(一) 计算机网络课程优秀备考PPT之第 ...
- WOT2016大数据技术峰会——千人技术盛宴
WOT2016大数据技术峰会是一场聚焦大数据领域最前沿的的技术及经验分享.2016年11月25-26日北京粤财JW万豪酒店如约而至,会议规模达到1000人! 由51CTO主办的千人技术盛宴--WOT2 ...
- [转]Ubuntu系统下常用的新建、删除、拷贝文件命令
我们在Ubuntu系统中安装程序时,经常要在usr目录下新建.拷贝文件,此文件夹在Linux类系统中需要root权限才能访问,因此用常规的鼠标右键菜单操作是无效的,今天分享一下在终端中使用命令新建.拷 ...
- 点击其他地方隐藏div
document.onclick = function(e){ var ele = e?e.target:window.event.srcElement; if(ele.id !== 'valueSh ...
- ubuntu 14.04 GDAL
autotools-dev comerr-dev hdf5-helpers icu-devtools krb5-multidev libarmadillo4 libarpack2 libblas3 l ...