(十六)TableView常见属性

千万不要忘记设置TableView的数据源

1.分割线的样式:

separatorStyle与separatorColor。

颜色:十六进制表示

32bit:argb各占8位。 #aarrggbb

24bit:rgb各占8位。   #rrggbb

a为透明度。

注意:rgb全00为黑色,全ff为白色。

注意要/255.0来表示,从0-1.0进行表示

self.tableView.separatorColor = [UIColor colorWithRed:57/255.0 green:78/255.0 blue:42/255.0 alpha:1.0];

还可以设置separatorStyle:

typedef NS_ENUM(NSInteger, UITableViewCellSeparatorStyle) {
    UITableViewCellSeparatorStyleNone, //不显示分割线
    UITableViewCellSeparatorStyleSingleLine,
    UITableViewCellSeparatorStyleSingleLineEtched   // 仅仅适用于Grouped的View显示,etch是腐蚀的意思。
};


2.tableHeaderView与tableFooterView(整个TableView的头部和尾部)

头部一般放广告,尾部用来显示加载更多。

或者头部用来切换类型(app下载的管理,按不同的排行)。

原文地址:https://www.cnblogs.com/aiwz/p/6154237.html