質問編集履歴
6
追記をリセット
title
CHANGED
File without changes
|
body
CHANGED
@@ -78,12 +78,4 @@
|
|
78
78
|
・[こちらのサイトを参考にしています。](http://kimagureneet.hatenablog.com/entry/2015/04/29/125034)
|
79
79
|
|
80
80
|
###追記
|
81
|
-

|
85
|
-
|
86
|
-
###追記3
|
87
|
-

|
88
|
-
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
89
|
-
`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.`
|
81
|
+

|
5
ソースコードも更新しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,18 +10,27 @@
|
|
10
10
|
|
11
11
|
###該当のソースコード
|
12
12
|
```Swift
|
13
|
-
import UIKit
|
14
|
-
|
15
13
|
class ViewController: UIViewController, UITableViewDataSource {
|
16
14
|
|
17
15
|
@IBOutlet weak var tableView: UITableView!
|
18
16
|
|
19
17
|
var toggle = true
|
18
|
+
var toggleArray = [true, false, true]
|
19
|
+
var rowHeight: CGFloat = 44.0
|
20
20
|
|
21
21
|
override func viewDidLoad() {
|
22
22
|
super.viewDidLoad()
|
23
23
|
}
|
24
24
|
|
25
|
+
override func viewDidLayoutSubviews() {
|
26
|
+
super.viewDidLayoutSubviews()
|
27
|
+
|
28
|
+
if let cell = tableView.dequeueReusableCellWithIdentifier("Cell") {
|
29
|
+
rowHeight = CGRectGetHeight(cell.frame)
|
30
|
+
print("rowHeight=", rowHeight)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
25
34
|
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
26
35
|
return 3
|
27
36
|
}
|
@@ -33,26 +42,28 @@
|
|
33
42
|
}
|
34
43
|
|
35
44
|
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
36
|
-
if indexPath.row ==
|
45
|
+
if toggleArray[indexPath.row] == true {
|
37
46
|
if toggle {
|
38
|
-
return
|
47
|
+
return rowHeight
|
39
48
|
} else {
|
40
|
-
tableView.estimatedRowHeight = 100
|
41
|
-
|
49
|
+
return UITableViewAutomaticDimension
|
42
|
-
return tableView.rowHeight
|
43
50
|
}
|
44
51
|
} else {
|
45
|
-
return
|
52
|
+
return rowHeight
|
46
53
|
}
|
47
54
|
}
|
48
55
|
|
49
56
|
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
50
|
-
if indexPath.row ==
|
57
|
+
if toggleArray[indexPath.row] == true {
|
51
58
|
toggle = !toggle
|
52
59
|
tableView.reloadRowsAtIndexPaths(tableView.indexPathsForVisibleRows!, withRowAnimation: UITableViewRowAnimation.Fade)
|
53
60
|
}
|
54
61
|
}
|
55
62
|
|
63
|
+
func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
64
|
+
return self.tableView(tableView, heightForRowAtIndexPath: indexPath)
|
65
|
+
}
|
66
|
+
|
56
67
|
}
|
57
68
|
```
|
58
69
|
|
4
画像の変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -73,6 +73,6 @@
|
|
73
73
|

|
74
74
|
|
75
75
|
###追記3
|
76
|
-

|
77
77
|
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
78
78
|
`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.`
|
3
追記3
title
CHANGED
File without changes
|
body
CHANGED
@@ -70,4 +70,9 @@
|
|
70
70
|

|
71
71
|
|
72
72
|
###追記2
|
73
|
-

|
73
|
+

|
74
|
+
|
75
|
+
###追記3
|
76
|
+

|
77
|
+
Autolayout崩れの警告はなくなった気がしますが下記のログが出ています。
|
78
|
+
`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
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,4 +67,7 @@
|
|
67
67
|
・[こちらのサイトを参考にしています。](http://kimagureneet.hatenablog.com/entry/2015/04/29/125034)
|
68
68
|
|
69
69
|
###追記
|
70
|
-

|
70
|
+

|
71
|
+
|
72
|
+
###追記2
|
73
|
+

|
1
追記にスクリーンショットを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,4 +64,7 @@
|
|
64
64
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
65
65
|
・`Swift2.2`
|
66
66
|
・`Xcode7.3.1`
|
67
|
-
・[こちらのサイトを参考にしています。](http://kimagureneet.hatenablog.com/entry/2015/04/29/125034)
|
67
|
+
・[こちらのサイトを参考にしています。](http://kimagureneet.hatenablog.com/entry/2015/04/29/125034)
|
68
|
+
|
69
|
+
###追記
|
70
|
+

|