How to create a table view with a curved border?

Does anyone know how to create a UITableView with a curved frame, such as loading MacOS (in the Dock) on iOS?

enter image description here

I tried to use the UIBezierPath class for this, but unfortunately I did not 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]; 

Perhaps you have some ideas?

+5
source share
1 answer

My COBezierTableView does something similar, but not with cell tilt. It would be nice if you had the option, so maybe I will do it. Hit the tree as well to deliver pullrequest yourself if you find a solution .; -)

https://github.com/knutigro/COBezierTableView

+2
source

All Articles