質問編集履歴
1
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -148,6 +148,108 @@
|
|
148
148
|
|
149
149
|
```
|
150
150
|
|
151
|
+
```swift
|
152
|
+
|
153
|
+
override func numberOfSections(in tableView: UITableView) -> Int {
|
154
|
+
|
155
|
+
return 1
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
162
|
+
|
163
|
+
if self.seachBar.text == "" {
|
164
|
+
|
165
|
+
return timeLines.count
|
166
|
+
|
167
|
+
}else{
|
168
|
+
|
169
|
+
return seachedtimeLines.count
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
180
|
+
|
181
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TimeLineCell
|
182
|
+
|
183
|
+
if seachBar.text == "" {
|
184
|
+
|
185
|
+
cell.timeLineModel = self.timeLines[indexPath.row]
|
186
|
+
|
187
|
+
}else{
|
188
|
+
|
189
|
+
cell.timeLineModel = self.seachedtimeLines[indexPath.row]
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
return cell
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
let selectedCell = tableView.cellForRow(at: indexPath)
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
if seachBar.text == ""{
|
208
|
+
|
209
|
+
let selectedTimeLine = timeLines[indexPath.row]
|
210
|
+
|
211
|
+
performSegue(withIdentifier: "detail", sender: selectedTimeLine)
|
212
|
+
|
213
|
+
}else{
|
214
|
+
|
215
|
+
let selectedTimeLine = seachedtimeLines[indexPath.row]
|
216
|
+
|
217
|
+
performSegue(withIdentifier: "detail", sender: selectedTimeLine)
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
if segue.identifier == "detail" {
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
let detailViewController = segue.destination as! DetailViewController
|
236
|
+
|
237
|
+
detailViewController.pushedTimeLine = sender as? TimeLineModel
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
244
|
+
|
245
|
+
return 82
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
```
|
250
|
+
|
251
|
+
|
252
|
+
|
151
253
|
|
152
254
|
|
153
255
|
|