unreadCountLabel in FeedConversationCell

This commit is contained in:
nixzhu
2015-10-12 12:20:59 +08:00
committed by nixzhu
parent d8fcc12e1e
commit 9f5154f77e
3 changed files with 40 additions and 7 deletions
@@ -45,12 +45,12 @@
<color key="textColor" white="0.50391171924717781" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="unread_red_dot" translatesAutoresizingMaskIntoConstraints="NO" id="EBI-KB-5zQ" userLabel="Red Dot">
<rect key="frame" x="52" y="9" width="17.5" height="19"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="unread_red_dot" translatesAutoresizingMaskIntoConstraints="NO" id="EBI-KB-5zQ" userLabel="Red Dot">
<rect key="frame" x="52.5" y="9" width="17.5" height="19"/>
<animations/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="7" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iMI-cX-ITU" userLabel="Unread Count Label">
<rect key="frame" x="57" y="10" width="7.5" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="7" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iMI-cX-ITU" userLabel="Unread Count Label">
<rect key="frame" x="57.5" y="10" width="7.5" height="16"/>
<animations/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="8" id="FkV-7K-FxX"/>
@@ -11,9 +11,22 @@ import UIKit
class FeedConversationCell: UITableViewCell {
@IBOutlet weak var mediaView: FeedMediaView!
@IBOutlet weak var redDotImageView: UIImageView!
@IBOutlet weak var unreadCountLabel: UILabel!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var chatLabel: UILabel!
var countOfUnreadMessages = 0 {
didSet {
let hidden = countOfUnreadMessages == 0
redDotImageView.hidden = hidden
unreadCountLabel.hidden = hidden
unreadCountLabel.text = "\(countOfUnreadMessages)"
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
@@ -30,7 +43,7 @@ class FeedConversationCell: UITableViewCell {
//self.conversation = conversation
//countOfUnreadMessages = countOfUnreadMessagesInConversation(conversation)
countOfUnreadMessages = countOfUnreadMessagesInConversation(conversation)
nameLabel.text = conversation.withGroup?.withFeed?.body
}
@@ -35,22 +35,39 @@
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="o0V-gJ-vFo" customClass="FeedMediaView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="10" y="10" width="60" height="60"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="0ir-RM-ZAA"/>
<constraint firstAttribute="height" constant="60" id="cRa-n8-VhK"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="unread_red_dot" translatesAutoresizingMaskIntoConstraints="NO" id="NEk-lH-Ejr" userLabel="Red Dot">
<rect key="frame" x="57.5" y="5" width="17.5" height="19"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="7" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1RF-Jq-txW" userLabel="Unread Count Label">
<rect key="frame" x="62.5" y="6" width="7.5" height="16"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="8" id="F8V-w1-E4T"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="13"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="0gK-pe-MlO" firstAttribute="top" secondItem="o0V-gJ-vFo" secondAttribute="top" id="4Lf-cL-M64"/>
<constraint firstItem="NEk-lH-Ejr" firstAttribute="trailing" secondItem="o0V-gJ-vFo" secondAttribute="trailing" constant="5" id="623-sX-DEd"/>
<constraint firstItem="Pdh-nY-RnC" firstAttribute="top" secondItem="0gK-pe-MlO" secondAttribute="bottom" constant="5" id="6a2-WI-lOx"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Pdh-nY-RnC" secondAttribute="bottom" constant="10" id="OIq-TG-3Bo"/>
<constraint firstItem="1RF-Jq-txW" firstAttribute="leading" secondItem="NEk-lH-Ejr" secondAttribute="leading" constant="5" id="RJE-DF-nn4"/>
<constraint firstItem="ota-vy-FWR" firstAttribute="leading" secondItem="Pdh-nY-RnC" secondAttribute="trailing" constant="10" id="WnR-Sw-r48"/>
<constraint firstAttribute="trailing" secondItem="ota-vy-FWR" secondAttribute="trailing" constant="10" id="XTF-uu-II4"/>
<constraint firstItem="Pdh-nY-RnC" firstAttribute="leading" secondItem="0gK-pe-MlO" secondAttribute="leading" id="bWZ-BM-cqc"/>
<constraint firstItem="NEk-lH-Ejr" firstAttribute="centerY" secondItem="1RF-Jq-txW" secondAttribute="centerY" id="edb-V1-PgB"/>
<constraint firstItem="o0V-gJ-vFo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="mdH-4k-QVa"/>
<constraint firstItem="NEk-lH-Ejr" firstAttribute="trailing" secondItem="1RF-Jq-txW" secondAttribute="trailing" constant="5" id="qrX-ol-OkM"/>
<constraint firstItem="0gK-pe-MlO" firstAttribute="leading" secondItem="o0V-gJ-vFo" secondAttribute="trailing" constant="15" id="rk1-o2-Cs4"/>
<constraint firstItem="NEk-lH-Ejr" firstAttribute="top" secondItem="o0V-gJ-vFo" secondAttribute="top" constant="-5" id="tTG-uf-vsL"/>
<constraint firstItem="o0V-gJ-vFo" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="va1-L5-SjJ"/>
<constraint firstItem="ota-vy-FWR" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="zXW-Gs-kTj"/>
</constraints>
@@ -59,11 +76,14 @@
<outlet property="chatLabel" destination="Pdh-nY-RnC" id="JiR-CT-TiL"/>
<outlet property="mediaView" destination="o0V-gJ-vFo" id="Zmb-u4-pZL"/>
<outlet property="nameLabel" destination="0gK-pe-MlO" id="6IO-oJ-4l1"/>
<outlet property="redDotImageView" destination="NEk-lH-Ejr" id="3vq-Sa-Mga"/>
<outlet property="unreadCountLabel" destination="1RF-Jq-txW" id="CVD-dd-vd7"/>
</connections>
<point key="canvasLocation" x="187" y="326"/>
</tableViewCell>
</objects>
<resources>
<image name="icon_accessory_mini" width="8" height="13"/>
<image name="unread_red_dot" width="15" height="19"/>
</resources>
</document>