【问题标题】:Rounded Corners only for the bottoms edges of UITableView圆角仅适用于 UITableView 的底部边缘
【发布时间】:2015-11-19 06:01:01
【问题描述】:

我正在使用下面的代码为 tableView 的底部边缘制作圆角

CALayer *capa = self.patientTableView.layer;

//Round
CGRect bounds = capa.bounds;

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds
                                               byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight)
                                                     cornerRadii:CGSizeMake(10.0, 10.0)];

CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = bounds;
maskLayer.path = maskPath.CGPath;

[capa addSublayer:maskLayer];
capa.mask = maskLayer;

这段代码运行良好,但 tableview 没有显示低于其框架高度的内容(但它滚动到它的 offset.y)。

【问题讨论】:

  • 顺便说一句,您不必将遮罩层添加为子层。只需设置现有层的mask 属性就足够了。

标签: ios uitableview calayer


【解决方案1】:

您可以通过将表格视图放在UIView 中来解决此问题,然后将掩码应用于该容器视图。这样掩码就不会随着表格视图的contentOffset 移动。

【讨论】:

    猜你喜欢
    • 2013-06-14
    • 1970-01-01
    • 2012-01-05
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-13
    相关资源
    最近更新 更多