mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-09 12:56:15 +10:00
fill dribbbleShots to dribbbleCollectionView
This commit is contained in:
@@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git'
|
||||
platform :ios, '8.0'
|
||||
use_frameworks!
|
||||
|
||||
pod 'Kingfisher'
|
||||
pod 'WebViewJavascriptBridge'
|
||||
pod 'pop'
|
||||
pod 'AFNetworking'
|
||||
|
||||
@@ -21,6 +21,7 @@ PODS:
|
||||
- AFNetworking/NSURLConnection
|
||||
- AFNetworking/NSURLSession
|
||||
- Base64 (1.0.1)
|
||||
- Kingfisher (1.4.1)
|
||||
- MZFayeClient (1.0.0):
|
||||
- Base64 (~> 1.0.1)
|
||||
- SocketRocket (~> 0.3.1-beta2)
|
||||
@@ -35,6 +36,7 @@ PODS:
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking
|
||||
- Kingfisher
|
||||
- MZFayeClient (from `../CatchLib-iOS/MZFayeClient/`)
|
||||
- pop
|
||||
- RealmSwift
|
||||
@@ -47,6 +49,7 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: e1d86c2a96bb5d2e7408da36149806706ee122fe
|
||||
Base64: 4924bf3ca6fa559a5161ef717291bd450eb7bd1a
|
||||
Kingfisher: 962a21cdc2a7b0fa63be3b2c45ea6f180feda535
|
||||
MZFayeClient: 19df756a4c86c8f414668e6edc54fccfee54adbb
|
||||
pop: 628ffc631644601567ee8bfaaaea493ebd7d0923
|
||||
Realm: 10c91667c5c65d6fe56b206c2c31e9b5eafb8718
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Kingfisher
|
||||
|
||||
class SocialWorkDribbbleViewController: UIViewController {
|
||||
|
||||
@@ -21,6 +22,12 @@ class SocialWorkDribbbleViewController: UIViewController {
|
||||
return CGRectGetWidth(self.dribbbleCollectionView.bounds)
|
||||
}()
|
||||
|
||||
var dribbbleShots = Array<DribbbleWork.Shot>() {
|
||||
didSet {
|
||||
updateDribbbleCollectionView()
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -48,12 +55,20 @@ class SocialWorkDribbbleViewController: UIViewController {
|
||||
|
||||
}, completion: { dribbbleWork in
|
||||
println("dribbbleWork: \(dribbbleWork.shots.count)")
|
||||
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.dribbbleShots = dribbbleWork.shots
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
func updateDribbbleCollectionView() {
|
||||
dribbbleCollectionView.reloadData()
|
||||
}
|
||||
|
||||
func gotoUserDribbbleHome() {
|
||||
// TODO: gotoUserDribbbleHome
|
||||
}
|
||||
@@ -67,14 +82,16 @@ extension SocialWorkDribbbleViewController: UICollectionViewDataSource, UICollec
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 30
|
||||
return dribbbleShots.count
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(dribbbleShotCellIdentifier, forIndexPath: indexPath) as! DribbbleShotCell
|
||||
|
||||
cell.imageView.image = UIImage(named: "Cover3")
|
||||
let shot = dribbbleShots[indexPath.item]
|
||||
|
||||
cell.imageView.kf_setImageWithURL(NSURL(string: shot.images.normal)!)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user