teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

色々

2019/02/04 11:18

投稿

nekokichi
nekokichi

スコア54

title CHANGED
File without changes
body CHANGED
@@ -17,6 +17,7 @@
17
17
 
18
18
  どうか、ご回答よろしくお願いします。
19
19
 
20
+ ```Swift
20
21
  import UIKit
21
22
  import Firebase
22
23
  import FirebaseUI
@@ -55,16 +56,8 @@
55
56
  }
56
57
  //imageViewを宣言
57
58
  let imageView = cell.contentView.viewWithTag(1) as! UIImageView
58
- // print("indexPath.row = ", indexPath.row)
59
59
  let storageref = Storage.storage().reference(forURL: "gs://bookshare-b78b4.appspot.com").child("userID").child("Item").child(photos[indexPath.row])
60
60
  imageView.sd_setImage(with: storageref)
61
- // imageView.setImage(with: storageref as? Resource, placeholder: nil, options: nil, progressBlock: nil, completionHandler: nil)
62
- //画像をセット
63
- // imageView.kf.setImage(with: storageref as? Resource)
64
- // if self.photosCount - 1 == indexPath.row {
65
- // self.photos = [String]()
66
- // self.photosCount = Int()
67
- // }
68
61
  return cell
69
62
  }
70
63
 
@@ -73,8 +66,6 @@
73
66
  let ref = Database.database().reference(fromURL: "https://bookshare-b78b4.firebaseio.com/")
74
67
  self.photos = [String]()
75
68
  ref.child("Item").observe(.value) { (snap) in
76
- print("---")
77
- print("-------")
78
69
  for item in snap.children {
79
70
  let snapdata = item as! DataSnapshot
80
71
  //1つのデータ
@@ -82,16 +73,10 @@
82
73
  let item = snapdata.value as! [[String:String]]
83
74
  self.photos.append(item[0]["ItemID"]!)
84
75
  print(self.photos)
85
- // print(1111)
86
- // print(self.photos)
87
76
  }
88
- // self.photosCount = self.photos.count
89
77
  self.collectionView.reloadData()
90
78
  }
91
- // ref.child("Item").observeSingleEvent(of: .value) { (snap, error) in
92
- //
93
- //
94
- // }
95
79
  }
96
80
 
97
- }
81
+ }
82
+ ```