iOS中自定义导航控制器NavigationController
来源:互联网 发布:区块链 对等网络 编辑:程序博客网 时间:2024/04/30 11:12
iOS中自定义导航控制器NavigationController
#import "NavigationController.h"@interface NavigationController ()@end@implementation NavigationController- (void)viewDidLoad { [super viewDidLoad]; }/** * 系统在第一次使用这个类的时候调用 */+(void)initialize{ //1.设置导航栏主题 UINavigationBar *navBar=[UINavigationBar appearance]; NSString *bgName=nil; if (iOS7) { bgName=@"NavBar64"; //箭头的颜色 navBar.tintColor=[UIColor whiteColor]; }else{ bgName=@"NavBar"; } //设置背景图片 [navBar setBackgroundImage:[UIImage imageNamed:bgName] forBarMetrics:UIBarMetricsDefault]; //设置标题文字颜色 NSMutableDictionary *attrs=[NSMutableDictionary dictionary]; attrs[NSFontAttributeName]=[UIFont systemFontOfSize:18]; attrs[NSForegroundColorAttributeName]=[UIColor whiteColor]; [navBar setTitleTextAttributes:attrs]; //2.设置BarButtonItem的主题 UIBarButtonItem *item=[UIBarButtonItem appearance]; //设置文字颜色 NSMutableDictionary *itemAttrs=[NSMutableDictionary dictionary]; itemAttrs[NSFontAttributeName]=[UIFont systemFontOfSize:14]; itemAttrs[NSForegroundColorAttributeName]=[UIColor whiteColor]; [item setTitleTextAttributes:itemAttrs forState:UIControlStateNormal]; if (!iOS7) { //设置导航按钮背景 [item setBackgroundImage:[UIImage imageNamed:@"NavBackButton"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [item setBackgroundImage:[UIImage imageNamed:@"NavBackButtonPressed"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; //设置返回按钮的背景 [item setBackButtonBackgroundImage:[UIImage imageNamed:@"NavBackButton"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [item setBackButtonBackgroundImage:[UIImage imageNamed:@"NavBackButtonPressed"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; }}/** * 重写这个方法,能拦截所有的push操作,隐藏tabBar * */-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ viewController.hidesBottomBarWhenPushed=YES; [super pushViewController:viewController animated:animated]; }//-(UIViewController *)popViewControllerAnimated:(BOOL)animated//{// return [super popViewControllerAnimated:NO];//}@end
0 0
- iOS中自定义导航控制器NavigationController
- ios 导航控制器(navigationController)代码方式创建
- 猫猫学iOS 之微博项目实战(2)微博主框架-自定义导航控制器NavigationController
- AJ学IOS 之微博项目实战(2)微博主框架-自定义导航控制器NavigationController
- NavigationController导航控制器
- ios navigationController导航跳转方式自定义
- 导航控制器(NavigationController)中设置标题的常用方法
- iOS- 自定义导航控制器(-)
- iOS 自定义导航控制器UINavigationController
- 导航控制器(NavigationController)的生命周期
- IOS开发—自定义导航控制器
- ios自定义导航控制器转场动画
- iOS 9的自定义导航控制器
- iOS在自定义视图(常用于自定义cell)中获取导航控制器上面的当前的控制器对象
- iOS中导航控制器的使用 UINavigationController
- ios中导航控制器的使用
- iOS中navigationController相关
- 自定义UINavigationController(导航控制器)
- android底部布局被软键盘抬起的问题
- C++数据结构环形队列Deque实现
- Java国际化及Spring国际化解决方法
- JDBC:Spring框架中JDBCTemplate的使用
- Java线程池管理及分布式Hadoop调度框架搭建
- iOS中自定义导航控制器NavigationController
- 我的记事本项目之路(一)
- 使用文本/CAD数据集添加地图注记
- 中断请求级别
- 初次开通,多多赐教!
- 3D mesh 的质量评估(Perceptual Metrics Quality)
- Hibernate面试题及答案
- vim 多个标签之间切换
- clojure实战——基于logstash搭建日志数据获取与整理平台(2)