IOS sets a blank interval between cells in TableView.
1. Set the number of sections, that is, how many cells do you have?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 3; // in your case, there are 3 cells}
2. Return a cell for each section
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1;}
3. Set the headerview height between cells
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 10.; // you can have your own choice, of course}
4. Set the headerview color
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *headerView = [[UIView alloc] init]; headerView.backgroundColor = [UIColor clearColor]; return headerView;}
Note: You must use indexpath. section to obtain the index instead of indexpath. row.
cell.textLabel.text=[NSString stringWithFormat:@"%@",[array objectAtIndex:indexPath.section]];
Translated from:
Http://stackoverflow.com/questions/7189523/how-to-give-space-between-two-cells-in-tableview