// 一般作一次的操做都在viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
// 只要給tableView設置一個footView就能實現有數據的Cell纔有分割線
self.tableView.tableFooterView = [[UIView alloc] init];
}
// 每次從新佈局控制器的view的子控件
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
// 清空tableView分割線的內邊距
self.tableView.separatorInset = UIEdgeInsetsZero;
// 清空tableView約束的邊緣
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
// 當tableView的cell即將顯示的時候調用
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// 清空cell的約束邊緣
[cell setLayoutMargins:UIEdgeInsetsZero];
佈局
}spa