一 可选类型知识点补充1 例一 : 强转并且制定类型let str = "23" //打印结果: "23"
let age : Int? = Int(str) //打印结果 :23—-> 1.1 问题 : 该例子转化的结果为什么需要用可选类型来接收?—-> 1.2 解答 : 因为很有可能是转化不成功的,如果此时不用可选类型来接收的话,万一转化失败,那么该值就为空(nil),如果不选择可选类型来接收...
分类:
编程语言 时间:
2016-04-29 17:27:59
阅读次数:
196
let words = ["ss","aa","bb","ddd"] let tweet = "this is an example tweet larking about swift sad" let valid = !words.filter({tweet.containsString($0)} ...
分类:
编程语言 时间:
2016-04-29 14:19:34
阅读次数:
165
一、CAShapeLayer CAShapeLayer 是 CALayer 的子类,但是比 CALayer 更灵活,可以画出各种图形 使用CAShapeLayer 绘制一个矩形 let layer = CAShapeLayer() layer.frame = CGRectMake(110, 100, ...
分类:
其他好文 时间:
2016-04-29 14:11:25
阅读次数:
134
运算符是一种特定的符号或表达式,用来检验、修改或合并变量。例如,用求和运算符+可以对两个数字进行求和(如let i = 1 + 2);稍微复杂一点的例子有逻辑与操作符&& (如if enteredDoorCode && passedRetinaScan) ,自增长运算符 ++i (这是i=i+1的简写方式)
Swift支持C标准库中的大多数运算符并提升了各自的兼容性,从而可以排除常见...
分类:
移动开发 时间:
2016-04-28 17:08:42
阅读次数:
607
题目链接: I won't tell you this is about number theory Problem Description To think of a beautiful problem description is so hard for me that let's just d ...
分类:
其他好文 时间:
2016-04-27 22:15:01
阅读次数:
311
let str = "10.0"let double = (str as NSString).doubleValue ...
分类:
编程语言 时间:
2016-04-27 22:05:05
阅读次数:
136
// --file.js--function getJSON(url, callback) { let xhr = new XMLHttpRequest(); xhr.onload = function () { callback(this.responseText) }; xhr.open("GE ...
分类:
编程语言 时间:
2016-04-27 15:33:29
阅读次数:
164
1.Start a container running Consul
2.Start a container running Registrator
3. Start a web service and let Registrator automatically register it on Consul
4. Find the IP address and port of the service from Consul UI, and start using the service...
分类:
其他好文 时间:
2016-04-26 21:45:09
阅读次数:
190
一 可选类型知识点补充1 例一 : 强转并且制定类型let str = "23" //打印结果: "23"
let age : Int? = Int(str) //打印结果 :23—-> 1.1 问题 : 该例子转化的结果为什么需要用可选类型来接收?—-> 1.2 解答 : 因为很有可能是转化不成功的,如果此时不用可选类型来接收的话,万一转化失败,那么该值就为空(nil),如果不选择可选类型来接收...
分类:
编程语言 时间:
2016-04-26 19:42:07
阅读次数:
170
What is a service in AngularJSBefore we talk about what a service is in Angular. Let's talk about a service in web development. If you have any experi ...
分类:
Web程序 时间:
2016-04-26 00:38:56
阅读次数:
233