tableview的分割线 扩充

来源:互联网 发布:ubuntu安装firefox 编辑:程序博客网 时间:2024/05/16 02:19
在viewdidload 中插入一下代码
if ([self.table respondsToSelector:@selector(setSeparatorInset:)])            {        [self.table setSeparatorInset:UIEdgeInsetsZero];    }        if ([self.table respondsToSelector:@selector(setLayoutMargins:)])            {        [self.table setLayoutMargins:UIEdgeInsetsZero];            }if ([self.table respondsToSelector:@selector(setSeparatorInset:)])            {                [self.table setSeparatorInset:UIEdgeInsetsZero];            }        if ([self.table respondsToSelector:@selector(setLayoutMargins:)])            {                [self.table setLayoutMargins:UIEdgeInsetsZero];            }

实现 table的代理方法
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {        [cell setSeparatorInset:UIEdgeInsetsZero];    }        // Prevent the cell from inheriting the Table View's margin settings    if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {        [cell setPreservesSuperviewLayoutMargins:NO];    }        // Explictly set your cell's layout margins    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {        [cell setLayoutMargins:UIEdgeInsetsZero];    }}


0 0
原创粉丝点击