質問編集履歴

2

一部修正

2019/10/23 05:09

投稿

saku_panda
saku_panda

スコア20

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  https://qiita.com/TD3P/items/8f474358d1dd789557f3
16
16
 
17
- 上記つの投稿を参考に構築しています。
17
+ 上記つの投稿を参考に構築しています。
18
18
 
19
19
 
20
20
 
@@ -126,8 +126,6 @@
126
126
 
127
127
  label.topAnchor.constraint(equalTo: view.topAnchor, constant: 10).isActive = true
128
128
 
129
- view.addSubview(label)
130
-
131
129
  label.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
132
130
 
133
131
 

1

参考サイト追加

2019/10/23 05:09

投稿

saku_panda
saku_panda

スコア20

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
 
10
10
 
11
+ https://qiita.com/nagisawks/items/222c881d6798c46a390f
12
+
11
13
  https://qiita.com/mochizukikotaro/items/f053495eb130e92e13e8
12
14
 
13
15
  https://qiita.com/TD3P/items/8f474358d1dd789557f3
@@ -48,6 +50,22 @@
48
50
 
49
51
 
50
52
 
53
+ extension UIColor {
54
+
55
+ static let normalText = UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)
56
+
57
+ }
58
+
59
+
60
+
61
+ extension UIFont {
62
+
63
+ static let normalText = UIFont.systemFont(ofSize: 14)
64
+
65
+ }
66
+
67
+
68
+
51
69
  class ViewController: UIViewController {
52
70
 
53
71
 
@@ -90,25 +108,11 @@
90
108
 
91
109
  label.text = "ToDoList"
92
110
 
93
-
94
-
95
- label.adjustsFontSizeToFitWidth = true
111
+ label.textColor = UIColor.normalText
96
-
97
- label.minimumScaleFactor = 0.3
112
+
98
-
99
-
100
-
101
- if let customFont = UIFont(name: "Bradley Hand", size: UIFont.labelFontSize) {
102
-
103
- label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: customFont)
104
-
105
- } else {
106
-
107
- label.font = UIFont.preferredFont(forTextStyle: .body)
113
+ label.font = UIFont.normalText
108
-
109
- }
114
+
110
-
111
-
115
+
112
116
 
113
117
  // viewにラベルを追加
114
118