Skip to content

Commit d7a4ffc

Browse files
committed
edited indicator to show a tick instead.
1 parent ffb3ad5 commit d7a4ffc

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

DLRadioButton/DLRadioButton.m

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,19 @@ - (UIImage *)drawIconWithSelection:(BOOL)selected {
101101

102102
// draw indicator
103103
if (selected) {
104-
UIBezierPath* indicatorPath;
105-
CGRect indicatorRect = CGRectMake((iconSize - indicatorSize) / 2, (iconSize - indicatorSize) / 2, indicatorSize, indicatorSize);
106-
if (self.isIconSquare) {
107-
indicatorPath = [UIBezierPath bezierPathWithRect:indicatorRect];
108-
} else {
109-
indicatorPath = [UIBezierPath bezierPathWithOvalInRect:indicatorRect];
110-
}
111-
[indicatorColor setFill];
112-
[indicatorPath fill];
113-
CGContextAddPath(context, indicatorPath.CGPath);
104+
// This part is edited by wongherlung so that the indicator looks like a tick.
105+
CGRect group = CGRectMake(CGRectGetMinX(rect) + 3, CGRectGetMinY(rect) + 3, CGRectGetWidth(rect) - 6, CGRectGetHeight(rect) - 6);
106+
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
107+
[bezierPath moveToPoint: CGPointMake(CGRectGetMinX(group) + 0.27083 * CGRectGetWidth(group), CGRectGetMinY(group) + 0.54167 * CGRectGetHeight(group))];
108+
[bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(group) + 0.41667 * CGRectGetWidth(group), CGRectGetMinY(group) + 0.68750 * CGRectGetHeight(group))];
109+
[bezierPath addLineToPoint: CGPointMake(CGRectGetMinX(group) + 0.75000 * CGRectGetWidth(group), CGRectGetMinY(group) + 0.35417 * CGRectGetHeight(group))];
110+
bezierPath.lineCapStyle = kCGLineCapSquare;
111+
112+
[indicatorColor setStroke];
113+
bezierPath.lineWidth = 1.3;
114+
[bezierPath stroke];
115+
116+
CGContextAddPath(context, bezierPath.CGPath);
114117
}
115118

116119
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

0 commit comments

Comments
 (0)