【发布时间】:2015-07-14 11:16:38
【问题描述】:
有人知道如何创建带有弯曲框架的 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];
也许你有一些想法?
【问题讨论】:
-
您可以将背景图像设置为弯曲图像以获得您想要的外观
标签: ios objective-c uitableview uibezierpath