我的swift

1、处理内存不足的接口:didReceiveMemoryWarning

//处理内存不足的接口:内存不足时,调用到此方法

override func didReceiveMemoryWarning() {

super.didReceiveMemoryWarning()//ios6.0以上调用didReceiveMemoryWarning内调用super的didReceiveMemoryWarning调只是释放controller的resouse,不会释放view

// Dispose of any resources that can be recreated.

print("内存不足时将会执行此代码")

}

2、let 是声明常量;var是声明变量。

let name = "林俊杰"

let age = 22

print("姓名:",name,"\n年龄:",age)

3、类型转换

//Int转换为String

let count : Int = 100

let num : String = String(count)

print(num+"分")

你可能感兴趣的:(我的swift)