表视图的基本概念

一、表视图的基本概念

1.现在表视图应用广泛,主要常用一些社交类型的APP软件的设计 。其主要有QQ,微信,新浪微博等常用的聊天APP软件,表视图主要以“一列多行的形式”使用于APP设计,主要有两种风格 :

(1)简约型UITableViewStylePlain :仅有一个分组 

(2)分组型UITableViewStyleGrouped:有多组模式

通常我们创建表视图的时候 ,也有两种选择:1.直接创建表视图UITableView     2.创建表视图控制器UITableViewController

区别在于直接创建表视图 需要 设置 代理对象“datasource和 delegate”,并自己手打相应的必写的代理方法,而表视图控制器则不用,主要是datasource的两个方法必须实现:

《1》一个分组里面该显示多少行(执行一次)

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

《2》每个行该显示什么内容 (执行多次)

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

二、表视图的常用的基本属性

1.风格 : UITableViewStyle   style

2.分割线风格:UITableViewCellSeparatorStyle separatorStyle; // default is UITableViewCellSeparatorStyleSingleLine

3.分割线颜色 :     UIColor       *separatorColor

4.设置头部视图:UIView *tableHeaderView

5.设置尾部视图 :UIView *tableFooterView

6.

 

 

原文地址:https://www.cnblogs.com/AllenLAS/p/4514355.html