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

源代码:点击打开链接

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

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. poj 2785 4 Values whose Sum is 0(折半枚举(双向搜索))

    Description The SUM problem can be formulated . In the following, we assume that all lists have the ...

  2. oendir(),readdir(),closedir() 打开/读取/关闭目录

    目录操作 当目标是目录而不是文件的时候,ls -l的结果会显示目录下所有子条目的信息,怎么去遍历整个目录呢?答案马上揭晓! 1. 打开目录 功能:opendir()用来打开参数name指定的目录,并返 ...

  3. .net中的特性

    本文来之:http://hi.baidu.com/sanlng/item/afa31eed0a383e0e570f1d3e 在一般的应用中,特性(Attribute,以称为属性)好像被使用的不是很多. ...

  4. C#中new和override的区别

    override是指“覆盖”,是指子类覆盖了父类的方法.子类的对象无法再访问父类中的该方法.(签名必须相同) new是指“隐藏”,是指子类隐藏了父类的方法,当然,通过一定的转换,可以在子类的对象中访问 ...

  5. VS2010使用附加进程的方式调试IIS中的页面介绍

    1.       对要测试的页面设置断点,然后选择”调试”->”附加到进程”,在进程中选择w3wp.exe进程(需要先打开需测试的页面) 2.       配置完成,当打开你需要测试的页面的时候 ...

  6. vim搜索后跳到下(上)一个

    搜索高亮后, 跳到下一个:小写n 上一个:大写N

  7. 初识数据字典【weber出品必属精品】

    数据字典结构 有两部分组成: 1. 基表:以$结尾的系统表,在创建数据库的时候,oracle自动创建的表 2. 用户可以访问的视图 数据字典的种类 DICTIONARY:简称DICT,所有的数据字典, ...

  8. UIView /  UIView的布局

    //! 一个视图可以有n个子视图,但是一个视图只能有一个父视图 struct CGRect {   CGPoint origin;   CGSize size; }; CGRectMake(CGFlo ...

  9. 通过 sp_configure 进行 Database Mail 配置

    通过 sp_configure 进行 Database Mail 配置 直接执行步骤一. 如果报错,则先执行步骤二,再执行步骤一. 一. sp_configre ; GO RECONFIGURE; G ...

  10. mysql-5.7.12-winx64.zip Windows (x86, 64-bit), ZIP Archive版免安装配置

    1.下载免安装版压缩包 下载地址:http://dev.mysql.com/downloads/mysql/ 选择符合你的操作系统的版本,点击download进入下载页面 不用注册也可以点击下载连接进 ...