讲解iOS开发中UITableView列表设计的基本要点

2020-01-14 19:26:15于海丽
讲解iOS开发中UITableView列表设计的基本要点讲解iOS开发中UITableView列表设计的基本要点

2. 创建方式及代码(本文只讲述代码创建)

        a) 创建一个Single  View Application,命名为"tableView"

        b) 新建一个继承自UITableView的类,关于tableView的实现将全部写在这个类中(当然也可直接在对      应所需要用得ViewController中创建,分离出来的好处是可以在将tableView的方法单独放在一个类中,当ViewController的代码量比较大或者这个table需要在多个地方使用时推荐使用),命名为general_table_view.

        c) 代码

①在general_table_view.h文件中,添加几个属性    

复制代码
@interface general_table_view : UITableView

 

// tableView的坐标
@property (nonatomic, assign) CGRect        tableViewFrame;
 
// 存放Cell上各行textLabel值
@property (nonatomic, copy)NSMutableArray * textLabel_MArray;
 
// 存放Cell上各行imageView上图片
@property (nonatomic, copy)NSMutableArray * images_MArray;
 
// 存放Cell上各行detailLabel值
@property (nonatomic, copy)NSMutableArray * subtitle_MArray;
 
@end


②在general_table_view.m的interface中声明代理