質問編集履歴
4
こーど記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -190,12 +190,8 @@
|
|
190
190
|
|
191
191
|
titleLabel.backgroundColor = .magenta
|
192
192
|
|
193
|
-
//titleLabel.translatesAutoresizingMaskIntoConstraints = false
|
194
|
-
|
195
193
|
scrollView.addSubview(titleLabel)
|
196
194
|
|
197
|
-
//autoLayout(subName: titleLabel, parentName: scrollView)
|
198
|
-
|
199
195
|
|
200
196
|
|
201
197
|
// ラベル量産
|
3
コード記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
AutoLayoutのような機能をコード記述で制約をもたせたいのですが、色々なサイトを参考にしながら、NSLayoutAnchorでやるのがよさそうだと思い、サイトを参考にしてコード記述したのですが、うまくいきません。
|
6
6
|
|
7
|
-
コードエラー
|
7
|
+
ビルド前はコードエラーなどはでないのですが、ビルドすると白い画面になってしまいます。
|
8
8
|
|
9
9
|
コード記述ミスや、不足があるのかもしれないですが、色々やっても解決できませんでした。
|
10
10
|
|
@@ -16,6 +16,82 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
### エラーメッセージ
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
2018-07-23 23:47:52.888494 AutoLayout[77298:11191984] [LayoutConstraints] Unable to simultaneously satisfy constraints.
|
26
|
+
|
27
|
+
Probably at least one of the constraints in the following list is one you don't want.
|
28
|
+
|
29
|
+
Try this:
|
30
|
+
|
31
|
+
(1) look at each constraint and try to figure out which you don't expect;
|
32
|
+
|
33
|
+
(2) find the code that added the unwanted constraint or constraints and fix it.
|
34
|
+
|
35
|
+
(
|
36
|
+
|
37
|
+
"<NSLayoutConstraint:0x608000284240 H:|-(0)-[UIScrollView:0x7fca1e00f400] (active, names: '|':UIView:0x7fca1d407860 )>",
|
38
|
+
|
39
|
+
"<NSLayoutConstraint:0x608000284f10 H:[UIView:0x7fca1d407860]-(0)-[UIScrollView:0x7fca1e00f400] (active)>",
|
40
|
+
|
41
|
+
"<NSLayoutConstraint:0x618000280fa0 'UIView-Encapsulated-Layout-Width' UIView:0x7fca1d407860.width == 414 (active)>"
|
42
|
+
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
Will attempt to recover by breaking constraint
|
48
|
+
|
49
|
+
<NSLayoutConstraint:0x608000284f10 H:[UIView:0x7fca1d407860]-(0)-[UIScrollView:0x7fca1e00f400] (active)>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
|
54
|
+
|
55
|
+
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
|
56
|
+
|
57
|
+
2018-07-23 23:47:52.889410 AutoLayout[77298:11191984] [LayoutConstraints] Unable to simultaneously satisfy constraints.
|
58
|
+
|
59
|
+
Probably at least one of the constraints in the following list is one you don't want.
|
60
|
+
|
61
|
+
Try this:
|
62
|
+
|
63
|
+
(1) look at each constraint and try to figure out which you don't expect;
|
64
|
+
|
65
|
+
(2) find the code that added the unwanted constraint or constraints and fix it.
|
66
|
+
|
67
|
+
(
|
68
|
+
|
69
|
+
"<NSLayoutConstraint:0x608000284fb0 V:|-(0)-[UIScrollView:0x7fca1e00f400] (active, names: '|':UIView:0x7fca1d407860 )>",
|
70
|
+
|
71
|
+
"<NSLayoutConstraint:0x6080002850a0 V:[UIView:0x7fca1d407860]-(0)-[UIScrollView:0x7fca1e00f400] (active)>",
|
72
|
+
|
73
|
+
"<NSLayoutConstraint:0x6180002806e0 'UIView-Encapsulated-Layout-Height' UIView:0x7fca1d407860.height == 736 (active)>"
|
74
|
+
|
75
|
+
)
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
Will attempt to recover by breaking constraint
|
80
|
+
|
81
|
+
<NSLayoutConstraint:0x6080002850a0 V:[UIView:0x7fca1d407860]-(0)-[UIScrollView:0x7fca1e00f400] (active)>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
|
86
|
+
|
87
|
+
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
|
19
95
|
### 試したこと
|
20
96
|
|
21
97
|
iPhone7のサイズで作成して、シュミレーターはiPhone7Plusのサイズで試しています。
|
2
コード記入
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
コード記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -110,7 +110,7 @@
|
|
110
110
|
|
111
111
|
titleLabel.frame = CGRect(x: 20, y: 20, width: 335, height: 20)
|
112
112
|
|
113
|
-
titleLabel.text = "
|
113
|
+
titleLabel.text = "ラベル"
|
114
114
|
|
115
115
|
titleLabel.backgroundColor = .magenta
|
116
116
|
|