最高iOS 9
在viewDidLoad中
物镜
- (void)viewDidLoad {
    [super viewDidLoad];
    
    if ([[[UIDevice currentDevice]systemVersion]floatValue] >= 9.0) {
        self.testTableView.cellLayoutMarginsFollowReadableWidth = NO;
    }
}
迅速
override func viewDidLoad() {
    super.viewDidLoad()
    if #available(iOS 9.0, *) {
        tableViewDiet.cellLayoutMarginsFollowReadableWidth = false
    }
}
在TableViewDelegate方法中,添加以下代码:
物镜
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
        [cell setPreservesSuperviewLayoutMargins:NO];
    }
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}
迅速
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
    
    if cell.respondsToSelector(Selector("setSeparatorInset:")) {
        cell.separatorInset = UIEdgeInsetsZero
    }
    
    if cell.respondsToSelector(Selector("setPreservesSuperviewLayoutMargins:")) {
        cell.preservesSuperviewLayoutMargins = false
    }
    
    if cell.respondsToSelector(Selector("setLayoutMargins:")) {
        cell.layoutMargins = UIEdgeInsetsZero
    }
}