1
@implementation TestTableViewCell

-(void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    self.selectedBackgroundView = [[UIView alloc] init];
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    [super setHighlighted:highlighted animated:animated];
    if(highlighted || self.selected)
    {
        self.labelTest.tintColor = self.tintColor;
        self.labelTest.text = @"HighLighted";
    }
    else
    {
        self.labelTest.tintColor = [UIColor redColor];
        self.labelTest.text = @"Not HighLighted";
    }


}


@end

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    tableView.separatorColor = [UIColor redColor];
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TestTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"testCell"];

    if (indexPath.row == 5) {
        [tableView selectRowAtIndexPath:indexPath animated:NO    scrollPosition:UITableViewScrollPositionNone];

    }

    return cell;
}

This is my code. If the row is 5 programmatically select the cell using selectRowAtIndexPath. When I do this, the tableseperator is missing in 7.1 But the same code works fine in 7.0

ios 7.0 ios 7.1

Not sure why the separator is missing in 7.1

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Sandeep
  • 7,156
  • 12
  • 45
  • 57
  • This sounds similar to this question. It sounds like the cell is drawing on top of the separator. You could try adjusting the height of the cell. http://stackoverflow.com/questions/22358831/ios-7-1-uitableviewcell-content-overlaps-with-ones-below – Dave S Mar 28 '14 at 21:35
  • @DaveS I tried that before posting the question. Unfortunately that did not work for me. Thanks for looking into it. – Sandeep Mar 28 '14 at 21:37
  • self.selectedBackgroundView = [[UIView alloc] init]; also looks suspicious to me. Why are you using a blank view for the background when selected? From your pictures it looks unnecessary and if the separator is in the background view it would explain missing separator. – Dave S Mar 28 '14 at 21:41
  • the problem is the view is overlaying the separator just make sure you are returning the proper height for heightForRowAtIndexPath method and make sure you aren't changing view heights during runtime – A'sa Dickens Mar 28 '14 at 21:43
  • I am using custom uitableviewcell. I am not changing the height dynamically. – Sandeep Mar 28 '14 at 21:57
  • Calling `selectRowAtIndex` _inside_ `cellForRowAtIndexPath` is wrong. At that moment cell doesn't exist yet. Try to move `selectRowAtIndex` outside. – sha Mar 28 '14 at 22:52

1 Answers1

0

Actually the problem was setting the selectedbackground. It works fine in iOS7 but have some issues in 7.1

Sandeep
  • 7,156
  • 12
  • 45
  • 57