--------------

源代码:点击打开链接

------------------------

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的更多相关文章

  1. 一文搞懂Google Navigation Component

    一文搞懂Google Navigation Component 应用中的页面跳转是一个常规任务, Google官方提供的解决方案是Android Jetpack的Navigation componen ...

  2. iOS 生命周期

       应用生命周期 App启动:当App启动时,首先由not running状态切换到inactive状态,此时调用application:didFinishLaunchingWithOptions: ...

  3. iOS - UISplitViewController

    前言 NS_CLASS_AVAILABLE_IOS(3_2) @interface UISplitViewController : UIViewController @available(iOS 3. ...

  4. [iOS UI进阶 - 2.0] 彩票Demo v1.0

    A.需求 1.模仿“网易彩票”做出有5个导航页面和相应功能的Demo 2.v1.0 版本搭建基本框架   code source:https://github.com/hellovoidworld/H ...

  5. 09-UIKit(UICollectionViewController、UITabBarController)

    目录: 一.UICollectionViewController 二.UITabBarController(标签控制器) 三.视图和试图控制器的生命周期 四.其他控件 回到顶部 一.UICollect ...

  6. Swift # 项目框架

    利用Swift--简单的项目界面流程. TabBar+Navigation底部导航控制,界面的切换. GitHub源码分享,地址: URL:https://github.com/SpongeBob-G ...

  7. UIKit View PG

    View Program iOS View and Window Architecture The view draw cycle When a view first appears on the s ...

  8. (六十二)纯代码搭建UI

    在Xcode6中,去掉了Empty Application的选项,因此可以通过先创建SingleView,再删除storyboard,并且把工程设置中的main Interface清空. 通过AppD ...

  9. 【转】最近很火的 Safe Area 到底是什么

    iOS 7 之后苹果给 UIViewController 引入了 topLayoutGuide 和 bottomLayoutGuide 两个属性来描述不希望被透明的状态栏或者导航栏遮挡的最高位置(st ...

随机推荐

  1. Perl 多线程模块 Parallel::ForkManager

    Perl 多线程模块 Parallel::ForkManager 一个简单的并行处理模块.这个是用来对付循环的多线程处理. 放在循环前面. Table of Contents 1 Synops内容简介 ...

  2. JSON解析---初识

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式 全然独立于语言的文本格式 易于人阅读和编写 易于解析和生成 (网络传输速度快) JSON语法规则 数据在 ...

  3. UIApplication的作用

    1.设置app图标右上角的数字2.设置状态栏的属性(样式.是否要显示)3.打开某个链接\发短信\打电话4.keyWindow : 访问程序的主窗口(一个程序只能有一个主窗口)5.windows : 访 ...

  4. 光盘自动运行HTML页,Autorun文件写法

    1.把你的网页放在一个根目录下面,起名为index.html 2.在目录新建一个autorun.inf的文件,打开后编辑为以下内容: 代码如下: [autorun]icon=***.ico(加图标) ...

  5. Windows命令行(DOS命令)教程-5 (转载)http://arch.pconline.com.cn//pcedu/rookie/basic/10111/15325_4.html

    5. copy copy在英文中是复制的意思 [功能] 复制一个或一组文件到指定的磁盘或目录中 [格式] copy [C:][path][filename.ext] [C:][path]filenam ...

  6. 此项目的默认Web访问模式设置为文件共享, 但是无法从路径(此为转贴)

    故障现象: 当你打开ASP.NET Web项目时,如果出现这样的错误提示:提示窗口标题: Web访问失败提示内容: 此项目的默认Web访问模式设置为文件共享, 但是无法从路径“...”打开“...”处 ...

  7. UI基础视图----UIScrollView总结

    UIScrollView是UIKit框架下的很重要的视图类,是UIView的子类.UILabel,UIImageView,UIWebView分别用于展示文字,图片,网页,UILabel通过属性text ...

  8. java Eclipse debug技巧

    摘要:调试不仅可以查找到应用程序缺陷所在,还可以解决缺陷.对于Java程序员来说,他们不仅要学会如何在Eclipse里面开发像样的程序,更需要学会如何调试程序.本文介绍了Java程序员必知的10个调试 ...

  9. C++中引用和指针详解

    先来分析指针这个东东: 从概念上讲,指针本质上就是存放变量地址的一个变量,在逻辑上是独立的,它可以被改变,包括其所指向的地址的改变和其指向的地址中所存放的数据的改变. 上面的图表示了程序运行时变量的值 ...

  10. Mysql学习(慕课学习笔记7)修改数据表(下)

    添加主键约束 ALTER TABLE tb1_name ADD [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,…….) ...