首页 > 移动平台 > 详细

【iOS开发系列】cell分割线置顶

时间:2015-07-15 15:08:16      阅读:122      评论:0      收藏:0      [点我收藏+]
废话不多说,直接上代码:
/**
 *  tableViewCell分割线左侧置顶 < 1 >
 */
-(void)viewDidLayoutSubviews
{
    if ([_tableView respondsToSelector:@selector(setSeparatorInset:)])
    {
        [_tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
    }
    
    if ([_tableView respondsToSelector:@selector(setLayoutMargins:)])
    {
        [_tableView setLayoutMargins:UIEdgeInsetsMake(0, 0, 0, 0)];
    }
}

/**
 *  tableViewCell分割线左侧置顶<2>
 */
-(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];
    }
}

在tableView的xib中只是找到了 setSeparatorInsets 设置了,在cell中的xib中也找到同样设置了,但是没有出效果 。难道在xib中也应该找到setLayoutMargins?但是没有找到。哪位大神看到了能否给个指点。

版权声明:本文为博主原创文章,未经博主允许不得转载。

【iOS开发系列】cell分割线置顶

原文:http://blog.csdn.net/u013457022/article/details/46892317

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!