(1)在VisitorView.swift文件中,懒加载一个按钮: private var loginButton:UIButton={ let btn=UIButton() btn.setTitle("注册", forState: UIControlState.Normal) btn.setBac
分类:
编程语言 时间:
2016-02-17 23:54:00
阅读次数:
267
Swift 中出现这个问题:从第二个参数起,自动加上lable func sayHello(name:String? ,greeting:String)->String { let result = greeting + "," + (name ?? "Guest") + "!" return re
分类:
编程语言 时间:
2016-02-16 23:18:25
阅读次数:
213
1.let命令 1)基本用法 let命令是ES6新增的命令,用来声明变量,类似于var,但let声明的变量只在let命令所在的代码块范围内有效。 2)不存在"声明提前" let声明的变量不存在"声明提前",变量一定要在声明后使用,否则会造成报错,例如: console.log(a);//undefi
分类:
其他好文 时间:
2016-02-16 18:41:00
阅读次数:
162
元组(Tuples)与数组和字典的差别较大,元组是把多个值组成一个复合值: let http 404 Error = (404,"Not Found") //http 404 的类型是(Int,String),值是(404,"Not Found") 可以在定义元组的时候给单个元素命名,这时候元组的数
分类:
编程语言 时间:
2016-02-16 12:58:30
阅读次数:
233
1 let coordinate = (1,1) 2 switch coordinate 3 { 4 case(0,0): 5 print("It's origin!") 6 case(_,0): 7 print("(\(coordinate.0),0) is on the x-axis") 8 c
分类:
编程语言 时间:
2016-02-15 18:26:56
阅读次数:
223
let oldArray = [1,2,3,4,5,6,7,8,9,10] let newArray = oldArray.filter({$0 >= 4}) NSLog("%@", newArray) 闭合和半闭合区间 for index in 1...5 { NSLog("------%d",
分类:
编程语言 时间:
2016-02-15 18:15:01
阅读次数:
207
Let's image tow cases for the following string: var str = `foo foobar foobaz fooboo` First of all: we know how to capture foobar or fooboo: var regex
分类:
其他好文 时间:
2016-02-15 07:03:28
阅读次数:
186
Shell expr的用法 数学运算 let命令 expr命令 bc命令 $(()) $[] http://www.80ops.cn/archives/245.html expr命令一般用于整数值,但也可用于字符串。 一般格式为:expr argument operator argumentexpr
分类:
系统相关 时间:
2016-02-14 20:53:48
阅读次数:
235
Season 1, Episode 21: Go -Michael: I need you to let me get us out of here. 我需要你帮我出去 -Patoshik: If you try to screw me over again, I'll kill you screw
分类:
其他好文 时间:
2016-02-13 18:16:07
阅读次数:
159
Code to be refacted: const AddTodo = (props, { store }) => { let input; return ( <div> <input ref={node => { input = node; }} /> <button onClick={() =
分类:
其他好文 时间:
2016-02-12 06:07:44
阅读次数:
304