导航栏与状态栏
2015-11-04 13:55
344 查看
//1.设置状态栏的字体为白色
- (UIStatusBarStyle)preferredStatusBarStyle{
[superpreferredStatusBarStyle];
returnUIStatusBarStyleLightContent;
}
//2.设置s所有Push之后的界面
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count
> 0) {
viewController.view.backgroundColor = [UIColorcolorWithRed:.95green:.95blue:.95alpha:1.0];
viewController.hidesBottomBarWhenPushed =YES;
[self.navigationBarsetBackgroundImage:[UIImageimageNamed:@"daohanglan"]forBarMetrics:UIBarMetricsDefault];
}
[superpushViewController:viewControlleranimated:animated];
}
//3.设置导航栏的字体大小与颜色
self.navigationController.navigationBar.titleTextAttributes
= @{
NSForegroundColorAttributeName:[UIColorwhiteColor],
NSFontAttributeName:[UIFontboldSystemFontOfSize:18]
};
//4.设置文字item的文字大小
UIBarButtonItem *rightItems = [[UIBarButtonItemalloc]initWithTitle:@"注册"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(rightAction:)];
[rightItems setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:[UIFontfontWithName:@"Helvetica-Bold"size:14.0],NSFontAttributeName,nil]forState:UIControlStateNormal];
self.navigationItem.rightBarButtonItem = rightItems;
//5.SB设置button为圆角
//6.push过去隐藏导航栏
playVC.hidesBottomBarWhenPushed =YES;
//7.设置返回按钮的颜色
navBar.tintColor =UIColor.orange
设置不同控制器的状态栏颜色不同
-(void)viewWillAppear:(BOOL)animated
{
[super
viewWillAppear:animated];
//设置不同界面的状态栏颜色不同
// 还得设置plist
里面 View controller-based status bar appearance
设置为no
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleLightContent;
}
- (void)viewDidAppear:(BOOL)animated{
[super
viewDidAppear:animated];
[self.navigationController.navigationBar
setShadowImage:[UIImage
new]];
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleLightContent;
}
- (void)viewWillDisappear:(BOOL)animated{
[super
viewWillDisappear:animated];
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleDefault;
}
- (UIStatusBarStyle)preferredStatusBarStyle{
[superpreferredStatusBarStyle];
returnUIStatusBarStyleLightContent;
}
//2.设置s所有Push之后的界面
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count
> 0) {
viewController.view.backgroundColor = [UIColorcolorWithRed:.95green:.95blue:.95alpha:1.0];
viewController.hidesBottomBarWhenPushed =YES;
[self.navigationBarsetBackgroundImage:[UIImageimageNamed:@"daohanglan"]forBarMetrics:UIBarMetricsDefault];
}
[superpushViewController:viewControlleranimated:animated];
}
//3.设置导航栏的字体大小与颜色
self.navigationController.navigationBar.titleTextAttributes
= @{
NSForegroundColorAttributeName:[UIColorwhiteColor],
NSFontAttributeName:[UIFontboldSystemFontOfSize:18]
};
//4.设置文字item的文字大小
UIBarButtonItem *rightItems = [[UIBarButtonItemalloc]initWithTitle:@"注册"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(rightAction:)];
[rightItems setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:[UIFontfontWithName:@"Helvetica-Bold"size:14.0],NSFontAttributeName,nil]forState:UIControlStateNormal];
self.navigationItem.rightBarButtonItem = rightItems;
//5.SB设置button为圆角
//6.push过去隐藏导航栏
playVC.hidesBottomBarWhenPushed =YES;
//7.设置返回按钮的颜色
navBar.tintColor =UIColor.orange
设置不同控制器的状态栏颜色不同
-(void)viewWillAppear:(BOOL)animated
{
[super
viewWillAppear:animated];
//设置不同界面的状态栏颜色不同
// 还得设置plist
里面 View controller-based status bar appearance
设置为no
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleLightContent;
}
- (void)viewDidAppear:(BOOL)animated{
[super
viewDidAppear:animated];
[self.navigationController.navigationBar
setShadowImage:[UIImage
new]];
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleLightContent;
}
- (void)viewWillDisappear:(BOOL)animated{
[super
viewWillDisappear:animated];
[UIApplication
sharedApplication].statusBarStyle =
UIStatusBarStyleDefault;
}
相关文章推荐
- 关于Class File Editor Sondurce not fou
- React Native Android Cookie Problem
- Servlet学习笔记_01_Servlet或javaee要了解的一些常识
- Submit Text2 插件下载列表 20151104 及离线安装方法
- Mybatis入门学习(一)
- eclipse运行jsp出现404错误怎么办?
- centos安装GO
- SQL Server中的事务日志管理(6/9):大容量日志恢复模式里的日志管理
- spring @Qualifier注解
- java中实现斐波那数列
- fatal error C1047: 对象或库文件“EDLib.lib”是使用比创建其他对象所用编译器旧的编译器创建的
- 企业信息化快速开发平台 JeeSite
- Linux 下 MySQL 启动与关闭 说明
- QT处理中文之QString转为const char *
- 关于SwipeRefreshLayout实现上拉加载更多,下拉加载更多的方法
- css布局--父级元素高度自适应
- Java输入输出之File类
- Android Studio高效率小技巧
- android-studio安装过程详解
- Block代码块