tabbar 嵌套 navigation
--------------
源代码:点击打开链接
------------------------
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
// Override point for customization after application launch.
if ([[UIDevicecurrentDevice]userInterfaceIdiom] ==UIUserInterfaceIdiomPhone) {
UIViewController *oneVC = [[OneViewControlleralloc]initWithNibName:@"one_iphone"bundle:nil];
UINavigationController *Nav1 = [[UINavigationControlleralloc]initWithRootViewController:oneVC];
UIViewController *twoVC = [[TwoViewControlleralloc]initWithNibName:@"two_iphone"bundle:nil];
UINavigationController *Nav2 = [[UINavigationControlleralloc]initWithRootViewController:twoVC];
UIViewController *threeVC = [[ThreeViewControlleralloc]initWithNibName:@"three_iphone"bundle:nil];
UINavigationController *Nav3 = [[UINavigationControlleralloc]initWithRootViewController:threeVC];
UIViewController *fourVC = [[FourViewControlleralloc]initWithNibName:@"four_iphone"bundle:nil];
UINavigationController *Nav4 = [[UINavigationControlleralloc]initWithRootViewController:fourVC];
self.tabbarController = [[UITabBarControlleralloc]init];
self.tabbarController.viewControllers =@[Nav1,Nav2,Nav3,Nav4];
}else {
UIViewController *oneVC = [[OneViewControlleralloc]initWithNibName:@"one_ipad"bundle:nil];
UINavigationController *oneNav = [[UINavigationControlleralloc]initWithRootViewController:oneVC];
UIViewController *twoVC = [[TwoViewControlleralloc]initWithNibName:@"two_ipad"bundle:nil];
UINavigationController *twoNav = [[UINavigationControlleralloc]initWithRootViewController:twoVC];
UIViewController *threeVC = [[ThreeViewControlleralloc]initWithNibName:@"three_ipad"bundle:nil];
UINavigationController *threeNav = [[UINavigationControlleralloc]initWithRootViewController:threeVC];
UIViewController *fourVC = [[FourViewControlleralloc]initWithNibName:@"four_ipad"bundle:nil];
UINavigationController *fourNav = [[UINavigationControlleralloc]initWithRootViewController:fourVC];
self.tabbarController = [[UITabBarControlleralloc]init];
self.tabbarController.viewControllers =@[oneNav,twoNav,threeNav,fourNav];
}
self.window.rootViewController =self.tabbarController;
self.window.backgroundColor = [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
return YES;
}
-------------------------
OneViewController.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.title =@"one";
self.tabBarItem.image = [UIImageimageNamed:@"second.png"];
//navigationbar 右边的按钮
UIBarButtonItem *rightButton = [[UIBarButtonItemalloc]initWithTitle:@"下一层" style:UIBarButtonItemStyleBordered target:self action:@selector(rightTap:)];
self.navigationItem.rightBarButtonItem = rightButton;
//navigationbar 左边的按钮
UIBarButtonItem *leftButton = [[UIBarButtonItemalloc]initWithTitle:@"更多"style:UIBarButtonItemStyleBorderedtarget:selfaction:@selector(leftTap:)];
self.navigationItem.leftBarButtonItem = leftButton;
}
return self;
}
----------------------------
navigation 从第一层跳到第二层里面。。
- (IBAction)rightTap:(id)sender {
oneAViewController *VC = [[oneAViewControlleralloc]initWithNibName:@"oneA_iphone"bundle:nil];
VC.title =@"第二层";
[self.navigationControllerpushViewController:VCanimated:YES];
}
----------
显示98%。。。显示百分号%
valueLabel.text = [NSString stringWithFormat:@"%.0f%%",progressValue];
---------------------------
tabbar 嵌套 navigation的更多相关文章
- 一文搞懂Google Navigation Component
一文搞懂Google Navigation Component 应用中的页面跳转是一个常规任务, Google官方提供的解决方案是Android Jetpack的Navigation componen ...
- iOS 生命周期
应用生命周期 App启动:当App启动时,首先由not running状态切换到inactive状态,此时调用application:didFinishLaunchingWithOptions: ...
- iOS - UISplitViewController
前言 NS_CLASS_AVAILABLE_IOS(3_2) @interface UISplitViewController : UIViewController @available(iOS 3. ...
- [iOS UI进阶 - 2.0] 彩票Demo v1.0
A.需求 1.模仿“网易彩票”做出有5个导航页面和相应功能的Demo 2.v1.0 版本搭建基本框架 code source:https://github.com/hellovoidworld/H ...
- 09-UIKit(UICollectionViewController、UITabBarController)
目录: 一.UICollectionViewController 二.UITabBarController(标签控制器) 三.视图和试图控制器的生命周期 四.其他控件 回到顶部 一.UICollect ...
- Swift # 项目框架
利用Swift--简单的项目界面流程. TabBar+Navigation底部导航控制,界面的切换. GitHub源码分享,地址: URL:https://github.com/SpongeBob-G ...
- UIKit View PG
View Program iOS View and Window Architecture The view draw cycle When a view first appears on the s ...
- (六十二)纯代码搭建UI
在Xcode6中,去掉了Empty Application的选项,因此可以通过先创建SingleView,再删除storyboard,并且把工程设置中的main Interface清空. 通过AppD ...
- 【转】最近很火的 Safe Area 到底是什么
iOS 7 之后苹果给 UIViewController 引入了 topLayoutGuide 和 bottomLayoutGuide 两个属性来描述不希望被透明的状态栏或者导航栏遮挡的最高位置(st ...
随机推荐
- SQL 使用经验
1. 写存储过程,Update数据库表,一定要根据idRow,也就是主键唯一键来更新. 更新操作,如果根据其他条件更新,之后就有的忙活了. 2. Query语句要加NOLOCK
- c语言编程之sglib库的简单使用
说实话自从大学毕业后已经很久没有用c语言写过程序了,一般都是使用c++,c++的stl和boost等,这些代码库大大简化了我们的编程复杂度.由于最近某种原因在次开始用c写程序.我是个比较懒的人,比较喜 ...
- BNU10806:请在此处签到
每年圣诞,ZUN都会邀请很多人到幻想乡举行联欢,今年也不例外.在联欢前,所有人需要在自己的昵称旁签到(签全名),以示出席.然后ZUN 会把大家的签到表保存下来作为纪念,以激励来年努力工作. 昵称: ...
- C++类的继承实例
首先由三个类分别为DateType(日期类).TimeType(时间类).DateTimeType(日期时间内).详细代码例如以下: #include <iostream> using n ...
- mogodb亿万级数据性能測试
本机 i7四核 8G 废话少说 mogodb 最像sql的nosql 使用批量插入一次20万循环10次总共200万数据用时65秒(尝试一次50万只是报内存溢出了,原因未知) 插入2000万数据用时10 ...
- C#界面设计疑问2:panel摆放问题
1.问题1是这样的,网友意思让使用一个按键对应显示一个panel 即,http://zhidao.baidu.com/question/1924974374730559427.html 2.那么我在设 ...
- GacLib使用方法(一)
GacLib使用方法 这是vczh大神的GacLib库新手入门,为自己做点笔记,详细的信息可以参考网页.下面简单说说怎么在自己的程序中使用GacLib库,本文只是前述网址中新手教程的一点体验,使用的环 ...
- HDU 4612 (13年多校第二场1002)无向图缩点,有重边
这道题是多校的题,比赛的时候是一道纷纷水过的板刷题. 题意:给你一些无向边,只加一条边,使该图的桥最少,然后输出最少的桥. 思路:当时大致想到思路了,就是缩点之后找出最长的链,然后用总的桥数减去链上的 ...
- wind7下搭建ftp服务器
一.首先在本地机器上创建一个用户!这些用户是用来登录到FTP的!我的电脑右键->控制面板->管理工具->计算机管理->本地用户和组->用户->“右键”新建用户-&g ...
- CSS Reset方法
CSS Reset 即重设浏览器的样式.在各种浏览器中,都会对CSS的选择器默认一些数值,譬如当h1没有被设置数值时,显示一定大小. 但并不是所有的浏览器都使用一样的数值,所以,有了CSS Reset ...