xcode中给我内置很多app模版,不过很多时候我们需要更加灵活的初始化项目。下面我就简单介绍一下,如何从0开始制作一个tabbar app。

  1. 创建个项目,由于我们从头开始写程序,因此理论上对模版没有特殊的要求。这里我们选择Single View Application模版。
  2. 创建完成后,我们就可以开始写程序了。iOS app程序都是以一个UIWindows为基础的,因此我们只需创建好一个VC然后将windows的rootViewController设置为当前VC即可。下面是代码

'''

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
WordListVC * oneVC=[[WordListVC alloc] init];
WordListVC * twoVC=[[WordListVC alloc] init];
WordListVC * threeVC=[[WordListVC alloc] init];
oneVC.tabBarItem.title = @今日计划;
oneVC.tabBarItem.image = [UIImage imageNamed:@plan-icon];
twoVC.tabBarItem.title = @词汇列表;
twoVC.tabBarItem.image = [UIImage imageNamed:@list-icon];
//self.placeholderVC.tabBarItem.title = @";
threeVC.tabBarItem.title = @
生疏词汇;
threeVC.tabBarItem.image = [UIImage imageNamed:@
unfamiliar-words-icon];
//pvc.tabBarItem.title = @
设置;
//pvc.tabBarItem.image = [UIImage imageNamed:@
settings-icon"];
UITabBarController *tabbarController = [[UITabBarController alloc]init];
tabbarController.delegate = self;
[tabbarController setViewControllers:@[oneVC,twoVC,threeVC]];
[tabbarController setSelectedIndex:0];
tabbarController.tabBar.barTintColor = [UIColor whiteColor];
self.tabbarController = tabbarController;
self.window.rootViewController=self.tabbarController;
return YES;
}
'''

iOS 如何使用TabbarController的更多相关文章

  1. iOS 项目架构tabbarController 嵌套 navbarController

    简单思路: 进入APP,首先加载 splashVC,加载完成之后,在viewDidAppear里跳转到loginVC,(这里一定要在viewDidLoad方法里新建loginVC跳转). 登陆成功之后 ...

  2. 【iOS】自己定义TabBarController

    一.自己定义的思路 iOS中的TabBarController确实已经非常强大了.大部分主流iOS应用都会採用. 可是往往也不能满足所有的需求,因此须要自己定义TabBar,自己定义须要对系统的Tab ...

  3. iOS 自定义TabBarController

    转自:http://blog.csdn.net/xn4545945/article/details/35994863 一.自定义的思路 iOS中的TabBarController确实已经很强大了,大部 ...

  4. React-Native进阶_5.导航 Naviagtion

    有这样一个组件 他可以控制页面跳转 返回,在移动端叫做导航控制器, 在RN中叫路由 我们使用的  react-native-navigation 是一个开源组件库介绍:A complete nativ ...

  5. React Native导航器之react-navigation使用

    在上一节Navigation组件,我们使用系统提供的导航组件做了一个跳转的例子,不过其实战能力不强,这里推荐一个超牛逼的第三方库:react-navigation.在讲react-navigation ...

  6. iOS:CYLTabBarController【低耦合集成TabBarController】

    导航 与其他自定义TabBarController的区别 集成后的效果 项目结构 使用CYLTabBarController 第一步:使用CocoaPods导入CYLTabBarController ...

  7. iOS 在使用UINavigationController和TabBarController时view的frame

    可能是以前记错了,总认为在ios6上使用了UINavigationController或者TabBarController会因为多了bar而影响子controller的view的frame大小.今天在 ...

  8. iOS开发 tabBarController选中状态

    self.tabBarController.selectedIndex = 0;  // 默认是0:

  9. [iOS基础控件 - 6.12.4] NavigationController vs TabBarController

    A.属性 1. Item NavigationController: navigationItem (不需要创建) title rightBarButtonItems/ rightBarButtonI ...

随机推荐

  1. I.MX6 新版、旧版u-boot不兼容问题

    /************************************************************************* * I.MX6 新版.旧版u-boot不兼容问题 ...

  2. Python测试框架doctest

    doctest是python自带的一个模块.本博客将介绍doctest的两种使用方式:一种是嵌入到python源码中,另外一种是放到一个独立文件. doctest 的概念模型 在python的官方文档 ...

  3. make的link_directories命令不起作用

    按照<CMake Practice>中第六章的设置,采用include_directories命令去寻找共享库的路径,src/CMakeLists.txt如下: ADD_EXECUTABL ...

  4. [转载]文件过滤驱动 文件系统激活通知 IoRegisterFsRegistrationChange函数实现

    IoRegisterFsRegistrationChange 注册一个文件系统变动回调函数,用来被通知文件系统的激活和注销,激活是指第一次加载文件系统,当一个文件系统已经加载后,当加载一个同种文件系统 ...

  5. 使用Ajax选取ListBox的值异步更新视图,并作为表单值提交

    一.控制器返回一个ViewBag MultiSelecList值. public ActionResult Create() { ViewBag.ReviewIndexItems = new Mult ...

  6. python __builtins__ dict类 (17)

    17.'dict', 用于创建一个字典. class dict(object) | dict() -> new empty dictionary # 空字典 | dict(mapping) -& ...

  7. Spring boot整合redis实现shiro的分布式session共享

    我们知道,shiro是通过SessionManager来管理Session的,而对于Session的操作则是通过SessionDao来实现的,默认的情况下,shiro实现了两种SessionDao,分 ...

  8. Hexo瞎折腾系列(3) - 添加GitHub彩带和GitHub Corner

    页面右上角添加GitHub彩带 你可以在这里找到一共12种样式的GitHub彩带,复制其中的超链代码. 在themes\next\layout\_layout.swig目录下找到头部彩带相关的代码: ...

  9. queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards

    题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...

  10. Oracle JDK各版本下载地址记录

    Oracle JDK各版本下载地址: https://www.oracle.com/technetwork/java/javase/archive-139210.html