-1
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]];

the above code where i need change code for get sapce between tableview cell label

thanks and regards

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
Anjaneyulu
  • 187
  • 1
  • 2
  • 14

2 Answers2

2

There's a few ways to add space between cells in a table view.

You can adjust the height of the table view cells in Interface Builder, you can do custom cells with different heights, or you can programatically return different heights via the tableView:heightForRowAtIndexPath: delegate method.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • thank u @Michael . am asking space between two tableview cells not heights? – Anjaneyulu Mar 30 '13 at 11:23
  • are you showing separator lines between the cells? do you want extra separator lines with empty space between them? or no separator lines and just extra blank space (in which case my answer is still perfectly fine). – Michael Dautermann Mar 30 '13 at 11:25
0

A easy way to add space between two cells would be to use the sections to display the data. Make sure that each section contains just one cell. Then, you can add sectionHeaderView or sectionFooterView between subsequent sections to make it right.

- (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)];
}
Sandeep
  • 20,908
  • 7
  • 66
  • 106