1.前言
Swift在这就不多介绍了,想必大家都已皆知。
离Swift面世也过了有一个多月的时间。
在闲暇时间我用Swift实现了UITableView的一些常见操作。
基本都是可以用上的,今天在自己的博客里分享给大家。
2.初始化程序入口
初始化程序入口,先给我们的ViewController封装一个导航控制器
!代表不为nil,?表示可nil (!与?编译器会根据不同的标识来检测 )

3.新建成员变量,初始化UITableView
var tableView : UITableView?
var items :NSMutableArray?
var leftBtn:UIButton?

4.给导航控制器添加Edit和Add按钮


5.添加新的TableViewCell

6.Edit按钮功能删除与排序

7.实现UITableView的数据源方法与代理方法
7.1.总共有多少行

7.2.每行的内容

7.3.是否允许打开编辑状态

7.4.删除某行Cell

7.5.允许滑动删除

7.6.允许移动某行(排序)

7.7.实现排序

7.8.点击某行
