質問編集履歴

6

ソースを追記

2017/09/12 12:55

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
@@ -84,11 +84,19 @@
84
84
 
85
85
  override func viewDidAppear(_ animated: Bool) {
86
86
 
87
- constraint_table_hight.constant = self.tableview.contentSize.height
87
+ constraint_table_hight.constant = self.tableview.contentSize.height
88
88
 
89
- }
89
+ }
90
90
 
91
91
 
92
+
93
+ // セルの行数
94
+
95
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
96
+
97
+ return 9
98
+
99
+ }
92
100
 
93
101
  func textViewDidChange(_ textView: UITextView) {
94
102
 
@@ -104,6 +112,22 @@
104
112
 
105
113
  }
106
114
 
115
+
116
+
117
+ func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
118
+
119
+ return UITableViewAutomaticDimension
120
+
121
+ }
122
+
123
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
124
+
125
+ return UITableViewAutomaticDimension
126
+
127
+ }
128
+
129
+
130
+
107
131
  ```
108
132
 
109
133
 

5

バージョン追記

2017/09/12 12:55

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
@@ -116,4 +116,4 @@
116
116
 
117
117
  ###補足情報(言語/FW/ツール等のバージョンなど)
118
118
 
119
- xcodeは201709時点で最新ver
119
+ xcode Version 8.3.3

4

タグを追加

2017/09/11 11:57

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
File without changes

3

ソースの誤りを修正

2017/09/09 22:28

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
@@ -100,7 +100,7 @@
100
100
 
101
101
  //高さの制約を更新
102
102
 
103
- constraint_table_hight.constant = self.tv_dasen.contentSize.height
103
+ constraint_table_hight.constant = self.tableview.contentSize.height
104
104
 
105
105
  }
106
106
 

2

コードを追記

2017/09/09 22:22

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
@@ -48,6 +48,48 @@
48
48
 
49
49
  ```swift
50
50
 
51
+
52
+
53
+ @IBOutlet weak var tableview: UITableView!
54
+
55
+ @IBOutlet weak var constraint_table_hight: NSLayoutConstraint!
56
+
57
+
58
+
59
+ override func viewDidLoad() {
60
+
61
+ super.viewDidLoad()
62
+
63
+
64
+
65
+ //空のセルを表示させない
66
+
67
+ tableview.tableFooterView = UIView(frame: CGRect.zero)
68
+
69
+
70
+
71
+ //セルの高さを自動調節
72
+
73
+ self.tableview.rowHeight = UITableViewAutomaticDimension
74
+
75
+
76
+
77
+ //セルをスクロール禁止にする
78
+
79
+ self.tableview.isScrollEnabled = false
80
+
81
+
82
+
83
+ }
84
+
85
+ override func viewDidAppear(_ animated: Bool) {
86
+
87
+ constraint_table_hight.constant = self.tableview.contentSize.height
88
+
89
+ }
90
+
91
+
92
+
51
93
  func textViewDidChange(_ textView: UITextView) {
52
94
 
53
95
  self.tableview.beginUpdates()

1

誤字修正

2017/09/09 15:31

投稿

jhirata
jhirata

スコア12

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  あいうえお
34
34
 
35
-
35
+
36
36
 
37
37
 
38
38