IOS cell 分割线从边框顶端开始

来源:互联网 发布:局域网视频服务器软件 编辑:程序博客网 时间:2024/06/06 01:39

- (void)viewDidLoad {

    [superviewDidLoad];

    // Do any additional setup after loading the view.


    if ([self.tableViewrespondsToSelector:@selector(setSeparatorInset:)]) {

        [self.tableViewsetSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];

    }

    

    if ([self.tableViewrespondsToSelector:@selector(setLayoutMargins:)]) {

        [self.tableViewsetLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];

    }

    

    self.tableView.delegate =self;

    self.tableView.dataSource =self;

    self.tableView.tableFooterView=[[UIViewalloc]init];     // 去掉底部无用的行

}


-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

    if ([cellrespondsToSelector:@selector(setSeparatorInset:)]) {

        [cell setSeparatorInset:UIEdgeInsetsZero];

    }

    

    if ([cellrespondsToSelector:@selector(setLayoutMargins:)]) {

        [cell setLayoutMargins:UIEdgeInsetsZero];

    }

}


参考 : http://www.cocoachina.com/bbs/read.php?tid=233228

0 0