Iam not sure if it is the appropriate question to ask right now. I am working with Xcode 5 (preview version ) on the table view. The issue right now is if my table view is selected as group
than I am having a gap between the first cell and the top edge of table.
The code for uitable view delegate is below
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 8;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [NSString stringWithFormat:@"cell %d",indexPath.row];
return cell;
}
Image below when I am choosing group
in the xib
However, if i am switching to plain
, table is normal
Any thoughts for this situation. I googled it but seems there are nothing out there. Any helps are welcomed here.
Short answer is that this extra padding is probably due to the table view header (not the section header), and that UITableView doesn't like to be assigned a header with a height of 0.0.
The way I achieve adding spacing between cells is to make numberOfSections = "Your array count" and make each section contains only one row. And then define headerView and its height.
That is the expected appearance of a grouped table view in iOS 7. If you open the Settings app you will see a similar separator bar at the top of the table and in between each section in the table view (grey in color).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With