Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create tableview with curved frame?

Does anybody know how to create an UITableView with a curved frame, like MacOS downloads (in Dock panel) on iOS?

enter image description here

I tried to use for this the UIBezierPath class, but unfortunally I didn't succeed. For example I did this:

_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];

Maybe you have some ideas?

like image 299
rusBogun Avatar asked Oct 30 '22 23:10

rusBogun


1 Answers

My COBezierTableView does something similar though not with the tilting of the cells. That would be a nice thing to have as a option though, so maybe I´ll look into it. Fell tree also to deliver a pullrequest yourself if you find a sollution. ;-)

https://github.com/knutigro/COBezierTableView

like image 186
knutigro Avatar answered Nov 14 '22 06:11

knutigro