您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页TableViewCell左边部分的线缺少一部分的解决办法

TableViewCell左边部分的线缺少一部分的解决办法

来源:华佗小知识

可以看到cell左边的部分没有到头,缺少一部分。

解决办法:

-(void)viewDidLayoutSubviews {

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

[self.myTabelView setSeparatorInset:UIEdgeInsetsZero];

}

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

[self.myTabelView setLayoutMargins:UIEdgeInsetsZero];

}

}

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

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {

[cell setLayoutMargins:UIEdgeInsetsZero];

}

if ([cell respondsToSelector:@selector(setSeparatorInset:)]){

[cell setSeparatorInset:UIEdgeInsetsZero];

}

}

另外,隐藏cell的线的方法:

self.myTabelView.separatorStyle = NO;

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务