2017年7月28日

摘要: /* 1. 定义 2. 增删改 3. 遍历 4. 合并 */ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup a 阅读全文
posted @ 2017-07-28 14:18 TangBin604 阅读(80) 评论(0) 推荐(0) 编辑
摘要: /* 1. 数组的定义 2. 数组遍历 3. 数组的增/删/改 4. 数组的合并 数组的合并方法比较简单 */ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // 阅读全文
posted @ 2017-07-28 14:13 TangBin604 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 因为swift的字符串的截取还在优化中,建议是用OC的 /** 1. 字符串的遍历 2. 字符串的长度 3. 字符串的拼接 */ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidL 阅读全文
posted @ 2017-07-28 14:11 TangBin604 阅读(93) 评论(0) 推荐(0) 编辑

2017年7月12日

摘要: /** 1. 老得for语句不能再使用了。如:for(int i=0; i<4; i++) 2. 新的方式:for i in 0..<5 表示[0, 5);for i in 0...5 表示 [0, 5] 3. 新的方式的倒序 for i in (0..<5).reversed() 表示 (5, 0 阅读全文
posted @ 2017-07-12 09:08 TangBin604 阅读(147) 评论(0) 推荐(0) 编辑

2017年7月11日

摘要: /** * 1. ?? 是一个三目 见demo1 - 如果有值,使用值 - 如果没有值,使用 ?? 后面的值 2. if let / var 连用语法,目的就是判断值,见 demo2 3. guard 守卫 / 守护, 如果没有值,就直接返回;否则继续往下。 4. guard let & if le 阅读全文
posted @ 2017-07-11 09:18 TangBin604 阅读(181) 评论(0) 推荐(0) 编辑

2017年7月7日

摘要: /** 1. 条件不需要 () 2. 语句必须有 {} 3. () 表示空执行 */ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additi 阅读全文
posted @ 2017-07-07 09:16 TangBin604 阅读(101) 评论(0) 推荐(0) 编辑

2017年7月6日

摘要: /* 1. 定义常量用 let;定义变量用 var 2. 定义的非可选项的常量/变量,在使用前必须进行初始化,否则使用的时候会报错 3. 定义可选项的常量/变量,变量默认初始化为nil,常量没有默认初始化,需要自己进行初始化 4. 定义可选项用 ‘?’ 如:let x: Int? 解包用 ‘!’,只 阅读全文
posted @ 2017-07-06 09:22 TangBin604 阅读(107) 评论(0) 推荐(0) 编辑
摘要: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typicall 阅读全文
posted @ 2017-07-06 09:17 TangBin604 阅读(83) 评论(0) 推荐(0) 编辑

2017年7月4日

摘要: /** 1. OC [UIView alloc] initWithXXX:] Swift UIView(XXX:) 类名() == alloc / init 等价 2. 类方法 OC [UIColor redColor] Swift UIColor.red 3. 访问当前对象的属性,可以不使用‘se 阅读全文
posted @ 2017-07-04 09:05 TangBin604 阅读(108) 评论(0) 推荐(0) 编辑

2017年2月21日

摘要: 一、字符串(String): swift中的String时结构体,OC中的NSString时类。 // 一个字符一个字符的取出来 let str:String = "我要去飞了" // NSString 不支持下面的遍历。 for c in str.characters { print(c) } 打 阅读全文
posted @ 2017-02-21 09:05 TangBin604 阅读(107) 评论(0) 推荐(0) 编辑

导航