質問編集履歴
6
追記をリセット
test
CHANGED
File without changes
|
test
CHANGED
@@ -158,20 +158,4 @@
|
|
158
158
|
|
159
159
|
###追記
|
160
160
|
|
161
|
-
![スクショ](88
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
###追記2
|
166
|
-
|
167
|
-
![スクショ](a6153ad611845e4e04bbe7f18691413f.png)![スクショ](e59be0cc1ec491883a1cf2b267b50c65.png)
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
###追記3
|
172
|
-
|
173
|
-
![スクショ](6c960371790c25d83382a4720b85247c.png)![スクショ](ebaec6f92b08b9fd13289e5815a793b4.png)
|
174
|
-
|
175
|
-
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
176
|
-
|
177
|
-
`Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.`
|
161
|
+
![スクショ](ba8a758fafea783abf6502a6372627c8.png)![スクショ](491d4d6eaaffec2a40d0d3899691e051.png)
|
5
ソースコードも更新しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,10 +22,6 @@
|
|
22
22
|
|
23
23
|
```Swift
|
24
24
|
|
25
|
-
import UIKit
|
26
|
-
|
27
|
-
|
28
|
-
|
29
25
|
class ViewController: UIViewController, UITableViewDataSource {
|
30
26
|
|
31
27
|
|
@@ -36,11 +32,33 @@
|
|
36
32
|
|
37
33
|
var toggle = true
|
38
34
|
|
35
|
+
var toggleArray = [true, false, true]
|
36
|
+
|
37
|
+
var rowHeight: CGFloat = 44.0
|
38
|
+
|
39
39
|
|
40
40
|
|
41
41
|
override func viewDidLoad() {
|
42
42
|
|
43
43
|
super.viewDidLoad()
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
override func viewDidLayoutSubviews() {
|
50
|
+
|
51
|
+
super.viewDidLayoutSubviews()
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
if let cell = tableView.dequeueReusableCellWithIdentifier("Cell") {
|
56
|
+
|
57
|
+
rowHeight = CGRectGetHeight(cell.frame)
|
58
|
+
|
59
|
+
print("rowHeight=", rowHeight)
|
60
|
+
|
61
|
+
}
|
44
62
|
|
45
63
|
}
|
46
64
|
|
@@ -68,25 +86,21 @@
|
|
68
86
|
|
69
87
|
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
70
88
|
|
71
|
-
if indexPath.row ==
|
89
|
+
if toggleArray[indexPath.row] == true {
|
72
90
|
|
73
91
|
if toggle {
|
74
92
|
|
75
|
-
return
|
93
|
+
return rowHeight
|
76
94
|
|
77
95
|
} else {
|
78
96
|
|
79
|
-
tableView.estimatedRowHeight = 100
|
80
|
-
|
81
|
-
|
97
|
+
return UITableViewAutomaticDimension
|
82
|
-
|
83
|
-
return tableView.rowHeight
|
84
98
|
|
85
99
|
}
|
86
100
|
|
87
101
|
} else {
|
88
102
|
|
89
|
-
return
|
103
|
+
return rowHeight
|
90
104
|
|
91
105
|
}
|
92
106
|
|
@@ -96,13 +110,21 @@
|
|
96
110
|
|
97
111
|
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
98
112
|
|
99
|
-
if indexPath.row ==
|
113
|
+
if toggleArray[indexPath.row] == true {
|
100
114
|
|
101
115
|
toggle = !toggle
|
102
116
|
|
103
117
|
tableView.reloadRowsAtIndexPaths(tableView.indexPathsForVisibleRows!, withRowAnimation: UITableViewRowAnimation.Fade)
|
104
118
|
|
105
119
|
}
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
126
|
+
|
127
|
+
return self.tableView(tableView, heightForRowAtIndexPath: indexPath)
|
106
128
|
|
107
129
|
}
|
108
130
|
|
4
画像の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -148,7 +148,7 @@
|
|
148
148
|
|
149
149
|
###追記3
|
150
150
|
|
151
|
-
![スクショ](6
|
151
|
+
![スクショ](6c960371790c25d83382a4720b85247c.png)![スクショ](ebaec6f92b08b9fd13289e5815a793b4.png)
|
152
152
|
|
153
153
|
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
154
154
|
|
3
追記3
test
CHANGED
File without changes
|
test
CHANGED
@@ -143,3 +143,13 @@
|
|
143
143
|
###追記2
|
144
144
|
|
145
145
|
![スクショ](a6153ad611845e4e04bbe7f18691413f.png)![スクショ](e59be0cc1ec491883a1cf2b267b50c65.png)
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
###追記3
|
150
|
+
|
151
|
+
![スクショ](611456647244b4793e905078e853abb2.png)![スクショ](1a9a07607afdef12bd5d0e5a8df04498.png)
|
152
|
+
|
153
|
+
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
154
|
+
|
155
|
+
`Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.`
|
2
追記2
test
CHANGED
File without changes
|
test
CHANGED
@@ -137,3 +137,9 @@
|
|
137
137
|
###追記
|
138
138
|
|
139
139
|
![スクショ](88cf1fe4e985ce88c0ec3770ab883c27.png)![スクショ](02cf0a39a7a6b5b53896c577203b6d1f.png)
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
###追記2
|
144
|
+
|
145
|
+
![スクショ](a6153ad611845e4e04bbe7f18691413f.png)![スクショ](e59be0cc1ec491883a1cf2b267b50c65.png)
|
1
追記にスクリーンショットを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -131,3 +131,9 @@
|
|
131
131
|
・`Xcode7.3.1`
|
132
132
|
|
133
133
|
・[こちらのサイトを参考にしています。](http://kimagureneet.hatenablog.com/entry/2015/04/29/125034)
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
###追記
|
138
|
+
|
139
|
+
![スクショ](88cf1fe4e985ce88c0ec3770ab883c27.png)![スクショ](02cf0a39a7a6b5b53896c577203b6d1f.png)
|