回答編集履歴

1

追記

2018/01/19 06:46

投稿

fromageblanc
fromageblanc

スコア2724

test CHANGED
@@ -7,3 +7,87 @@
7
7
  scrollView.indicatorStyle = .default // .white
8
8
 
9
9
  ```
10
+
11
+
12
+
13
+ 追記 確認用コード
14
+
15
+ ```swift
16
+
17
+ // XCode9 ,Swift4, シミュレータ:iPhone8Plus
18
+
19
+
20
+
21
+ let q1Label = UILabel()
22
+
23
+ let q2Label = UILabel()
24
+
25
+
26
+
27
+ override func viewDidLoad() {
28
+
29
+ super.viewDidLoad()
30
+
31
+
32
+
33
+ // スクロールビューを生成
34
+
35
+ let scrollView = UIScrollView()
36
+
37
+ scrollView.backgroundColor = UIColor.yellow
38
+
39
+ scrollView.frame.size = CGSize(width: view.frame.width, height: view.frame.height)
40
+
41
+ scrollView.center = self.view.center
42
+
43
+ scrollView.contentSize = CGSize(width: view.frame.width, height: 800)
44
+
45
+ scrollView.bounces = false
46
+
47
+ scrollView.indicatorStyle = .default // .white
48
+
49
+ scrollView.scrollIndicatorInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
50
+
51
+ scrollView.delegate = self
52
+
53
+
54
+
55
+ self.view.addSubview(scrollView)
56
+
57
+
58
+
59
+
60
+
61
+ q1Label.text = "test"
62
+
63
+ q1Label.frame = CGRect(x: 20, y: 10, width: 335, height: 30)
64
+
65
+ q1Label.textColor = UIColor.black
66
+
67
+ q1Label.font = UIFont.systemFont(ofSize: 12)
68
+
69
+ q1Label.backgroundColor = .lightGray
70
+
71
+ scrollView.addSubview(q1Label)
72
+
73
+
74
+
75
+ q2Label.text = "test"
76
+
77
+ q2Label.frame = CGRect(x: 20, y: 700, width: 335, height: 30)
78
+
79
+ q2Label.textColor = UIColor.black
80
+
81
+ q2Label.font = UIFont.systemFont(ofSize: 12)
82
+
83
+ q2Label.backgroundColor = .lightGray
84
+
85
+ scrollView.addSubview(q2Label)
86
+
87
+
88
+
89
+ }
90
+
91
+
92
+
93
+ ```