TableView 常用技巧与功能详解

分割线顶格iOS8 UITableview分割线顶格的做法

//iOS8 Cell分割线顶格
if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [_tableView setSeparatorInset:UIEdgeInsetsZero];
}

if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) {
    [_tableView setLayoutMargins:UIEdgeInsetsZero];
}


//iOS8 Cell分割线顶格
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

清除多余cell分割线(cell很少时)

_tableView.tableFooterView=[[UIView alloc]init];//清除多余分割线

 

关闭UITableViewCell的被选中效果

cell.selectionStyle = UITableViewCellSelectionStyleNone;//无色

 取消选中状态

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];//取消选中状态
}

 

自定义Cell选中背景

cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]];
//textLabel字体颜色
cell.textLabel.highlightedTextColor = [UIColor orangeColor];
[cell.textLabel setTextColor:whiteColor];//设置cell的字体的颜色

 

 

TableView编辑拖动排序等详解

IOS UITableView拖动排序功能

iOS UITableView的细致功能(滑动删除,拖动排序,添加行,搜索过滤)

IOS tableView 滑动删除与排序功能

UITableView整理

UITableView(单分组, 多分组, 左滑删除, 插入和移动)

转载于:https://www.cnblogs.com/sixindev/p/4582585.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值