Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ButtonView.h"
- @implementation ButtonView
- - (void)drawRect:(CGRect)rect
- {
- //// General Declarations
- CGContextRef context = UIGraphicsGetCurrentContext();
- //// Color Declarations
- UIColor* color4 = [UIColor colorWithRed: 0.293 green: 0.69 blue: 0.256 alpha: 1];
- //// playButton
- {
- CGContextSaveGState(context);
- CGContextSetAlpha(context, 0.9);
- CGContextBeginTransparencyLayer(context, NULL);
- //// circleOutline Drawing
- UIBezierPath* circleOutlinePath = UIBezierPath.bezierPath;
- [circleOutlinePath moveToPoint: CGPointMake(165.83, 165.69)];
- [circleOutlinePath addCurveToPoint: CGPointMake(165.83, 33.81) controlPoint1: CGPointMake(202.06, 129.27) controlPoint2: CGPointMake(202.06, 70.23)];
- [circleOutlinePath addCurveToPoint: CGPointMake(34.67, 33.81) controlPoint1: CGPointMake(129.61, -2.6) controlPoint2: CGPointMake(70.89, -2.6)];
- [circleOutlinePath addCurveToPoint: CGPointMake(34.67, 165.69) controlPoint1: CGPointMake(-1.56, 70.23) controlPoint2: CGPointMake(-1.56, 129.27)];
- [circleOutlinePath addCurveToPoint: CGPointMake(165.83, 165.69) controlPoint1: CGPointMake(70.89, 202.1) controlPoint2: CGPointMake(129.61, 202.1)];
- [circleOutlinePath closePath];
- [color4 setStroke];
- circleOutlinePath.lineWidth = 5.5;
- [circleOutlinePath stroke];
- //// Triangle Drawing
- UIBezierPath* trianglePath = UIBezierPath.bezierPath;
- [trianglePath moveToPoint: CGPointMake(64.5, 40.5)];
- [trianglePath addLineToPoint: CGPointMake(164.5, 99.5)];
- [trianglePath addLineToPoint: CGPointMake(64.5, 158.5)];
- [trianglePath addLineToPoint: CGPointMake(64.5, 99.5)];
- [trianglePath addLineToPoint: CGPointMake(64.5, 40.5)];
- [trianglePath addLineToPoint: CGPointMake(64.5, 40.5)];
- [trianglePath closePath];
- trianglePath.lineCapStyle = kCGLineCapRound;
- [color4 setFill];
- [trianglePath fill];
- [color4 setStroke];
- trianglePath.lineWidth = 1;
- [trianglePath stroke];
- // // This assumes the clippingPath and image are in the same coordinate space, and scales both to fill the view bounds.
- // if ([self image])
- // {
- // CGSize imageSize = [[self image] size];
- // CGRect bounds = [self bounds];
- //
- // CGContextRef context = UIGraphicsGetCurrentContext();
- // CGContextScaleCTM(context, bounds.size.width/imageSize.width, bounds.size.height/imageSize.height);
- //
- // // This assumes the clippingPath and image may be drawn in the current coordinate space.
- // [[self clippingPath] addClip];
- // [[self image] drawAtPoint:CGPointZero];
- CGContextEndTransparencyLayer(context);
- CGContextRestoreGState(context);
- }
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement