mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-09 12:56:15 +10:00
scroll up blur cover in Profile
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
@@ -15,6 +15,9 @@
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9iO-cK-3UB" userLabel="Avatar Image View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="254"/>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="IZi-rr-4EQ" userLabel="Avatar Blur Image View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="254"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="广州市" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8h-bQ-ZK8" userLabel="Location Label">
|
||||
<rect key="frame" x="178" y="219" width="36" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
|
||||
@@ -26,14 +29,19 @@
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="9iO-cK-3UB" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="0GC-5l-kfn"/>
|
||||
<constraint firstItem="IZi-rr-4EQ" firstAttribute="top" secondItem="9iO-cK-3UB" secondAttribute="top" id="8h3-ze-qd4"/>
|
||||
<constraint firstAttribute="centerX" secondItem="O8h-bQ-ZK8" secondAttribute="centerX" constant="0.5" id="AQb-AI-JHu"/>
|
||||
<constraint firstAttribute="bottom" secondItem="O8h-bQ-ZK8" secondAttribute="bottom" constant="20" id="INr-hz-CLg"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9iO-cK-3UB" secondAttribute="trailing" id="Ykz-Gm-skT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="9iO-cK-3UB" secondAttribute="bottom" id="ZaW-Gv-rm4"/>
|
||||
<constraint firstItem="IZi-rr-4EQ" firstAttribute="leading" secondItem="9iO-cK-3UB" secondAttribute="leading" id="bYp-3i-1lM"/>
|
||||
<constraint firstItem="9iO-cK-3UB" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="sHm-q3-PrJ"/>
|
||||
<constraint firstItem="IZi-rr-4EQ" firstAttribute="trailing" secondItem="9iO-cK-3UB" secondAttribute="trailing" id="vnA-ga-vcJ"/>
|
||||
<constraint firstItem="IZi-rr-4EQ" firstAttribute="bottom" secondItem="9iO-cK-3UB" secondAttribute="bottom" id="yqn-wG-cQI"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="393" height="254"/>
|
||||
<connections>
|
||||
<outlet property="avatarBlurImageView" destination="IZi-rr-4EQ" id="XQt-hC-Y8v"/>
|
||||
<outlet property="avatarImageView" destination="9iO-cK-3UB" id="EVu-SY-baK"/>
|
||||
<outlet property="locationLabel" destination="O8h-bQ-ZK8" id="KRV-fd-AVq"/>
|
||||
</connections>
|
||||
|
||||
Reference in New Issue
Block a user