diff --git a/Podfile b/Podfile index 76242c36..410fcf5c 100644 --- a/Podfile +++ b/Podfile @@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! +pod 'FXBlurView' pod 'Kingfisher' pod 'WebViewJavascriptBridge' pod 'pop' diff --git a/Podfile.lock b/Podfile.lock index 82b618fd..1e0f5634 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -21,6 +21,7 @@ PODS: - AFNetworking/NSURLConnection - AFNetworking/NSURLSession - Base64 (1.0.1) + - FXBlurView (1.6.3) - Kingfisher (1.4.1) - MZFayeClient (1.0.0): - Base64 (~> 1.0.1) @@ -36,6 +37,7 @@ PODS: DEPENDENCIES: - AFNetworking + - FXBlurView - Kingfisher - MZFayeClient (from `../CatchLib-iOS/MZFayeClient/`) - pop @@ -49,6 +51,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e Base64: 4924bf3ca6fa559a5161ef717291bd450eb7bd1a + FXBlurView: c6d23f3d35af2c6282296a2930f61c6e2c788d01 Kingfisher: 962a21cdc2a7b0fa63be3b2c45ea6f180feda535 MZFayeClient: 19df756a4c86c8f414668e6edc54fccfee54adbb pop: 628ffc631644601567ee8bfaaaea493ebd7d0923 diff --git a/Yep/ViewControllers/Profile/ProfileViewController.swift b/Yep/ViewControllers/Profile/ProfileViewController.swift index 94a7970f..b1368776 100644 --- a/Yep/ViewControllers/Profile/ProfileViewController.swift +++ b/Yep/ViewControllers/Profile/ProfileViewController.swift @@ -219,6 +219,7 @@ class ProfileViewController: UIViewController { let indexPath = NSIndexPath(forItem: 0, inSection: ProfileSection.Header.rawValue) if let coverCell = self.profileCollectionView.cellForItemAtIndexPath(indexPath) as? ProfileHeaderCell { coverCell.locationLabel.alpha = progress > 0.5 ? 0 : (1.0 - progress * 2) + coverCell.avatarBlurImageView.alpha = progress } } diff --git a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift index 0227d010..ae230e10 100644 --- a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift +++ b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift @@ -8,10 +8,12 @@ import UIKit import CoreLocation +import FXBlurView class ProfileHeaderCell: UICollectionViewCell { @IBOutlet weak var avatarImageView: UIImageView! + @IBOutlet weak var avatarBlurImageView: UIImageView! @IBOutlet weak var locationLabel: UILabel! deinit { @@ -59,12 +61,29 @@ class ProfileHeaderCell: UICollectionViewCell { // TODO: User Location } + + func blurImage(image: UIImage, completion: UIImage -> Void) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { + let blurredImage = image.blurredImageWithRadius(10, iterations: 20, tintColor: UIColor.clearColor()) + + completion(blurredImage) + } + } + func updateAvatarWithAvatarURLString(avatarURLString: String) { if avatarImageView.image == nil { avatarImageView.alpha = 0 + avatarBlurImageView.alpha = 0 } AvatarCache.sharedInstance.avatarFromURL(NSURL(string: avatarURLString)!) { image in + + self.blurImage(image) { blurredImage in + dispatch_async(dispatch_get_main_queue()) { + self.avatarBlurImageView.image = blurredImage + } + } + dispatch_async(dispatch_get_main_queue()) { self.avatarImageView.image = image diff --git a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.xib b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.xib index e6d021a3..650a5ad6 100644 --- a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.xib +++ b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.xib @@ -1,7 +1,7 @@ - + - + @@ -15,6 +15,9 @@ + + +