不用這么麻煩了们衙,在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
中加這兩句代碼就OK了吁伺。
[cell setLayoutMargins:UIEdgeInsetsZero];
[cell setSeparatorInset:UIEdgeInsetsZero];
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
if ([_tableVIew respondsToSelector:@selector(setSeparatorInset:)]) {
[_tableVIew setSeparatorInset:UIEdgeInsetsZero];
}
if ([_tableVIew respondsToSelector:@selector(setLayoutMargins:)]) {
[_tableVIew setLayoutMargins:UIEdgeInsetsZero];
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}