如何用弯曲框架创建tableview?

rus*_*gun 5 objective-c uitableview ios uibezierpath

有没有人知道如何创建一个带有弯曲框架的UITableView,如iOS上的MacOS下载(在Dock面板中)?

在此输入图像描述

我试图使用UIBezierPath类,但不幸的是我没有成功.例如,我这样做:

_tableView = [[TVCurveTableView alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height - 130, 70, 160)];
UIBezierPath *bezierPath = [[UIBezierPath alloc]init];
    [bezierPath moveToPoint:CGPointMake(10, self.view.frame.size.height - 10)];
    [bezierPath addLineToPoint:CGPointMake(40, (self.view.frame.size.height-10) - 160)];
    [bezierPath addLineToPoint:CGPointMake(110, (self.view.frame.size.height-10) - 160)];
    [bezierPath addLineToPoint:CGPointMake(80, (self.view.frame.size.height-10))];
    [bezierPath addLineToPoint:CGPointMake(10, (self.view.frame.size.height-10))];
    [bezierPath closePath];
    bezierPath.lineWidth = 2;
CAShapeLayer *shapeView = [[CAShapeLayer alloc] init];
    [shapeView setPath:bezierPath.CGPath];
    shapeView.strokeColor = [UIColor redColor].CGColor;
[_tableView.layer addSublayer:shapeView];
Run Code Online (Sandbox Code Playgroud)

也许你有一些想法?

knu*_*gro 2

COBezierTableView做了类似的事情,但不是通过倾斜单元格来实现的。不过,作为一个选择,这将是一件好事,所以也许我\xc2\xb4会研究它。如果您找到解决方案,还可以砍树来自己发送拉取请求。;-)

\n\n

https://github.com/knutigro/COBezierTableView

\n