UI detail; animation

This commit is contained in:
nixzhu
2015-10-22 16:59:54 +08:00
committed by nixzhu
parent a3cb4fa267
commit 18e72f835a
3 changed files with 66 additions and 6 deletions
+1 -1
View File
@@ -2306,7 +2306,7 @@ struct DiscoveredFeed: Hashable {
let parseFeeds: JSONDictionary -> [DiscoveredFeed]? = { data in
println("feedsData: \(data)")
//println("feedsData: \(data)")
if let feedsData = data["topics"] as? [JSONDictionary] {
return feedsData.map({ DiscoveredFeed.fromJSONDictionary($0) }).flatMap({ $0 })
+29 -5
View File
@@ -54,31 +54,52 @@
</connections>
</pickerView>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZQs-7j-O7u">
<rect key="frame" x="0.0" y="284" width="375" height="128"/>
<rect key="frame" x="0.0" y="318" width="375" height="60"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bhf-Gx-s8P" customClass="HorizontalLineView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="1"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="o8c-OQ-XAP"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zRC-QC-BYc" customClass="HorizontalLineView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="59" width="375" height="1"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="XCb-4Q-ZrJ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Channel:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LCK-Ex-Wiz" userLabel="Channel Label">
<rect key="frame" x="20" y="54" width="67.5" height="20.5"/>
<rect key="frame" x="20" y="20" width="67.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="feed_skill_channel_arrow" translatesAutoresizingMaskIntoConstraints="NO" id="BWR-Ne-5Ho">
<rect key="frame" x="350" y="55" width="10" height="18"/>
<rect key="frame" x="350" y="21" width="10" height="18"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="4iB-li-VBX"/>
<constraint firstAttribute="height" constant="60" id="4iB-li-VBX"/>
<constraint firstItem="bhf-Gx-s8P" firstAttribute="top" secondItem="ZQs-7j-O7u" secondAttribute="top" id="9KT-68-Oc7"/>
<constraint firstItem="BWR-Ne-5Ho" firstAttribute="centerY" secondItem="ZQs-7j-O7u" secondAttribute="centerY" id="C0b-4M-smg"/>
<constraint firstItem="LCK-Ex-Wiz" firstAttribute="centerY" secondItem="ZQs-7j-O7u" secondAttribute="centerY" id="Lwh-Zk-2cc"/>
<constraint firstItem="bhf-Gx-s8P" firstAttribute="leading" secondItem="ZQs-7j-O7u" secondAttribute="leading" id="Y8O-5h-9GY"/>
<constraint firstItem="LCK-Ex-Wiz" firstAttribute="leading" secondItem="ZQs-7j-O7u" secondAttribute="leading" constant="20" id="enR-AE-XD6"/>
<constraint firstAttribute="trailing" secondItem="zRC-QC-BYc" secondAttribute="trailing" id="hDE-VV-K2R"/>
<constraint firstAttribute="trailing" secondItem="BWR-Ne-5Ho" secondAttribute="trailing" constant="15" id="ijD-Lv-deS"/>
<constraint firstItem="zRC-QC-BYc" firstAttribute="leading" secondItem="ZQs-7j-O7u" secondAttribute="leading" id="joi-PN-IA8"/>
<constraint firstAttribute="bottom" secondItem="zRC-QC-BYc" secondAttribute="bottom" id="mvV-X2-Og9"/>
<constraint firstAttribute="trailing" secondItem="bhf-Gx-s8P" secondAttribute="trailing" id="n5P-0j-stA"/>
</constraints>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="ZQs-7j-O7u" firstAttribute="top" secondItem="tdd-kc-O7L" secondAttribute="bottom" constant="108" id="0JG-fM-7Ys"/>
<constraint firstAttribute="trailing" secondItem="nqc-gK-NZL" secondAttribute="trailing" id="9aV-hx-aoj"/>
<constraint firstItem="VPy-FV-QI7" firstAttribute="top" secondItem="tdd-kc-O7L" secondAttribute="bottom" constant="30" id="C8i-IV-mp6"/>
<constraint firstAttribute="trailing" secondItem="tdd-kc-O7L" secondAttribute="trailing" id="ET6-Wp-sPs"/>
@@ -86,7 +107,6 @@
<constraint firstItem="tdd-kc-O7L" firstAttribute="top" secondItem="XTF-TD-X10" secondAttribute="top" id="HYS-Mm-PNs"/>
<constraint firstItem="ZQs-7j-O7u" firstAttribute="leading" secondItem="VPy-FV-QI7" secondAttribute="leading" id="Oum-6d-v4i"/>
<constraint firstAttribute="trailing" secondItem="VPy-FV-QI7" secondAttribute="trailing" id="PW5-yd-gog"/>
<constraint firstItem="ZQs-7j-O7u" firstAttribute="centerY" secondItem="VPy-FV-QI7" secondAttribute="centerY" id="V8e-5B-jUV"/>
<constraint firstItem="VPy-FV-QI7" firstAttribute="leading" secondItem="XTF-TD-X10" secondAttribute="leading" id="XTo-uN-xKp"/>
<constraint firstItem="nqc-gK-NZL" firstAttribute="leading" secondItem="XTF-TD-X10" secondAttribute="leading" id="be1-Wt-Njn"/>
<constraint firstItem="kWS-hy-hsK" firstAttribute="top" secondItem="P6L-c6-EtM" secondAttribute="bottom" constant="15" id="dKw-0O-6Mx"/>
@@ -99,6 +119,10 @@
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections>
<outlet property="channelView" destination="ZQs-7j-O7u" id="TmW-9o-Uu3"/>
<outlet property="channelViewBottomLineView" destination="zRC-QC-BYc" id="mSe-Lh-8Tt"/>
<outlet property="channelViewTopConstraint" destination="0JG-fM-7Ys" id="hrV-hA-nVo"/>
<outlet property="channelViewTopLineView" destination="bhf-Gx-s8P" id="YE9-Yh-t2K"/>
<outlet property="feedWhiteBGView" destination="tdd-kc-O7L" id="32E-RO-YcU"/>
<outlet property="mediaCollectionView" destination="nqc-gK-NZL" id="vUb-KN-uL1"/>
<outlet property="messageTextView" destination="kWS-hy-hsK" id="r5G-r3-3P5"/>
@@ -23,6 +23,13 @@ class NewFeedViewController: UIViewController {
@IBOutlet weak var mediaCollectionView: UICollectionView!
//@IBOutlet weak var pickFeedSkillView: PickFeedSkillView!
//@IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var channelView: UIView!
@IBOutlet weak var channelViewTopConstraint: NSLayoutConstraint!
@IBOutlet weak var channelViewTopLineView: HorizontalLineView!
@IBOutlet weak var channelViewBottomLineView: HorizontalLineView!
@IBOutlet weak var skillPickerView: UIPickerView!
var imageAssets: [PHAsset] = []
@@ -88,6 +95,17 @@ class NewFeedViewController: UIViewController {
pickedSkill = skills[centerRow % skills.count]
}
// pick skill
channelViewTopConstraint.constant = 30
skillPickerView.alpha = 0
channelView.backgroundColor = UIColor.whiteColor()
channelView.userInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: "showSkillPickerView:")
channelView.addGestureRecognizer(tap)
// try turn on location
let locationResource = PrivateResource.Location(.WhenInUse)
@@ -131,6 +149,24 @@ class NewFeedViewController: UIViewController {
// MARK: Actions
func showSkillPickerView(tap: UITapGestureRecognizer) {
UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
self?.channelView.backgroundColor = UIColor.clearColor()
self?.channelViewTopLineView.alpha = 0
self?.channelViewBottomLineView.alpha = 0
self?.skillPickerView.alpha = 1
self?.channelViewTopConstraint.constant = 108
self?.view.layoutIfNeeded()
}, completion: { [weak self] _ in
self?.channelView.userInteractionEnabled = false
})
}
func cancel(sender: UIBarButtonItem) {
messageTextView.resignFirstResponder()
self.dismissViewControllerAnimated(true, completion: nil)