Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// General Declarations
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- CGContextRef context = UIGraphicsGetCurrentContext();
- //// Color Declarations
- UIColor* offWhite = [UIColor colorWithRed: 0.95 green: 0.95 blue: 0.95 alpha: 1];
- UIColor* red1 = [UIColor colorWithRed: 0.71 green: 0 blue: 0 alpha: 1];
- UIColor* red2 = [UIColor colorWithRed: 0.86 green: 0 blue: 0 alpha: 1];
- //// Gradient Declarations
- NSArray* gradientColors = [NSArray arrayWithObjects:
- (id)[UIColor whiteColor].CGColor,
- (id)offWhite.CGColor, nil];
- CGFloat gradientLocations[] = {0, 1};
- CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)gradientColors, gradientLocations);
- NSArray* gradient2Colors = [NSArray arrayWithObjects:
- (id)red1.CGColor,
- (id)red2.CGColor, nil];
- CGFloat gradient2Locations[] = {0, 1};
- CGGradientRef gradient2 = CGGradientCreateWithColors(colorSpace, (CFArrayRef)gradient2Colors, gradient2Locations);
- //// Shadow Declarations
- CGColorRef shadow = [UIColor blackColor].CGColor;
- CGSize shadowOffset = CGSizeMake(0, -0);
- CGFloat shadowBlurRadius = 3;
- //// Oval Drawing
- UIBezierPath* ovalPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(50, 50, 100, 100)];
- CGContextSaveGState(context);
- CGContextSetShadowWithColor(context, shadowOffset, shadowBlurRadius, shadow);
- CGContextSetFillColorWithColor(context, shadow);
- [ovalPath fill];
- [ovalPath addClip];
- CGContextDrawRadialGradient(context, gradient,
- CGPointMake(100, 100), 10,
- CGPointMake(100, 100), 30,
- kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
- CGContextRestoreGState(context);
- [[UIColor blackColor] setStroke];
- ovalPath.lineWidth = 1;
- [ovalPath stroke];
- //// Tick Drawing
- UIBezierPath* tickPath = [UIBezierPath bezierPathWithRect: CGRectMake(99.5, 54.5, 2, 9)];
- [[UIColor darkGrayColor] setFill];
- [tickPath fill];
- //// Hand Drawing
- UIBezierPath* handPath = [UIBezierPath bezierPath];
- [handPath moveToPoint: CGPointMake(99.5, 100.5)];
- [handPath addLineToPoint: CGPointMake(101.14, 100.5)];
- [handPath addCurveToPoint: CGPointMake(102.51, 100.5) controlPoint1: CGPointMake(101.14, 100.5) controlPoint2: CGPointMake(102.41, 100.5)];
- [handPath addCurveToPoint: CGPointMake(101.14, 54) controlPoint1: CGPointMake(102.61, 100.5) controlPoint2: CGPointMake(101.14, 54.01)];
- [handPath addCurveToPoint: CGPointMake(99.5, 100.5) controlPoint1: CGPointMake(101.14, 53.99) controlPoint2: CGPointMake(99.5, 100.5)];
- [handPath closePath];
- CGContextSaveGState(context);
- [handPath addClip];
- CGContextDrawLinearGradient(context, gradient2, CGPointMake(101.01, 100.5), CGPointMake(101.01, 54), 0);
- CGContextRestoreGState(context);
- //// Cleanup
- CGGradientRelease(gradient);
- CGGradientRelease(gradient2);
- CGColorSpaceRelease(colorSpace);
Add Comment
Please, Sign In to add comment