-
Notifications
You must be signed in to change notification settings - Fork 0
/
CircleView.swift
executable file
·45 lines (31 loc) · 1.14 KB
/
CircleView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// CircleView.swift
// CueScreen
//
// Created by Debjit Saha on 11/20/14.
// Copyright (c) 2014 com.cuescreen.app. All rights reserved.
//
import UIKit
class CircleView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = UIColor.clearColor()
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func drawRect(rect: CGRect) {
// Get the Graphics Context
var context = UIGraphicsGetCurrentContext();
// Set the circle outerline-width
CGContextSetLineWidth(context, 15.0);
// Set the circle outerline-colour
//UIColor.greenColor().set()
CGContextSetRGBStrokeColor(context, 0.776, 0.875, 0.592, 1)
//CGContextSetFillColorWithColor(context, UIColor(0.5) )
// Create Circle
CGContextAddArc(context, (frame.size.width)/2, frame.size.height/2, (frame.size.width - 15)/2, 0.0, CGFloat(M_PI * 2.0), 1)
// Draw
CGContextStrokePath(context);
}
}