UiTableView自动生成分割线

貌似从ios7以后就默认不从昨天一直到右边这样子了,也不知道苹果是怎么想的,简直是颠覆世界观!

解决办法(我最喜欢的CVR模式):

- (void)viewDidLayoutSubviews {
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
}

if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsMake(0, 0, 0, 0)];
}
}

- (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];
}

 

posted @ 2016-07-19 21:47  木燃  阅读(189)  评论(0)    收藏  举报