设置全局导航栏颜色,标题大小和UIBarButtonItem字体大小

  设置全局导航栏颜色,标题大小和UIBarButtonItem字体大小

在appdelegate里面设置

swift:

UINavigationBar.appearance().barTintColor = UIColor.init(red: 47, green: 48, blue: 52)

UINavigationBar.appearance().tintColor = UIColor.whiteColor()

UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont.boldSystemFontOfSize(18),NSForegroundColorAttributeName: UIColor.whiteColor()]

UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont.boldSystemFontOfSize(15),NSForegroundColorAttributeName: UIColor.whiteColor()], forState: UIControlState.Normal)

oc:

#pragma mark -  设置全局返回按钮,无文字

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

forBarMetrics:UIBarMetricsDefault];

如果需要设置导航栏颜色,使barItem颜色也被渲染了,可以这样设置(就可以保证barItem里面图片的颜色不被渲染了)

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage: [[UIImage imageNamed: @"xiaoxi_icon"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] style: UIBarButtonItemStylePlain target: self action: @selector(a)];

如果导航栏与view出现了空隙。需要把系统默认设置空隙值关掉

#pragma 设置控制器,出现默认知道空隙

//    self.automaticallyAdjustsScrollViewInsets = NO;

时间: 2024-08-25 02:42:51

设置全局导航栏颜色,标题大小和UIBarButtonItem字体大小的相关文章

IOS 导航栏颜色 标题

修改导航栏颜 1 #define COLOR_TOMATO    [UIColor colorWithRed:255/255.0f green:99/255.0f blue:71/255.0f alpha:1.0f]     /*!< 番茄色 */ 2 3 self.navigationController.navigationBar.barTintColor = COLOR_TOMATO;//修改导航栏颜色 修改导航栏标题字体(大小.颜色) 1 self.navigationControlle

设置BottomNavigationBar导航栏的间距和文字,图片大小

找了好久都没有找到怎么设置导航栏的文字大小和图片大小.后来朋友给推荐使用反射的方式很好用.特意保存下来,以备不时之需. 朋友博客地址 private void setBottomNavigationItem(int space, int imgLen) { float contentLen = 36; Class barClass = bottomNavigationBar.getClass(); Field[] fields = barClass.getDeclaredFields(); fo

ios 导航栏透明, 上下滑动 导航栏 颜色渐变

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "PingFang SC"; color: #008400 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #3d1d81 } p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #008400 } p.p4 {

设置二级导航栏的返回按钮

1. 一般情况下的导航栏跳转,当在一级界面跳转到二级界面的时候,左item的会出现 “返回箭头+一级导航栏的标题”: 比如说:一级导航栏是“白菜精华”,那么二级导航栏的返回键是 : 2. 当我们使用下方的代码(下方代码是在一级界面写)时,确实可以当跳转到二级界面的时候,左上角是“返回图标 + 返回”: self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UI

小程序自定义单页面、全局导航栏

摘要: 小程序开发技巧. 作者:小白 原文:小程序自定义单页面.全局导航栏 Fundebug经授权转载,版权归原作者所有. 需求 产品说小程序返回到首页不太方便,想添加返回首页按钮,UI说导航栏能不能设置背景图片,因为那样设计挺好看的. 需求分析并制定方案 这产品和UI都提需求了,咱也不能反驳哈,所以开始调研,分析可行性方案:1.可以添加悬浮按钮.2.自定义导航栏. 添加悬浮按钮,是看起来是比较简单哈,但是感觉不太优雅,会占据页面的空间,体验也不太好.所以想了下第二种方案,自定义导航栏既可以实现

TableView下拉表头放大 导航栏颜色透明度随着TableView偏移量渐变

TableView 下拉表头放大 导航栏颜色透明度随着TableView偏移量渐变 用storeboard 布局,之前尝试在storeboard中设置tableview的表头,但是那样弄出来的效果 表头不贴着上面,后来改成storeboard和代码 结合,最后实现的这个效果 下载链接: https://github.com/ShaoWenLe/TableViewThe-drop-down-amplification.git import UIKit let KScreen_Width = UIS

导航栏颜色渐变

1.导航栏开始时是没有导航栏的感觉,往上滚动后又出现导航栏,采用下面的方法 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat minAlphaOffset = - 88; CGFloat maxAlphaOffset = 200; CGFloat offset = scrollView.contentOffset.y; CGFloat alpha; if (offset <= 0) { alpha = 0.0; }

在eclipse 设置编辑区、控制台、xml等文本文件字体大小

eclipse 编辑区 设置字体大小: 窗口(Window)-首选项(Preferences)-常规(General)-外观(Appearence)-颜色与字体(Colors And Fonts),在右边的对话框里选择Java - Java Editor Text Font,点击出现的修改(Change)按钮,可以设置显示在在主窗体中程序的字体大小,设置完之后点击右下角的应用(Apply),最后点击确定(OK)即可. eclipse 设置 控制台 字体大小 : windows----->pref

CSS font-size字体文字大小样式属性-字体大小样式篇

一.设置字体大小CSS单词与语法 - TOP基本语法结构: .divcss5{font-size:12px;}设置了文字大小为12px像素Font-size+字体大小数值+单位 单词:font-size语法:font-size : absolute-size | relative-size | length取值:xx-small | x-small | small | medium | large | x-large | xx-largexx-small:最小x-small:较小small:小m