回答編集履歴
1
訂正
test
CHANGED
@@ -1,3 +1,71 @@
|
|
1
|
+
質問よんでなくてごめんなさい、全部コードでですね。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```swift
|
6
|
+
|
7
|
+
import UIKit
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
class ViewController: UIViewController {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
override func viewDidLoad() {
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
let screenSize = UIScreen.main.bounds.size
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
let titleLabel = UILabel()
|
24
|
+
|
25
|
+
let size = CGSize(width: screenSize.width, height: screenSize.height * 0.1)
|
26
|
+
|
27
|
+
titleLabel.frame = CGRect(origin: .zero, size: size)
|
28
|
+
|
29
|
+
titleLabel.textColor = .white
|
30
|
+
|
31
|
+
titleLabel.backgroundColor = .blue
|
32
|
+
|
33
|
+
titleLabel.textAlignment = .center
|
34
|
+
|
35
|
+
titleLabel.font = UIFont.boldSystemFont(ofSize: 50)
|
36
|
+
|
37
|
+
titleLabel.text = "Title"
|
38
|
+
|
39
|
+
self.view.addSubview(titleLabel)
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
let point = CGPoint(x: (screenSize.width / 2), y: ((screenSize.height / 2) * 0.25))
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
titleLabel.center = point
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
---
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
以前の回答
|
66
|
+
|
67
|
+
|
68
|
+
|
1
69
|
```swift
|
2
70
|
|
3
71
|
override func viewDidLayoutSubviews() {
|