2

when I set UITableViewCellSeparatorStyleNone to a tableView, still the separatorview is visble?

I set the property of tableview,

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

and in view debug I still found a UITableViewCellSeparatorView in my cell, How do I remove the separator view?

DanielG
  • 33
  • 3

2 Answers2

2

You can set UITableViewCellSeparatorStyleNone in tableview in storyboard. Here i attach screenshot for more clarification.

How to set UITableViewCellSeparatorStyleNone

Maulik Patel
  • 397
  • 4
  • 15
0

since cells are being reused when presented (with dequeueReusableCellWithIdentifier): you have to use a different identifier for that cell.. I made a custom UITableViewCell subclass for it too.

this is a code where my last cell is a special cell that will load X more cells..

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.row == lastIndex) {
        LoadingNextCellView *cell = [tableView dequeueReusableCellWithIdentifier:@"LoadingNextCell"];
        if (cell == nil) {
            cell = [[LoadingNextCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LoadingNextCell"];
        }
        cell.indexPath = indexPath;
        cell.titleLabel.text = [NSString stringWithFormat:@"Loading next %d trees..",PRELOAD_TREES];
        return cell;
    } else {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
        }
     }
     return cell; 
}

Customie your cell according to this logic.

Yaro
  • 1,222
  • 11
  • 15