UITableView的其他设置

来源:互联网 发布:大数据发展史 编辑:程序博客网 时间:2024/04/29 16:37

本文主要介绍一些UItableView的冷门设置,因为在开发中,设计师总是有一些另类的设计,所以在这里进行一下总结:


UITableViewCell的点击

1.UITableViewCell点击取消背景颜色

在cellForRowAtIndexPath:方法中写上

cell.selectionStyle = UITableViewCellSelectionStyleNone;

2.UITableViewCell点击背景颜色闪一下

在didSelectRowAtIndexPath:方法中写上

[tableView deselectRowAtIndexPath:indexPath animated:NO];

UITableView的分割线

3.去掉UITableView的分割线

在创建UITableView的时候

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

4.更改UITableView的分割线的颜色

在创建UITableView的时候

tableView.separatorColor = [UIColor redColor];

5.更改UITableView的分割线的长度

在创建UITableView的时候

// 设置端距,这里表示separator离左边和右边均80像素tableView.separatorInset = UIEdgeInsetsMake(0,80, 0, 80);        

6.去除UITableView底部多余的分割线

在创建UITableView的时候

UIView *v = [[UIView alloc] initWithFrame:CGRectZero];  [self.tableView setTableFooterView:v];
0 0