项目里面要用到 Checkbox,iOS 原生是没有的,本着不重复发明轮子的原则(其实是你懒),引入 M13Checkbox 来实现。
大哥您这样子有点出格啊,和我的审美不符,改一下吧。
料想作者大哥应该是用 PaintCode 之类的东西生成的代码吧,坐标值看晕。getDefaultShape 方法中先整体缩水点,然后纵向移动一点来调整,偷懒直接把 y 都加个 h 就好了。代码如下:
- (UIBezierPath *)getDefaultShape
{
// 缩小比例到 80%
CGFloat height = [self heightForCheckbox] * 0.8;
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
// 纵向偏移量
CGFloat h = height * 0.3;
[bezierPath moveToPoint: CGPointMake((0.17625 * height), (0.368125 * height) + h)];
[bezierPath addCurveToPoint: CGPointMake((0.17625 * height), (0.46375 * height + h)) controlPoint1: CGPointMake((0.13125 * height), (0.418125 * height) + h) controlPoint2: CGPointMake((0.17625 * height), (0.46375 * height + h))];
[bezierPath addLineToPoint: CGPointMake((0.4 * height), (0.719375 * height + h))];
[bezierPath addCurveToPoint: CGPointMake((0.45375* height), (0.756875 * height + h)) controlPoint1: CGPointMake((0.4 * height), (0.719375 * height + h)) controlPoint2: CGPointMake((0.4275 * height), (0.756875 * height + h))];
[bezierPath addCurveToPoint: CGPointMake((0.505625 * height), (0.719375 * height + h)) controlPoint1: CGPointMake((0.480625 * height), (0.75625 * height + h)) controlPoint2: CGPointMake((0.505625 * height), (0.719375 * height + h))];
[bezierPath addLineToPoint: CGPointMake((0.978125* height), (0.145625* height + h))];
[bezierPath addCurveToPoint: CGPointMake((0.978125* height), (0.050625* height + h)) controlPoint1: CGPointMake((0.978125* height), (0.145625* height + h)) controlPoint2: CGPointMake((1.026875* height), (0.09375* height + h))];
[bezierPath addCurveToPoint: CGPointMake((0.885625* height), (0.050625* height + h)) controlPoint1: CGPointMake((0.929375* height), (0.006875* height + h)) controlPoint2: CGPointMake((0.885625* height), (0.050625* height + h))];
[bezierPath addLineToPoint: CGPointMake((0.45375* height), (0.590625* height + h))];
[bezierPath addLineToPoint: CGPointMake((0.26875* height), (0.368125 * height + h))];
[bezierPath addCurveToPoint: CGPointMake((0.17625 * height), (0.368125 * height + h)) controlPoint1: CGPointMake((0.26875* height), (0.368125 * height + h)) controlPoint2: CGPointMake((0.221875* height), (0.318125* height + h))];
[bezierPath closePath];
bezierPath.miterLimit = 0;
return bezierPath;
}