iOS tableview分割线及点击效果处理方案

来源:互联网 发布:建筑结构用什么软件 编辑:程序博客网 时间:2024/09/21 08:16

- (void)viewDidLoad {

[superviewDidLoad];

//加载时隐藏tableView 分割线

[_tableViewsetSeparatorStyle:UITableViewCellSeparatorStyleNone];

}


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

//隐藏footerView

tableView.tableFooterView=[[UIViewalloc]initWithFrame:CGRectZero];

//显示分割线 有几条数据显示几个

[tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];

//加载storbord上的tableViewCell

tableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:@"cell"forIndexPath:indexPath];

return cell;

}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

//手松开点击效果就会取消掉

[tableView deselectRowAtIndexPath:indexPathanimated:NO];

}


0 0
原创粉丝点击