UINavigationController导航控制器
来源:互联网 发布:dbc2000麻痹戒指数据 编辑:程序博客网 时间:2024/05/17 05:17
-------------------------------------------------------------------------
//(初始化)导航栏竖屏44,还有20的标题,横屏32
//iPhone : 竖屏 44 横屏 32,iPad: 44
//导航栏透明度(默认半透明)
navVC.navigationBar.translucent = NO;
//返回键的颜色
navVC.navigationBar.tintColor = [UIColor whiteColor];
//导航栏背景色
navVC.navigationBar.barTintColor = [UIColor greenColor];
//是否隐藏导航栏
navVC.navigationBarHidden = NO;
UINavigationController * navVC = [[UINavigationController alloc] initWithRootViewController:firstVC];
//导航栏透明度(默认半透明)
navVC.navigationBar.translucent = NO;
//返回键的颜色
navVC.navigationBar.tintColor = [UIColor whiteColor];
//导航栏背景色
navVC.navigationBar.barTintColor = [UIColor greenColor];
//是否隐藏导航栏
navVC.navigationBarHidden = NO;
//导航栏设置背景图
//如果图片的尺寸是320*44,则图片显示在导航栏上
//如果图片尺寸是320* 64,则图片从状态栏开始显示
//如果两个都不是,则从状态栏开始平铺图片
[navVC.navigationBar setBackgroundImage:[UIImage imageNamed:@"title_bg.png"] forBarMetrics:UIBarMetricsDefault];
//设置背景色,不设可能产生BUG;
self.view.backgroundColor = [UIColor redColor];
//设置标题
self.navigationItem.title = @"首页";
//在导航栏添加按钮
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(bar)] autorelease];
//如果图片的尺寸是320*44,则图片显示在导航栏上
//如果图片尺寸是320* 64,则图片从状态栏开始显示
//如果两个都不是,则从状态栏开始平铺图片
[navVC.navigationBar setBackgroundImage:[UIImage imageNamed:@"title_bg.png"] forBarMetrics:UIBarMetricsDefault];
//设置背景色,不设可能产生BUG;
self.view.backgroundColor = [UIColor redColor];
//设置标题
self.navigationItem.title = @"首页";
//在导航栏添加按钮
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(bar)] autorelease];
//法二
self.navigationItem.rightBarButtonItem = self.editButtonItem;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[self.tabBarController setEditing:editing animated:YES];
{
[super setEditing:editing animated:animated];
[self.tabBarController setEditing:editing animated:YES];
}
//是否隐藏返回按钮
self.navigationItem.hidesBackButton = YES;
//推向下一页
//是否隐藏返回按钮
self.navigationItem.hidesBackButton = YES;
//推向下一页
[self.navigationController pushViewController:deta animated:YES];
//几种翻页时效果(魔态)[枚举]
deta.modalTransitionStyle = UIModalPresentationPageSheet;
//点按钮弹出一个视图或视图控制器(魔态)
[self presentViewController:detaVC(下一页面) animated:YES completion:^{NSLog(@"finishi ");}];
[self presentViewController:detaVC(下一页面) animated:YES completion:^{NSLog(@"finishi ");}];
//到下一页返回(取消弹出)
- (void)dismissPage
{
[self dismissViewControllerAnimated:YES completion:^{}];
}
{
[self dismissViewControllerAnimated:YES completion:^{}];
}
//返回到首页
[self.navigationController popToRootViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:YES];
//返回到上一层
[self.navigationController popViewControllerAnimated:YES];
[self.navigationController popViewControllerAnimated:YES];
//返回到指定界面
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
//再所有页面中找到tabView,reloadData刷新页面
NSArray *allControllers = self.navigationController.viewControllers;
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
//再所有页面中找到tabView,reloadData刷新页面
NSArray *allControllers = self.navigationController.viewControllers;
//找到指定页面
UITableViewController *tableViewController = [allControllers objectAtIndex:[allControllers count]-2];
[tableViewController.tableView reloadData];//刷新页面
UITableViewController *tableViewController = [allControllers objectAtIndex:[allControllers count]-2];
[tableViewController.tableView reloadData];//刷新页面
修改navigationBar title的背景颜色
0 0
- 导航视图控制器UINavigationController
- 导航控制器 ( UINavigationController )
- 导航控制器UINavigationController
- UINavigationController导航控制器详解
- UINavigationController导航控制器…
- UINavigationController导航控制器…
- UINavigationController导航控制器…
- UINavigationController 导航控制器
- 导航控制器UINavigationController
- 导航控制器:UINavigationController
- 自定义UINavigationController(导航控制器)
- swift UINavigationController 导航控制器
- UINavigationController 导航视图控制器
- UINavigationController 导航控制器
- UINavigationController 导航控制器
- UINavigationController导航控制器
- UI UINavigationController导航控制器
- UINavigationController---导航控制器
- 最常见的5个导致 RAC 实例崩溃的问题
- C#Update批量更新数据
- Android基础之使用Fragment控制切换多个页面
- oracle-function 练习
- ListFragment和ListActivity的setOnItemClickListener不起作用
- UINavigationController导航控制器
- 微内核架构模式
- 【网络流】 HDOJ 3395 Special Fish
- iOS网络请求
- 嵌入式 yum配置与使用(很详细)
- Mosquitto服务的安装和使用
- android 底部导航实现方法汇总!
- 初探swift语言的学习笔记十(block)
- android小问题 RadioButton不能互斥