1、!非空,?:可为nil,也可以不为nil,optional:可选
2、闭包:filter({(parameter)->(return type) in expression statements}) 举例:
candies.filter({ (candy:Candy) ->Boolin
let stringMath = candy.name.rangeOfString(searchText)
return stringMath !=nil
})
3、tableView选中一个cell来显示detail在storyBoard中拖拽,先拖入一个新的view controller,然后按住Ctrl拖拽,选择show detail,写入identifier即可。
4、delegate的函数不用加override,实现即可。
TableView:
5、重写函数 viewDidLoad()是预先加载一些初始化的数据
6、tableView 需要重写的函数
a、tableview(tableView:UItableView,numberOfRowInSection section:Int)->Int 告诉ViewController 你需要显示的tableView的行数。
b、、tableview(tableView:UItableView,cellForRowIndexPath indexPath:NsIndexPath)->UITableViewCell 告诉ViewController你要显示的每一行的内容
7、
UISearchBarDelegate定义了搜索的行为和响应的方式。UISearchDisplayDelegate定义了搜索条的外观