@@ -22,7 +22,7 @@ @implementation AMTagView
2222- (id )initWithFrame : (CGRect)frame
2323{
2424 // Rounding up the height to avoid possible visual artifacts
25- frame.size .height = (int )frame.size .height ;
25+ // frame.size.height = (int)frame.size.height;
2626 self = [super initWithFrame: frame];
2727 if (self) {
2828 self.opaque = NO ;
@@ -73,7 +73,7 @@ - (void)layoutSubviews
7373- (void )drawRect : (CGRect)rect
7474{
7575 float tagLength = self.tagLength ;
76- float height = floorf ( rect.size .height ) ;
76+ float height = rect.size .height ;
7777 float width = rect.size .width ;
7878 float radius = self.radius ;
7979
@@ -85,30 +85,20 @@ - (void)drawRect:(CGRect)rect
8585 [aPath addLineToPoint: (CGPoint){tagLength + radius, 0.0 }];
8686 [aPath addArcWithCenter: (CGPoint){tagLength + radius, radius} radius: radius startAngle: DEGREES_TO_RADIANS (270 ) endAngle: DEGREES_TO_RADIANS (230 ) clockwise: NO ];
8787 [aPath addLineToPoint: (CGPoint){0.0 , height / 2 }];
88-
89- [aPath moveToPoint: (CGPoint){width, height / 2 }];
90- [aPath addLineToPoint: CGPointMake (width, height - radius)];
91- [aPath addArcWithCenter: (CGPoint){width - radius, height - radius} radius: radius startAngle: DEGREES_TO_RADIANS (0 ) endAngle: DEGREES_TO_RADIANS (90 ) clockwise: YES ];
92- [aPath addLineToPoint: (CGPoint){tagLength + radius, height}];
93- [aPath addArcWithCenter: (CGPoint){tagLength + radius, height - radius} radius: radius startAngle: DEGREES_TO_RADIANS (90 ) endAngle: DEGREES_TO_RADIANS (140 ) clockwise: YES ];
94- [aPath addLineToPoint: (CGPoint){0.0 , height / 2 }];
95-
96- [aPath closePath ];
9788
98- [aPath addArcWithCenter : (CGPoint){tagLength / 2 + self. holeRadius , height / 2 } radius: self .holeRadius startAngle: DEGREES_TO_RADIANS ( 0 ) endAngle: DEGREES_TO_RADIANS ( 180 ) clockwise: YES ];
89+ [aPath moveToPoint : (CGPoint){tagLength / 2 , height / 2 }];
9990 [aPath addArcWithCenter: (CGPoint){tagLength / 2 + self.holeRadius , height / 2 } radius: self .holeRadius startAngle: DEGREES_TO_RADIANS (180 ) endAngle: DEGREES_TO_RADIANS (0 ) clockwise: YES ];
100-
91+
92+ UIBezierPath *p2 = [UIBezierPath bezierPathWithCGPath: aPath.CGPath];
93+ [p2 applyTransform: CGAffineTransformMakeScale (1 , -1 )];
94+ [p2 applyTransform: CGAffineTransformMakeTranslation (0 , height)];
95+ [aPath appendPath: p2];
96+
10197 // Set the render colors.
10298 [self .tagColor setFill ];
10399
104100 [aPath fill ];
105-
106- CAShapeLayer *maskWithHole = [CAShapeLayer layer ];
107- [maskWithHole setPath: [aPath CGPath ]];
108- [maskWithHole setFillRule: kCAFillRuleEvenOdd ];
109-
110- self.layer .mask = maskWithHole;
111-
101+
112102 radius = radius / 2 ;
113103 float padding = self.innerTagPadding ;
114104 float left = padding * 2 ;
0 commit comments