可以看到cell左邊的部分沒(méi)有到頭,缺少一部分拯钻。
解決辦法:
-(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;