UITableViewCell Separator disappearing in iOS7

前端 未结 30 771
轮回少年
轮回少年 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:16

    I solve this problem in another way: add a layer that its height is 0.5px and its color is lightgray into tableview.tableFooterView as its sublayer.

    the code is just like this:

    UIView *tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 70)];
    CALayer *topSeperatorLine = [CALayer layer];
    topSeperatorLine.borderWidth = 0.5f;
    topSeperatorLine.borderColor = [UIColor lightGrayColor].CGColor;
    topSeperatorLine.frame = CGRectMake(0, 0, 320, 0.5f);
    [tableFooterView.layer addSublayer:topSeperatorLine];
    self.tableView.tableFooterView = tableFooterView;
    

提交回复
热议问题