FeedbackTextView

This commit is contained in:
nixzhu
2015-09-22 17:32:04 +08:00
committed by nixzhu
parent d7cdf7c524
commit 00a65db991
3 changed files with 78 additions and 26 deletions
+29 -21
View File
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Ha4-ol-D2e">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Ha4-ol-D2e">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
@@ -77,7 +78,7 @@
<rect key="frame" x="0.0" y="270" width="600" height="100"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Swipe Up to Cancel" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zew-F7-znc">
<rect key="frame" x="235.5" y="62" width="129.5" height="18"/>
<rect key="frame" x="234" y="62" width="132.5" height="18"/>
<animations/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="15"/>
<color key="textColor" red="1" green="0.0" blue="0.23529411764705882" alpha="1" colorSpace="calibratedRGB"/>
@@ -122,7 +123,7 @@
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HcA-7v-16m" userLabel="Take Photo Button" customClass="MessageTypeButton" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="213.5" y="20" width="173" height="260"/>
<rect key="frame" x="213" y="20" width="173" height="260"/>
<animations/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
@@ -133,7 +134,7 @@
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hg3-Ss-sqD" userLabel="Add Location Button" customClass="MessageTypeButton" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="406.5" y="20" width="173.5" height="260"/>
<rect key="frame" x="406" y="20" width="173.5" height="260"/>
<animations/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
@@ -899,18 +900,18 @@
</connections>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_profile_phone" translatesAutoresizingMaskIntoConstraints="NO" id="xcV-T4-317" userLabel="Phone Image View">
<rect key="frame" x="229" y="178" width="16" height="24"/>
<rect key="frame" x="227" y="178" width="16" height="24"/>
<animations/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="186-0235-4812" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bhV-NM-wXG" userLabel="Mobile Label">
<rect key="frame" x="253" y="180" width="119" height="21"/>
<rect key="frame" x="251" y="180.5" width="123" height="20.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zc6-4l-BNt" userLabel="Helper View">
<rect key="frame" x="229" y="175" width="143" height="30"/>
<rect key="frame" x="227" y="175" width="147" height="30"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
@@ -1046,7 +1047,7 @@
</connections>
</button>
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hap-y9-JVX">
<rect key="frame" x="0.0" y="389" width="600" height="162"/>
<rect key="frame" x="0.0" y="335" width="600" height="216"/>
<animations/>
<connections>
<outlet property="dataSource" destination="GqQ-V0-aYk" id="ruH-BN-Hig"/>
@@ -1148,19 +1149,19 @@
<rect key="frame" x="240" y="84" width="120" height="120"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Yep" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0gW-5K-DQz">
<rect key="frame" x="276" y="223" width="49" height="36"/>
<rect key="frame" x="275.5" y="223" width="50" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Version 1.0" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="102-IE-TP0">
<rect key="frame" x="264" y="267" width="71.5" height="17"/>
<rect key="frame" x="264.5" y="267" width="70.5" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.60000002384185791" green="0.60000002384185791" blue="0.60000002384185791" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Copyright © 2015 Catch Inc." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6nN-bl-dxT">
<rect key="frame" x="224" y="577" width="151" height="14.5"/>
<rect key="frame" x="220" y="577" width="159" height="14.5"/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="12"/>
<color key="textColor" red="0.60000002384185791" green="0.60000002384185791" blue="0.60000002384185791" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@@ -1207,11 +1208,14 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="PodCell" textLabel="C1J-Nr-hJu" style="IBUITableViewCellStyleDefault" id="IC9-zO-JHD">
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="IC9-zO-JHD" id="S8x-8A-E2F">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="C1J-Nr-hJu">
<rect key="frame" x="15" y="0.0" width="550" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
@@ -1250,7 +1254,7 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" keyboardDismissMode="onDrag" translatesAutoresizingMaskIntoConstraints="NO" id="fVo-Zl-gHQ">
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" keyboardDismissMode="onDrag" translatesAutoresizingMaskIntoConstraints="NO" id="fVo-Zl-gHQ" customClass="FeedbackTextView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="164.5" width="600" height="121.5"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -1293,8 +1297,10 @@
<tableViewSection id="TBf-1w-J6s">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="60" id="hf0-DA-HE1">
<rect key="frame" x="0.0" y="99" width="600" height="60"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hf0-DA-HE1" id="M5n-HW-GKn">
<rect key="frame" x="0.0" y="0.0" width="600" height="59.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="NIX" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="QU0-LQ-GUp">
@@ -1320,8 +1326,10 @@
<tableViewSection id="Osi-AX-ugj">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="250" id="rCs-Rg-jvK">
<rect key="frame" x="0.0" y="179" width="600" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rCs-Rg-jvK" id="Q18-jR-H2H">
<rect key="frame" x="0.0" y="0.0" width="600" height="249.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="enabled_badge_background" translatesAutoresizingMaskIntoConstraints="NO" id="bd9-dd-MZA" userLabel="Badge Enabled Image View">
@@ -1755,7 +1763,7 @@
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" hidden="YES" contentMode="scaleToFill" id="TOk-uh-YYP">
<rect key="frame" x="0.0" y="0.0" width="600" height="230"/>
<rect key="frame" x="0.0" y="64" width="600" height="230"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="default_avatar" translatesAutoresizingMaskIntoConstraints="NO" id="YwC-QR-xbE" userLabel="Avatar Image View">
@@ -1767,42 +1775,42 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="264" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zm7-GR-gdk" userLabel="Followers Count Label">
<rect key="frame" x="183" y="141" width="47" height="34"/>
<rect key="frame" x="179.5" y="141" width="54.5" height="33.5"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Followers" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oJN-WT-en7" userLabel="Followers Label">
<rect key="frame" x="181" y="183" width="50" height="14"/>
<rect key="frame" x="181" y="182.5" width="50" height="13.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="465" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AYA-Wt-nJZ" userLabel="Stars Count Label">
<rect key="frame" x="277" y="141" width="47" height="34"/>
<rect key="frame" x="273" y="141" width="55" height="33.5"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Stars" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cGf-Ne-05g" userLabel="Stars Label">
<rect key="frame" x="287" y="183" width="27" height="14"/>
<rect key="frame" x="287" y="182.5" width="27.5" height="13.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="odP-wn-O9l" userLabel="Following Count Label">
<rect key="frame" x="388" y="141" width="16" height="34"/>
<rect key="frame" x="387.5" y="141" width="17.5" height="33.5"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Following" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hSD-4E-AKI" userLabel="Following Label">
<rect key="frame" x="371" y="183" width="50" height="14"/>
<rect key="frame" x="371" y="182.5" width="50" height="13.5"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
@@ -1972,7 +1980,7 @@
<image name="yep_icon_solo" width="120" height="120"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="l4P-ds-ihU"/>
<segue reference="PTw-QB-dRp"/>
<segue reference="o3b-2D-AMq"/>
<segue reference="6No-Lc-7X4"/>
</inferredMetricsTieBreakers>
@@ -10,6 +10,52 @@ import UIKit
import KeyboardMan
import DeviceGuru
class FeedbackTextView: UITextView {
let lineColor: UIColor = UIColor(red: 0.898, green: 0.898, blue: 0.898, alpha: 1)
let lineWidth: CGFloat = 1
lazy var topLineLayer: CAShapeLayer = {
let layer = CAShapeLayer()
layer.lineWidth = self.lineWidth
layer.strokeColor = self.lineColor.CGColor
return layer
}()
lazy var bottomLineLayer: CAShapeLayer = {
let layer = CAShapeLayer()
layer.lineWidth = self.lineWidth
layer.strokeColor = self.lineColor.CGColor
return layer
}()
override func didMoveToSuperview() {
super.didMoveToSuperview()
backgroundColor = UIColor.whiteColor()
layer.addSublayer(topLineLayer)
layer.addSublayer(bottomLineLayer)
}
override func layoutSubviews() {
super.layoutSubviews()
let topPath = UIBezierPath()
topPath.moveToPoint(CGPoint(x: 0, y: 0))
topPath.addLineToPoint(CGPoint(x: CGRectGetWidth(bounds), y: 0))
topLineLayer.path = topPath.CGPath
let bottomPath = UIBezierPath()
bottomPath.moveToPoint(CGPoint(x: 0, y: CGRectGetHeight(bounds)))
bottomPath.addLineToPoint(CGPoint(x: CGRectGetWidth(bounds), y: CGRectGetHeight(bounds)))
bottomLineLayer.path = bottomPath.CGPath
}
}
class FeedbackViewController: UIViewController {
@IBOutlet weak var promptLabel: UILabel! {
@@ -19,7 +65,7 @@ class FeedbackViewController: UIViewController {
}
}
@IBOutlet weak var feedbackTextView: UITextView! {
@IBOutlet weak var feedbackTextView: FeedbackTextView! {
didSet {
feedbackTextView.text = ""
feedbackTextView.delegate = self
@@ -46,6 +92,8 @@ class FeedbackViewController: UIViewController {
title = NSLocalizedString("Feedback", comment: "")
view.backgroundColor = UIColor.yepViewBackgroundColor()
let doneBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: "done")
navigationItem.rightBarButtonItem = doneBarButtonItem
navigationItem.rightBarButtonItem?.enabled = false
@@ -646,10 +646,6 @@ class ProfileViewController: UIViewController {
})
}
YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: NSLocalizedString("You don't have any skills!\nWould you like to pick some?", comment: ""), confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: NSLocalizedString("Not now", comment: ""), inViewController: self, withConfirmAction: { [weak self] in
self?.pickSkills()
}, cancelAction: {})
if profileUserIsMe {
// Skills