object-ocUI之导航控件
来源:互联网 发布:梦幻西游高级宝石算法 编辑:程序博客网 时间:2024/06/05 14:29
1.删除系统自己给我们的main.board。和viewCollorer.h/.m文件 ,info.plist删除main
2.appDelegate.m
//手动创建window
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
//创建导航控制器
UINavigationController *naviga = [[UINavigationController alloc]initWithRootViewController:[[MYViewController alloc]init]];
//设置下面导航条图片
naviga.tabBarItem.image = [UIImage imageNamed:@"tab1.png"];
//创建标签控制器(width:49)
UITabBarController *MytabBar = [[UITabBarController alloc]init];
//添加到MytabBar
MytabBar.viewControllers = @[naviga,twoNavi,threeNavi];
//为了让他能启动加载这个window
[self.window makeKeyAndVisible];
3.创建导航右边和左边的按钮
首先定义按钮(系统自定义)
//创建右边按钮
UIBarButtonItem *btnGO = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(ClickedItem:)];
//自定义按钮用自定义按钮方法
UIBarButtonItem *btnUP = [[UIBarButtonItem alloc]initWithTitle:@"编辑" style:UIBarButtonItemStylePlain target:self action:@selector(ClickedItem:)];
//自定义设置导航默认的返回按钮
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:nil];
//改变图片返回按钮
[self.navigationController.navigationBar setBackIndicatorImage:[UIImage imageNamed:@"back_btn.png"]];
[self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"back_btn.png"]];
//自动以颜色按钮
[self.navigationController.navigationBar setTintColor:[UIColor purpleColor]];
//设置导航条按钮
[self.navigationController.navigationBar setBarTintColor:[UIColor orangeColor]];
//设置字体大小
[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:25],NSForegroundColorAttributeName:[UIColor blueColor]}];
4.使用导航页面跳转
SecondViewController *twoView = [[SecondViewController alloc]init];
//页面跳转
[self.navigationController pushViewController:twoView animated:YES];
5.页面回跳
//返回到最主页,弹出当前控制器,或者跳到指定页面
[self.navigationController popToRootViewControllerAnimated:YES];
- object-ocUI之导航控件
- OCUI界面设计:导航控制器
- OCUI界面设计:基础控件(一)
- OCUI界面设计:基础控件(二)
- Android导航控件之Toolbar
- OCUI界面设计:滚动视图与分页控件初探
- object-UI之基本控件
- 自定义View之字母导航控件
- QT自定义控件之导航栏实现
- 导航控件
- Discuz!NT控件剖析 之 左侧导航控件
- Discuz!NT控件剖析 之 左侧导航控件
- Android-自定义控件之组装控件(自定义导航)
- asp.net高级应用之站点导航TreeView控件
- asp.net高级应用之站点导航SiteMapPath控件
- ASP.NET高级应用之 (站点导航SiteMapPath控件)
- 自定义控件之android列表分组及字母导航
- IOS之导航栏中添加UITextView控件bug
- 解决jquery.validate1.11.1对metadate的支持
- [学习笔记]JavaScript基础--图形绘制
- C# IIS log日志转换成Table 传入数据库
- R语言k-means聚类
- 前端知识总结
- object-ocUI之导航控件
- Linux下C线程池的实现
- SparkSQL学习笔记(二)DataSource
- hdoj 1002(C实现)
- 树形结构的实现
- nodejs创建服务
- PVS-Studio C/C++/C++11 静态代码分析工具
- MyBatis--SqlSessionFactoryBuilder,SqlSessionFactory,SqlSession作用域和生命周期
- 二分图 最小覆盖数 = 最大匹配数、最大独立集 = 总数-最小覆盖集 证明 hdu 1068