Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 我的xcode6上的UITableview分离器设置全宽问题_Ios_Uitableview_Xcode6 - Fatal编程技术网

Ios 我的xcode6上的UITableview分离器设置全宽问题

Ios 我的xcode6上的UITableview分离器设置全宽问题,ios,uitableview,xcode6,Ios,Uitableview,Xcode6,我正在使用xcode6.0.1。在我的UIVIew控制器中包含一个tableview,我需要设置分隔符插入的全宽。我通过xib更改了我的tableview分隔符插入。但是我无法在我的xcode6上获得分隔符插入的全宽(在我的xcode5分隔符插入的全宽是可能的).如何解决这个问题 change tableview separator inset via xib 在iOS 8中使用此方法[tableView setLayoutMargins:UIEdgeInsetsZero]我解决了我的问题

我正在使用
xcode6.0.1
。在我的
UIVIew控制器中
包含一个
tableview
,我需要设置分隔符插入的全宽。我通过xib更改了我的
tableview
分隔符插入。但是我无法在我的xcode6上获得分隔符插入的全宽(在我的
xcode5
分隔符插入的全宽是可能的).如何解决这个问题

change tableview separator inset via xib


在iOS 8中使用此方法
[tableView setLayoutMargins:UIEdgeInsetsZero]

我解决了我的问题

-(void)viewDidLoad{

  self.tableView.layoutMargins = UIEdgeInsetsZero;

}

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

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    [cell setLayoutMargins:UIEdgeInsetsZero];
  }
}

我猜你在iOS8中模拟了你的应用程序,这是iOS8中的一个新属性“@property(nonatomic)UIEdgeInsets layoutMargins”。我建议您尝试创建一个UITableViewCell类类别(例如UITableViewCell+分隔符),然后添加此getter

- (UIEdgeInsets)layoutMargins
{
    return UIEdgeInsetsZero;
}
在iOS7中,这不会被调用,因为SDK中没有this属性,并且不会导致任何崩溃;在iOS8中,这将在每次使用单元时被调用

它适合我

可能重复:
- (UIEdgeInsets)layoutMargins
{
    return UIEdgeInsetsZero;
}