Guest User

Untitled

a guest
Jan 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import UIKit
  2.  
  3. @IBDesignable class EthereumCoinView: UIView {
  4.  
  5. @IBInspectable var lineColor: UIColor = UIColor.yellow {
  6. didSet {
  7. setNeedsDisplay()
  8. }
  9. }
  10.  
  11. @IBInspectable var coinColor: UIColor = UIColor.white {
  12. didSet {
  13. setNeedsDisplay()
  14. }
  15. }
  16.  
  17. //MARK: - Initializers
  18. init() {
  19. super.init(frame: .zero)
  20. setup()
  21. }
  22.  
  23. override init(frame: CGRect) {
  24. super.init(frame: frame)
  25. setup()
  26. }
  27.  
  28. override func awakeFromNib() {
  29. super.awakeFromNib()
  30. setup()
  31. }
  32.  
  33. required init?(coder aDecoder: NSCoder) {
  34. super.init(coder: aDecoder)
  35. setup()
  36. }
  37.  
  38. //MARK: - Convenience Initializers
  39. convenience init(frame: CGRect, coinColor: UIColor, lineColor: UIColor) {
  40. self.init(frame: frame)
  41. self.coinColor = coinColor
  42. self.lineColor = lineColor
  43. setup()
  44. }
  45.  
  46. convenience init(origin: CGPoint, size: CGSize, coinColor: UIColor, lineColor: UIColor) {
  47. self.init(frame: CGRect(origin: origin, size: size))
  48. self.coinColor = coinColor
  49. self.lineColor = lineColor
  50. setup()
  51. }
  52.  
  53. //MARK: - Custom
  54. func setup() {
  55. // add custom code here
  56. isOpaque = false
  57. }
  58.  
  59. //MARK: - Drawing Code
  60. override func draw(_ rect: CGRect) {
  61. CryptoStyleKit.drawEthereumcoin3(frame: rect, lineColor: lineColor, coinColor: coinColor)
  62. }
  63. }
Add Comment
Please, Sign In to add comment