redribben icon

drawinrect

redribben | PRO | 06/05/15 01:12:01 AM UTC | 0 ⭐ | 7837 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

#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

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎