Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCellAccessoryCheckmark covers cell separator on iOS 7

Using this code on iOS 7 results in the separator view getting covered or shortened:

cell.accessoryType = UITableViewCellAccessoryCheckmark;

How can I fix the separator view?

I'm using prototype cells, but I'm not subclassing them.

enter image description here

[EDIT]

Here is the relevant code from cellForRowAtIndexPath:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];

if (indexPath.section == kDefaultViewSection){
    NSArray *defaultViewNames = @[LQSettingsSentenceView, LQSettingsFullTextView, LQSettingsFlashcardsView];
    NSString *preferredViewName = [LQSettings valueForKey:LQSettingsPreferredLessonView];
    if ([defaultViewNames[indexPath.row] isEqualToString:preferredViewName]){
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    } else {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section != kDefaultViewSection){
        return;
    }

    // Just turn all checks off for a minute
    for (int x=0; x<3; x++) {
        NSIndexPath *ip = [NSIndexPath indexPathForRow:x inSection:kDefaultViewSection];
        UITableViewCell *cell = [tableView cellForRowAtIndexPath:ip];
        cell.accessoryType = UITableViewCellAccessoryNone;
    }

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;    
}
like image 821
arsenius Avatar asked Feb 12 '14 12:02

arsenius


1 Answers

In my case,I have disabled system-provided separator line and add my custom separator line in cell's xib.Sometimes the right checkmark covers the part of the bottom separator line.What I have done to solve the problem is that I have changed the trailing constraint to the cell instead of the contentView. [Not the superview]

enter image description here

like image 160
tounaobun Avatar answered Nov 05 '22 22:11

tounaobun