可以看到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;
文章出处://www.greatytc.com/p/e60961b912d5