iOS开发——UI篇Swift篇&UITabBarController
UITabBarController
class UITabBarControllerController: UIViewController {
var titleString:String!
@IBOutlet var titleLabel:UILabel!
@IBOutlet var tabBarCtl:UITabBarController!
//返回按钮事件
@IBAction func backButtonClick()
{
self.navigationController?.popViewControllerAnimated(true)
}
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = titleString
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
//打开一个新的视图控制器,由UITabBarController创建
@IBAction func creatTabBarController()
{
self.presentViewController(self.tabBarCtl, animated: true, completion: {
})
}
//创建代码UITabBarController
@IBAction func usedCodeCreatTabBarController()
{
//定义第1视图控制器
var itemCtl1 = ItemController1()
//定义第2视图控制器
var itemCtl2 = ItemController2()
//定义第3视图控制器
var itemCtl3 = ItemController3()
//定义第4视图控制器
var itemCtl4 = ItemController4()
//定义UITabBarController
var newTabBarCtl = UITabBarController()
//添加要管理4的视图
newTabBarCtl.addChildViewController(itemCtl1)
newTabBarCtl.addChildViewController(itemCtl2)
newTabBarCtl.addChildViewController(itemCtl3)
newTabBarCtl.addChildViewController(itemCtl4)
//或者,通过setViewControllers方法来一起设置
newTabBarCtl.setViewControllers([itemCtl1,itemCtl2,itemCtl3,itemCtl4], animated: true)
//创建4个UITabBarItem 实例
var barItem1 = UITabBarItem(title: )
var barItem2 = UITabBarItem(title: )
var barItem3 = UITabBarItem(title: )
var barItem4 = UITabBarItem(title: )
//重新设置4个控制的tabBarItem
itemCtl1.tabBarItem = barItem1
itemCtl2.tabBarItem = barItem2
itemCtl3.tabBarItem = barItem3
itemCtl4.tabBarItem = barItem4
//推出UITabBarController
self.presentViewController(newTabBarCtl, animated: true, completion: {
})
}
}
iOS开发——UI篇Swift篇&UITabBarController的更多相关文章
- iOS开发——技术精华Swift篇&Swift 2.0和Objective-C2.0混编之第三方框架的使用
swift 语言是苹果公司在2014年的WWDC大会上发布的全新的编程语言.Swift语言继承了C语言以及Objective-C的特性,且克服了C语言的兼容性问题.Swift语言采用安全编程模式,且引 ...
- iOS开发——新特性Swift篇&Swift 2.0 异常处理
Swift 2.0 异常处理 WWDC 2015 宣布了新的 Swift 2.0. 这次重大更新给 Swift 提供了新的异常处理方法.这篇文章会主要围绕这个方面进行讨论. 如何建造异常类型? 在 i ...
- iOS开发——UI精选OC篇&UIApplication,UIWindow,UIViewController,UIView(layer)简单介绍
UIApplication,UIWindow,UIViewController,UIView(layer)简单介绍 一:UIApplication:单例(关于单例后面的文章中会详细介绍,你现在只要知道 ...
- iOS开发——网络编程Swift篇&Alamofire详解
Alamofire详解 预览图 Swift Alamofire 简介 Alamofire是 Swift 语言的 HTTP 网络开发工具包,相当于Swift实现AFNetworking版本. 当然,AF ...
- ios开发——实用技术总结Swift篇&swift常用开发技术总结
swift常用开发技术总结 懒加载:属性,数组(字典),控件... 数组(懒加载): lazy var shops:Array<Dictionary<String, String>& ...
- iOS开发——网络编程Swift篇&(八)SwiftyJSON详解
SwiftyJSON详解 最近看了一些网络请求的例子,发现Swift在解析JSON数据时特别别扭,总是要写一大堆的downcast(as?)和可选(Optional),看?号都看花了.随后发现了这个库 ...
- ios开发——实用技术篇Swift篇&地址薄、短信、邮件
//返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnimated(tru ...
- iOS开发——图形编程Swift篇&CAShapeLayer实现圆形图片加载动画
CAShapeLayer实现圆形图片加载动画 几个星期之前,Michael Villar在Motion试验中创建一个非常有趣的加载动画. 下面的GIF图片展示这个加载动画,它将一个圆形进度指示器和圆形 ...
- iOS开发零基础--Swift篇 元组
元组的介绍 元组是Swift中特有的,OC中并没有相关类型 它是什么呢? 它是一种数据结构,在数学中应用广泛 类似于数组或者字典 可以用于定义一组数据 组成元组类型的数据可以称为“元素” 元组的定义 ...
- iOS开发零基础--Swift篇 循环
循环的介绍 在开发中经常会需要循环 常见的循环有:for/while/do while. 这里我们只介绍for/while,因为for/while最常见 for循环的写法 最常规写法 // 传统写法 ...
随机推荐
- [LeetCode] Missing Number (A New Questions Added Today)
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missin ...
- WCF_Config頁面常用配置
右键点击App.config文件,选中Edit WCF Configuration进行编辑,我们添加2个baseAddress,一个是基于HTTP协议的:一个是基于TCP协议的.同时添加2个bindi ...
- Use weakref module in a cache or mapping
The weakref module allows the Python programmer to create weak references to objects. In the followi ...
- 怎样下载完整的Spring包
自从3.2版本以后,Spring不再提供包含所有库的文件下载了只有Sping自身的最基本库,所依赖的东西需要自己搞定首先, 这个链接 包含了Spring自身和所用到的所有东西 这个 是上述链接的说 ...
- 第三百五十八天 how can I 坚持
万事要有度,不要话唠,也不能不说,把握好分寸,今天貌似又说多了. 加了天班,理了个发,还有老爸明天来北京. 还有同学聚会没去,还有金龙让去吃鱼,没去. 还有.小米视频通话还行,能远程控制桌面, 还有, ...
- 转】Mahout分步式程序开发 基于物品的协同过滤ItemCF
原博文出自于: http://blog.fens.me/hadoop-mahout-mapreduce-itemcf/ 感谢! Posted: Oct 14, 2013 Tags: Hadoopite ...
- C++11常量表达式
[C++11之常量表达式] 关键字:constexpr: 中文学名:常量表达式. constexpr用于把运行期计算放置在编译期. 使用constexpr有3个限制: 1.函数中只能有一个return ...
- JUnit 4 如何正确测试异常
本篇讲述如何在 JUnit 4 下正确测试异常,我会从 try..catch 的方式谈起,然后说到 @Test(expected=Exception.class), 最后论及 @Rules publi ...
- 关于iTunes11.1 不能刷自制固件的解决方案
由于iTunes升级到11.1后, 苹果在程序里限制了不允许刷自制固件, 所以想刷自制固件暂时只能降级iTunes到11.1版本之前, 这里提供iTunes 11.0.5 的下载地址: Windows ...
- oracle 的行级触发器
create or replace trigger tri_insertAcceptList after insert on STDOC.DEVELOPER for each row DECLARE ...