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 ...
随机推荐
- xm学习笔记
1关于静态网页的制作 html主要负责页面的结构+css页面的美观+js与用户的交互. 2html 有标签体的标签: <p></p> <span></spa ...
- 升级 pip版本
安装第三方库:pip install Pillow 出现 You are using pip version 7.1.2, however version 9.0.1 is available. Yo ...
- Django之Cookie与Session
一.cookie 1.cookie使用 def cookie(request): print(request.COOKIES) # 获取所有的COOKIES obj = render(request, ...
- Python安装后在CMD命令行下出现“应用程序无法启动.............”问题
问题存在之一:系统是刚刚重做的精简版服务器系统(阉割版) AN就是在阿里云上刚开的Windows Server 2008 系统上碰到的 吓尿了都 症状: 正常安装python环 ...
- 学习iOS必须知道的[转载]
part1 : http://www.cocoachina.com/ios/20150608/12052.html part2 : http://www.cocoachina.com/ios/2015 ...
- Java中构造方法的执行顺序
一.先执行内部静态对象的构造方法,如果有多个按定义的先后顺序执行:静态对象在构造的时候也是也先执行其内部的静态对象. 二.再调用父类的构造方法(父类还有父类的话,从最开始的基类开始调用),如果没有明显 ...
- BZOJ4006 JLOI2015 管道连接(斯坦纳树生成森林)
4006: [JLOI2015]管道连接 Time Limit: 30 Sec Memory Limit: 128 MB Description 小铭铭最近进入了某情报部门,该部门正在被如何建立安全的 ...
- hdu Phone List
Problem Description Given a list of phone numbers, determine if it is consistent in the sense that n ...
- ajax请求参数为中文乱码的情况
解决中文乱码问题的方法有很多. 一.前提是ajax请求传递参数对象到后台,对象中的某个参数的值为中文,到后台之后出现乱码,导致报错.问题解决如下: rest层: 二.在tomcat的server.xm ...
- 遍历json的方式
var obj = eval("(" + data + ")"); for(var key in obj) { alert(obj[key]); }