2

I am using xcode6.0.1.In my UIVIew Controller contains one tableview and i need to set separator inset full width.I changed my tableview separator inset via xib.But i can’t get full width for separator inset on my xcode6 (In my xcode5 separator inset full width is possible).How to solve this issue?

change tableview separator inset via xib

enter image description here

my tableview separator line like this(not get full width)

enter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579
IKKA
  • 6,297
  • 7
  • 50
  • 88
  • possible duplicate: http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working – Istvan Oct 02 '14 at 12:31

3 Answers3

2

I solved my issue

-(void)viewDidLoad{

  self.tableView.layoutMargins = UIEdgeInsetsZero;

}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    [cell setLayoutMargins:UIEdgeInsetsZero];
  }
}
IKKA
  • 6,297
  • 7
  • 50
  • 88
0

Use this method in iOS 8 [tableView setLayoutMargins:UIEdgeInsetsZero];

Adnan Aftab
  • 14,377
  • 4
  • 45
  • 54
0

I guess you simulated your app in iOS8 , this is a new property "@property(nonatomic) UIEdgeInsets layoutMargins " in iOS8. I suggest you try to create a UITableViewCell class category(e.g. UITableViewCell+Separator) then add this getter

- (UIEdgeInsets)layoutMargins
{
    return UIEdgeInsetsZero;
}

in iOS7 this will not be called cos there's no this property in SDK,and will not cause any crash; in iOS8 this will be called every time you use the cell

It works for me

Will Zhang
  • 491
  • 3
  • 6