Mobile Developing iOS8 Apps Using Swift – Part 1- Hello World The Insider's Guide to Android Interviewing iOS8 – How to use Objective-C Classes in Swi...
分类:
其他好文 时间:
2014-07-02 22:49:44
阅读次数:
311
1.首先定义一份协议。
protocol HttpToolProrocol{
//1.代理方法,将服务器返回的字典传递给调用者
func didRecieveResults(result:NSDictionary)
}
2.定义一个代理属性 //2.声明代理属性
var delegate : HttpToolProrocol?
3....
分类:
其他好文 时间:
2014-07-01 16:03:40
阅读次数:
629
在Swift中能够直接使用用Objective-C语言提供的api (包括系统框架与自己的定制代码),也能够在Objective-C中使用Swift提供的类和api
,还能够在一个工程中混合使用Swift 和Objective-C两种语言,两者之间能够互相交互。
任意Objective-C的框架或C库(包括所有的Objective-C系统框架,例如Foundation、UIKit...
分类:
移动开发 时间:
2014-07-01 15:35:07
阅读次数:
356
1、//下面的这些浮点字面量都等于十进制的12.1875:
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecimalDouble = 0xC.3p0//==12+3*(1/16)
2、//类型别名,用typealias关键字来定义类型别名
typealias AudioSample = UInt16
...
分类:
其他好文 时间:
2014-07-01 15:14:31
阅读次数:
168
1.发通知。(以这条通知为例,通知名字:gameOverNotification。通知参数:title)
NSNotificationCenter.defaultCenter().postNotificationName("gameOverNotification", object: title)
2.在要监听这则通知的viewDidload方法里面添加观察者,以便监听这则通知
...
分类:
其他好文 时间:
2014-07-01 14:28:52
阅读次数:
230
localhost:~ hejiasheng$ xcrun swift
Welcome to Swift! Type :help for assistance.
1> var a:Int
a: Int = 0
2> let b:Int
:2:5: error: 'let' declarations require an initializer expression
let b:Int
...
分类:
移动开发 时间:
2014-07-01 14:23:25
阅读次数:
443
心血来潮想试试最新的Xcode6 beta和swift语言,新建一个工程开始swift编程之旅,没想到一直报SourceKitService Terminated错误,框框一直弹出来,并且所有的Xcode里的字体都变成了灰色
其原因是我新建project的时候用的名字是swift,这是Apple的一个保留词,所有编译器会报错。
解决办法就是project命名的时候尽量避免Apple的保...
分类:
其他好文 时间:
2014-07-01 09:20:52
阅读次数:
180
1、Swift,用来判断option是不是nil,相当于OC的 if(option)
if let name = option{
greeting = “if=====“
}else{
greeting = "else==="
}
2、运行switch中匹配到的子句之后,程序会退出switch语句,并不会继续向下运行,所以不需要在每个子句结尾写break。
3、//使用..创建的范围...
分类:
其他好文 时间:
2014-07-01 07:05:30
阅读次数:
234
var ivar = [:]
ivar.className // __NSDictionaryI
var i = 1
i.className // error: 'Int' does not have a member named 'className'
If you want to get the type of a primitive, you have to use brid...
分类:
移动开发 时间:
2014-07-01 06:31:12
阅读次数:
234