UITableViewCell Separator disappearing in iOS7

前端 未结 30 731
轮回少年
轮回少年 2020-12-07 08:31

I have some strange issue with UITableView only in iOS 7.

UITableViewCellSeparator disappears above the first row and below the last row. S

30条回答
  •  轮回少年
    2020-12-07 09:08

    @samvermette

    I fixed the problem by using this delegate methods. Now it doesn't flicker:

    -(void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
        // fix for separators bug in iOS 7
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    }
    
    
    -(void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath {
        // fix for separators bug in iOS 7
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    }
    

提交回复
热议问题