@@ -35,11 +35,14 @@ class TransactionViewController: UIViewController {
35
35
let collectionView = UICollectionView ( frame: . zero, collectionViewLayout: layout)
36
36
collectionView. isScrollEnabled = true
37
37
collectionView. translatesAutoresizingMaskIntoConstraints = false
38
+ collectionView. allowsMultipleSelection = true
38
39
return collectionView
39
40
} ( )
40
41
41
42
var menuTitles : [ String ] = [ " 마이 " , " 거래소 " , " 간편구매 " , " 정보 " ]
42
43
var filterTitles : [ String ] = [ " 코인명 " , " 현재가 " , " 등락률 " , " 거래대금 " ]
44
+ var sort : String = " total-price "
45
+ var ascending : String = " -1 "
43
46
}
44
47
45
48
// MARK: - Extensions
@@ -196,6 +199,7 @@ extension TransactionViewController: UICollectionViewDataSource {
196
199
return UICollectionReusableView ( )
197
200
}
198
201
footerView. awakeFromNib ( )
202
+ footerView. setInitialList ( sort: self . sort, ascending: self . ascending)
199
203
reusableView = footerView
200
204
}
201
205
}
@@ -211,5 +215,64 @@ extension TransactionViewController: UICollectionViewDataSource {
211
215
HomeViewController . menuIndex = 0
212
216
self . navigationController? . popViewController ( animated: false )
213
217
}
218
+ if indexPath. section == 1 {
219
+ switch ( indexPath. item) {
220
+ case 0 :
221
+ if FilterCollectionViewCell . titleTag == true {
222
+ ascending = " -1 "
223
+ FilterCollectionViewCell . titleTag = false
224
+ }
225
+ else {
226
+ ascending = " 1 "
227
+ FilterCollectionViewCell . titleTag = true
228
+ }
229
+ self . sort = " title "
230
+ collectionView. reloadData ( )
231
+ case 1 :
232
+ if FilterCollectionViewCell . currentPriceTag == true {
233
+ ascending = " -1 "
234
+ FilterCollectionViewCell . currentPriceTag = false
235
+ }
236
+ else {
237
+ ascending = " 1 "
238
+ FilterCollectionViewCell . currentPriceTag = true
239
+ }
240
+ self . sort = " current-price "
241
+ collectionView. reloadData ( )
242
+ case 2 :
243
+ if FilterCollectionViewCell . fluctuationTag == true {
244
+ ascending = " -1 "
245
+ FilterCollectionViewCell . fluctuationTag = false
246
+ }
247
+ else {
248
+ ascending = " 1 "
249
+ FilterCollectionViewCell . fluctuationTag = true
250
+ }
251
+ self . sort = " degree "
252
+ collectionView. reloadData ( )
253
+ case 3 :
254
+ if FilterCollectionViewCell . totalPriceTag == true {
255
+ ascending = " -1 "
256
+ FilterCollectionViewCell . totalPriceTag = false
257
+ }
258
+ else {
259
+ ascending = " 1 "
260
+ FilterCollectionViewCell . totalPriceTag = true
261
+ }
262
+ self . sort = " total-price "
263
+ collectionView. reloadData ( )
264
+ default :
265
+ if FilterCollectionViewCell . totalPriceTag == true {
266
+ ascending = " -1 "
267
+ FilterCollectionViewCell . totalPriceTag = false
268
+ }
269
+ else {
270
+ ascending = " 1 "
271
+ FilterCollectionViewCell . totalPriceTag = true
272
+ }
273
+ self . sort = " total-price "
274
+ collectionView. reloadData ( )
275
+ }
276
+ }
214
277
}
215
278
}
0 commit comments