-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFontMenuColorCell.swift
52 lines (39 loc) · 1.47 KB
/
FontMenuColorCell.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
46
47
48
49
50
51
52
//
// FontMenuColorCell.swift
// pep9pad
//
// Created by Josh Haug on 3/3/17.
// Copyright © 2017 Pepperdine University. All rights reserved.
//
import UIKit
class FontMenuColorCell: UITableViewCell {
// MARK: Interface Builder Outlets and Actions
@IBOutlet var lightColorBtn: UIButton! {
didSet {
lightColorBtn.layer.borderWidth = 2.0
lightColorBtn.layer.borderColor = appSettings.darkModeOn ? UIColor.clear.cgColor : UIColor.blue.cgColor
}
}
@IBOutlet var darkColorBtn: UIButton! {
didSet {
darkColorBtn.layer.borderWidth = 2.0
darkColorBtn.layer.borderColor = appSettings.darkModeOn ? UIColor.blue.cgColor : UIColor.clear.cgColor
}
}
@IBAction func lightColorBtnPressed(_ sender: UIButton) {
appSettings.darkModeOn = false
appSettings.saveSettings()
drawOutline(forBtn: lightColorBtn, selected: true)
drawOutline(forBtn: darkColorBtn, selected: false)
}
@IBAction func darkColorBtnPressed(_ sender: UIButton) {
appSettings.darkModeOn = true
appSettings.saveSettings()
drawOutline(forBtn: lightColorBtn, selected: false)
drawOutline(forBtn: darkColorBtn, selected: true)
}
func drawOutline(forBtn b: UIButton, selected: Bool) {
b.layer.borderWidth = 2.0
b.layer.borderColor = selected ? UIColor.blue.cgColor : UIColor.clear.cgColor
}
}