mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-17 16:56:05 +10:00
add SkillCell
This commit is contained in:
@@ -75,6 +75,8 @@
|
||||
503CAB431AC00CB100DFE830 /* ConversationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503CAB421AC00CB100DFE830 /* ConversationViewController.swift */; };
|
||||
504F41251ACE2D1D00FBB19A /* SampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41241ACE2D1D00FBB19A /* SampleView.swift */; };
|
||||
504F41571AD4D35400FBB19A /* ProfileLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41561AD4D35400FBB19A /* ProfileLayout.swift */; };
|
||||
504F415A1AD5028200FBB19A /* SkillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504F41581AD5028200FBB19A /* SkillCell.swift */; };
|
||||
504F415B1AD5028200FBB19A /* SkillCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 504F41591AD5028200FBB19A /* SkillCell.xib */; };
|
||||
506EC20A1AC95BFC00CE42B3 /* UIFont+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506EC2091AC95BFC00CE42B3 /* UIFont+Yep.swift */; };
|
||||
5076C56A1AC46B9F00B22952 /* FayeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5076C5691AC46B9F00B22952 /* FayeService.swift */; };
|
||||
508D17401ACCD2740092D666 /* YepButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508D173F1ACCD2740092D666 /* YepButton.swift */; };
|
||||
@@ -189,6 +191,8 @@
|
||||
503CAB421AC00CB100DFE830 /* ConversationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConversationViewController.swift; path = ViewControllers/Conversation/ConversationViewController.swift; sourceTree = "<group>"; };
|
||||
504F41241ACE2D1D00FBB19A /* SampleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SampleView.swift; path = Views/AudioWaves/SampleView.swift; sourceTree = "<group>"; };
|
||||
504F41561AD4D35400FBB19A /* ProfileLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileLayout.swift; path = ViewControllers/Profile/ProfileLayout.swift; sourceTree = "<group>"; };
|
||||
504F41581AD5028200FBB19A /* SkillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillCell.swift; path = Views/Cells/Skill/SkillCell.swift; sourceTree = "<group>"; };
|
||||
504F41591AD5028200FBB19A /* SkillCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SkillCell.xib; path = Views/Cells/Skill/SkillCell.xib; sourceTree = "<group>"; };
|
||||
506EC2091AC95BFC00CE42B3 /* UIFont+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIFont+Yep.swift"; path = "Extensions/UIFont+Yep.swift"; sourceTree = "<group>"; };
|
||||
5076C5691AC46B9F00B22952 /* FayeService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FayeService.swift; path = Services/FayeService.swift; sourceTree = "<group>"; };
|
||||
508D173F1ACCD2740092D666 /* YepButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepButton.swift; path = Views/Buttons/YepButton.swift; sourceTree = "<group>"; };
|
||||
@@ -437,6 +441,7 @@
|
||||
children = (
|
||||
5023DE3B1AB697B000B3EE96 /* Conversation */,
|
||||
502AE5421AB88866005BD199 /* SkillRank */,
|
||||
504F415C1AD5028500FBB19A /* Skill */,
|
||||
502AE5501AB93178005BD199 /* ProfileHeader */,
|
||||
502AE5551AB93218005BD199 /* ProfileFooter */,
|
||||
50E114FE1ABC549800F13000 /* Contacts */,
|
||||
@@ -624,6 +629,15 @@
|
||||
name = Conversation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
504F415C1AD5028500FBB19A /* Skill */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
504F41581AD5028200FBB19A /* SkillCell.swift */,
|
||||
504F41591AD5028200FBB19A /* SkillCell.xib */,
|
||||
);
|
||||
name = Skill;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
508D17491ACCF4740092D666 /* ChatLeftAudio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -826,6 +840,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5023DE381AB6979600B3EE96 /* ConversationCell.xib in Resources */,
|
||||
504F415B1AD5028200FBB19A /* SkillCell.xib in Resources */,
|
||||
502AE5591AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib in Resources */,
|
||||
502AE5411AB88862005BD199 /* SkillRankCell.xib in Resources */,
|
||||
502AE5541AB93215005BD199 /* ProfileFooterCell.xib in Resources */,
|
||||
@@ -980,6 +995,7 @@
|
||||
502AE5531AB93215005BD199 /* ProfileFooterCell.swift in Sources */,
|
||||
0A5D83991AC5D91E000045BF /* ContactsSearchTableViewController.swift in Sources */,
|
||||
0A944C251AC8BB2F00037A06 /* YepStorageService.swift in Sources */,
|
||||
504F415A1AD5028200FBB19A /* SkillCell.swift in Sources */,
|
||||
5023DE521AB6C51300B3EE96 /* CGRect+Yep.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="VZO-hp-fyU" userLabel="Profile Collection View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="0.0" id="WvZ-fD-rR0" customClass="ProfileLayout" customModule="Yep" customModuleProvider="target">
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="WvZ-fD-rR0" customClass="ProfileLayout" customModule="Yep" customModuleProvider="target">
|
||||
<size key="itemSize" width="141" height="116"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
|
||||
@@ -12,4 +12,8 @@ extension UIFont {
|
||||
class func chatTextFont() -> UIFont {
|
||||
return UIFont.systemFontOfSize(16)
|
||||
}
|
||||
|
||||
class func skillTextFont() -> UIFont {
|
||||
return UIFont.systemFontOfSize(16)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProfileViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var profileCollectionView: UICollectionView!
|
||||
|
||||
let skillRanckCellIdentifier = "SkillRankCell"
|
||||
let skillCellIdentifier = "SkillCell"
|
||||
let headerCellIdentifier = "ProfileHeaderCell"
|
||||
let footerCellIdentifier = "ProfileFooterCell"
|
||||
let sectionHeaderIdentifier = "ProfileSectionHeaderReusableView"
|
||||
@@ -29,9 +29,6 @@ class ProfileViewController: UIViewController {
|
||||
lazy var sectionRightEdgeInset: CGFloat = { return 20 }()
|
||||
lazy var sectionBottomEdgeInset: CGFloat = { return 20 }()
|
||||
|
||||
lazy var cellWidth: CGFloat = {
|
||||
return (self.collectionViewWidth - (self.sectionLeftEdgeInset + self.sectionRightEdgeInset)) / 3
|
||||
}()
|
||||
let cellHeight: CGFloat = 40
|
||||
|
||||
|
||||
@@ -41,6 +38,9 @@ class ProfileViewController: UIViewController {
|
||||
["skill":"iOS Dev", "rank":3],
|
||||
["skill":"Linux", "rank":2],
|
||||
["skill":"Cook", "rank":1],
|
||||
["skill":"Love", "rank":1],
|
||||
["skill":"Walk", "rank":1],
|
||||
["skill":"Eat", "rank":1],
|
||||
]
|
||||
|
||||
let learningSkills = [
|
||||
@@ -48,6 +48,8 @@ class ProfileViewController: UIViewController {
|
||||
["skill":"Speech", "rank":0],
|
||||
]
|
||||
|
||||
let skillTextAttributes = [NSFontAttributeName: UIFont.skillTextFont()]
|
||||
|
||||
lazy var footerCellHeight: CGFloat = {
|
||||
let attributes = [NSFontAttributeName: profileIntroductionLabelFont]
|
||||
let labelWidth = self.collectionViewWidth - (profileIntroductionLabelLeadingSpaceToContainer + profileIntroductionLabelTrailingSpaceToContainer)
|
||||
@@ -58,7 +60,7 @@ class ProfileViewController: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
profileCollectionView.registerNib(UINib(nibName: skillRanckCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillRanckCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: skillCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: headerCellIdentifier, bundle: nil), forCellWithReuseIdentifier: headerCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: footerCellIdentifier, bundle: nil), forCellWithReuseIdentifier: footerCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: sectionHeaderIdentifier, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: sectionHeaderIdentifier)
|
||||
@@ -168,10 +170,10 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
return 1
|
||||
|
||||
case ProfileSection.Master.rawValue:
|
||||
return 3
|
||||
return masterSkills.count
|
||||
|
||||
case ProfileSection.Learning.rawValue:
|
||||
return 2
|
||||
return learningSkills.count
|
||||
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return 1
|
||||
@@ -229,24 +231,19 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
return cell
|
||||
|
||||
case ProfileSection.Master.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
|
||||
cell.rankView.barColor = UIColor.skillMasterColor()
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillCellIdentifier, forIndexPath: indexPath) as! SkillCell
|
||||
|
||||
let skillInfo = masterSkills[indexPath.row % masterSkills.count]
|
||||
cell.skillLabel.text = skillInfo["skill"] as? String
|
||||
cell.rankView.rank = skillInfo["rank"] as! Int
|
||||
|
||||
|
||||
return cell
|
||||
|
||||
case ProfileSection.Learning.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
|
||||
cell.rankView.barColor = UIColor.skillLearningColor()
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillCellIdentifier, forIndexPath: indexPath) as! SkillCell
|
||||
|
||||
let skillInfo = learningSkills[indexPath.row % learningSkills.count]
|
||||
cell.skillLabel.text = skillInfo["skill"] as? String
|
||||
cell.rankView.rank = skillInfo["rank"] as! Int
|
||||
|
||||
return cell
|
||||
|
||||
@@ -258,7 +255,7 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
return cell
|
||||
|
||||
default:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillCellIdentifier, forIndexPath: indexPath) as! SkillCell
|
||||
|
||||
return cell
|
||||
}
|
||||
@@ -325,10 +322,28 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
return CGSizeMake(collectionViewWidth, collectionViewWidth * profileAvatarAspectRatio)
|
||||
|
||||
case ProfileSection.Master.rawValue:
|
||||
return CGSizeMake(cellWidth, cellHeight)
|
||||
|
||||
let skillInfo = masterSkills[indexPath.row % masterSkills.count]
|
||||
|
||||
if let skillString = skillInfo["skill"] as? String {
|
||||
let rect = skillString.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: cellHeight), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: skillTextAttributes, context: nil)
|
||||
|
||||
return CGSizeMake(rect.width + 30, cellHeight)
|
||||
}
|
||||
|
||||
return CGSizeZero
|
||||
|
||||
case ProfileSection.Learning.rawValue:
|
||||
return CGSizeMake(cellWidth, cellHeight)
|
||||
|
||||
let skillInfo = learningSkills[indexPath.row % learningSkills.count]
|
||||
|
||||
if let skillString = skillInfo["skill"] as? String {
|
||||
let rect = skillString.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: cellHeight), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: skillTextAttributes, context: nil)
|
||||
|
||||
return CGSizeMake(rect.width + 30, cellHeight)
|
||||
}
|
||||
|
||||
return CGSizeZero
|
||||
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return CGSizeMake(collectionViewWidth, footerCellHeight)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// SkillCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/8.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SkillCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet weak var backgroundImageView: UIImageView!
|
||||
|
||||
@IBOutlet weak var skillLabel: UILabel!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
skillLabel.font = UIFont.skillTextFont()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7528.3" systemVersion="14C1514" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7518.3"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="SkillCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="99" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="99" height="40"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble_body" translatesAutoresizingMaskIntoConstraints="NO" id="4KZ-yR-VQ6" userLabel="Background Image View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="99" height="40"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Skill" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="prI-fu-aCg" userLabel="Skill Label">
|
||||
<rect key="frame" x="0.0" y="0.0" width="99" height="40"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="4KZ-yR-VQ6" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="4sC-RB-pGY"/>
|
||||
<constraint firstItem="prI-fu-aCg" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="VFw-pk-5m2"/>
|
||||
<constraint firstItem="prI-fu-aCg" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="XPk-hp-Pnx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4KZ-yR-VQ6" secondAttribute="trailing" id="YxK-JV-RP9"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4KZ-yR-VQ6" secondAttribute="bottom" id="ewi-IE-HdV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="prI-fu-aCg" secondAttribute="bottom" id="j2p-h5-mgW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="prI-fu-aCg" secondAttribute="trailing" id="tfv-VL-6Ld"/>
|
||||
<constraint firstItem="4KZ-yR-VQ6" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="w4Z-jQ-pXH"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="99" height="50"/>
|
||||
<connections>
|
||||
<outlet property="backgroundImageView" destination="4KZ-yR-VQ6" id="qZe-Gq-CEM"/>
|
||||
<outlet property="skillLabel" destination="prI-fu-aCg" id="UgO-cv-Laf"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="250.5" y="325"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="bubble_body" width="42" height="40"/>
|
||||
</resources>
|
||||
</document>
|
||||
Reference in New Issue
Block a user