Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
Iphone 我可以在ipohne的tableview中提供两个单元格之间的空间吗?_Iphone_Uitableview - Fatal编程技术网

Iphone 我可以在ipohne的tableview中提供两个单元格之间的空间吗?

Iphone 我可以在ipohne的tableview中提供两个单元格之间的空间吗?,iphone,uitableview,Iphone,Uitableview,上面的代码中,我需要更改代码,以便在tableview单元格标签之间获取sapce 感谢并问候有几种方法可以在表格视图中的单元格之间添加空间 您可以在Interface Builder中调整表格视图单元格的高度,可以使用不同的高度自定义单元格,也可以通过委派方法以编程方式返回不同的高度。在两个单元格之间添加空间的简单方法是使用节段来显示数据。确保每个部分只包含一个单元格。然后,您可以在后续节之间添加sectionHeaderView或sectionFooterView以使其正确 static N

上面的代码中,我需要更改代码,以便在tableview单元格标签之间获取sapce


感谢并问候

有几种方法可以在表格视图中的单元格之间添加空间


您可以在Interface Builder中调整表格视图单元格的高度,可以使用不同的高度自定义单元格,也可以通过委派方法以编程方式返回不同的高度。

在两个单元格之间添加空间的简单方法是使用节段来显示数据。确保每个部分只包含一个单元格。然后,您可以在后续节之间添加sectionHeaderView或sectionFooterView以使其正确

static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

NSLog(@"%d",indexId);
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    /////////////////////   Cell Title    /////////////////////
    //cell.textLabel.font = [UIFont fontWithName:@"Noteworthy" size:20.0];
    cell.textLabel.font = [UIFont boldSystemFontOfSize:14.0];
    cell.textLabel.highlightedTextColor = [UIColor orangeColor];
}
/////////////////////   Cell Title    /////////////////////
cell.textLabel.text = [NSString stringWithFormat:@"  %@", [test.arrTitle objectAtIndex:indexPath.row]];

谢谢你,迈克尔。我问的是两个tableview单元格之间的空间,而不是高度?是否显示单元格之间的分隔线?是否需要在分隔线之间留有空白的额外分隔线?或者没有分隔线,只有额外的空白(在这种情况下,我的答案仍然很好)。@Manohar vin给了一个想法。但这并不完美。你能按照你的要求展示你的截图吗??看看@Flea screen定制手机使用chesthe pani aipothundi dude
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  return [myItems count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
 return 1;
}

#define customSeparatorHeight 3
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  return [UIView alloc] initWithFrame:CGRectMake(0,0, tableView.bounds.size.width, customSeparatorHeight)];
}