【发布时间】:2018-06-13 07:16:29
【问题描述】:
我已将左下角和右下角半径应用于我的UITableViewCell
它工作正常,但cell 的宽度减少了。我在cell 的containerView 中应用了约束。这背后的原因是什么?
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
RateChartTableViewCell *cell1 = (RateChartTableViewCell *)cell;
if(indexPath.section == 0 && indexPath.row == 4)
{
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
UIBezierPath *maskPath = [UIBezierPath
bezierPathWithRoundedRect:cell1.containerView.bounds byRoundingCorners:( UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = tableView.bounds;
maskLayer.path = maskPath.CGPath;
cell1.containerView.layer.mask = maskLayer;
cell1.containerView.clipsToBounds = YES;
}
}
【问题讨论】:
标签: ios objective-c xcode uitableview