Merge branch 'feature/details_of_pick_skills' into develop

This commit is contained in:
nixzhu
2015-06-23 18:17:39 +08:00
26 changed files with 359 additions and 81 deletions
+16
View File
@@ -89,6 +89,8 @@
5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5033159A1AC101C80008A209 /* ChatRightTextCell.swift */; };
5033159D1AC101C80008A209 /* ChatRightTextCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5033159B1AC101C80008A209 /* ChatRightTextCell.xib */; };
503315A01AC126100008A209 /* MessageToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5033159F1AC126100008A209 /* MessageToolbar.swift */; };
50392CD11B393FF60009D647 /* SkillAddCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50392CCF1B393FF60009D647 /* SkillAddCell.swift */; };
50392CD21B393FF60009D647 /* SkillAddCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50392CD01B393FF60009D647 /* SkillAddCell.xib */; };
5039594E1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5039594C1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift */; };
5039594F1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5039594D1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib */; };
503A54ED1B328ADB002077BD /* NSLocale+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */; };
@@ -305,6 +307,8 @@
5033159A1AC101C80008A209 /* ChatRightTextCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatRightTextCell.swift; path = Views/Cells/ChatRightText/ChatRightTextCell.swift; sourceTree = "<group>"; };
5033159B1AC101C80008A209 /* ChatRightTextCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ChatRightTextCell.xib; path = Views/Cells/ChatRightText/ChatRightTextCell.xib; sourceTree = "<group>"; };
5033159F1AC126100008A209 /* MessageToolbar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageToolbar.swift; path = Views/MessageToolbar/MessageToolbar.swift; sourceTree = "<group>"; };
50392CCF1B393FF60009D647 /* SkillAddCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillAddCell.swift; path = Views/Cells/SkillAdd/SkillAddCell.swift; sourceTree = "<group>"; };
50392CD01B393FF60009D647 /* SkillAddCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SkillAddCell.xib; path = Views/Cells/SkillAdd/SkillAddCell.xib; sourceTree = "<group>"; };
5039594C1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileSocialAccountGithubCell.swift; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.swift; sourceTree = "<group>"; };
5039594D1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileSocialAccountGithubCell.xib; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.xib; sourceTree = "<group>"; };
503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSLocale+Yep.swift"; path = "Extensions/NSLocale+Yep.swift"; sourceTree = "<group>"; };
@@ -780,6 +784,7 @@
50553F911ADB8BA600F80B59 /* ChatSectionDate */,
505EC8191ADF8155001D27E0 /* SkillCategory */,
505EC81E1ADFBE1F001D27E0 /* SkillSelection */,
50392CCE1B393FAE0009D647 /* SkillAdd */,
50EB8CC11AE89EDE001AC1EE /* ChatLeftVideo */,
50EB8CC61AE89F15001AC1EE /* ChatRightVideo */,
50894CF71AEA4A04000981AF /* SettingsUser */,
@@ -978,6 +983,15 @@
name = MessageToolbar;
sourceTree = "<group>";
};
50392CCE1B393FAE0009D647 /* SkillAdd */ = {
isa = PBXGroup;
children = (
50392CCF1B393FF60009D647 /* SkillAddCell.swift */,
50392CD01B393FF60009D647 /* SkillAddCell.xib */,
);
name = SkillAdd;
sourceTree = "<group>";
};
503CAB441AC00CB900DFE830 /* Conversation */ = {
isa = PBXGroup;
children = (
@@ -1557,6 +1571,7 @@
50894D081AEDFDA2000981AF /* EditProfileMoreInfoCell.xib in Resources */,
508D174D1ACCF49B0092D666 /* ChatRightAudioCell.xib in Resources */,
50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */,
50392CD21B393FF60009D647 /* SkillAddCell.xib in Resources */,
503315981AC1017E0008A209 /* ChatLeftTextCell.xib in Resources */,
50894D031AEA6433000981AF /* EditProfileLessInfoCell.xib in Resources */,
0AD7EA771AC3EEB000617758 /* PushConfig.plist in Resources */,
@@ -1754,6 +1769,7 @@
508B717D1B1FE9B6006BDDB3 /* ChatRightBaseCell.swift in Sources */,
50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */,
502AE5531AB93215005BD199 /* ProfileFooterCell.swift in Sources */,
50392CD11B393FF60009D647 /* SkillAddCell.swift in Sources */,
50EB8CCB1AEA1AC0001AC1EE /* MediaView.swift in Sources */,
506923121ADE025200D27574 /* Waver.swift in Sources */,
0A5D83991AC5D91E000045BF /* ContactsSearchTableViewController.swift in Sources */,
+54 -1
View File
@@ -475,7 +475,7 @@
<!--Register Pick Skills View Controller-->
<scene sceneID="vgc-NH-qgo">
<objects>
<viewController storyboardIdentifier="RegisterPickSkillsViewController" automaticallyAdjustsScrollViewInsets="NO" id="OBL-Og-6Ae" customClass="RegisterPickSkillsViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="RegisterPickSkillsViewController" automaticallyAdjustsScrollViewInsets="NO" hidesBottomBarWhenPushed="YES" id="OBL-Og-6Ae" customClass="RegisterPickSkillsViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="p8G-DH-wnn"/>
<viewControllerLayoutGuide type="bottom" id="iwK-9W-H4c"/>
@@ -553,11 +553,58 @@
<outlet property="delegate" destination="vEE-XY-eq4" id="3Vs-cc-fvq"/>
</connections>
</collectionView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VwP-wh-PsD">
<rect key="frame" x="0.0" y="540" width="600" height="60"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ssh-a5-EGH">
<rect key="frame" x="260" y="5" width="80" height="50"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="50" id="oNI-Fk-e5A"/>
</constraints>
<fontDescription key="fontDescription" name="Helvetica-Light" family="Helvetica" pointSize="18"/>
<inset key="contentEdgeInsets" minX="8" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="-10" minY="5" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Cancel" image="flat_arrow_down">
<color key="titleColor" red="0.13725490200000001" green="0.56862745100000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="cancel" destination="vEE-XY-eq4" eventType="touchUpInside" id="Ldz-fv-9LN"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AY6-Bh-fXh">
<rect key="frame" x="273" y="5" width="54" height="50"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Z7e-qU-8v2"/>
</constraints>
<fontDescription key="fontDescription" name="Helvetica-Light" family="Helvetica" pointSize="18"/>
<inset key="contentEdgeInsets" minX="6" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="-7" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Back" image="flat_arrow_left">
<color key="titleColor" red="0.13725490200000001" green="0.56862745100000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="back" destination="vEE-XY-eq4" eventType="touchUpInside" id="0VR-Aq-PS0"/>
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="AY6-Bh-fXh" secondAttribute="centerX" id="Trr-6g-2dt"/>
<constraint firstAttribute="centerX" secondItem="Ssh-a5-EGH" secondAttribute="centerX" id="cON-1Z-JBr"/>
<constraint firstAttribute="height" constant="60" id="jdB-3f-yEa"/>
<constraint firstAttribute="centerY" secondItem="AY6-Bh-fXh" secondAttribute="centerY" id="l6a-zv-aRm"/>
<constraint firstAttribute="centerY" secondItem="Ssh-a5-EGH" secondAttribute="centerY" id="lc2-tG-IwL"/>
</constraints>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="EJ5-Hf-UMM" secondAttribute="trailing" id="1YD-5H-hOD"/>
<constraint firstItem="VwP-wh-PsD" firstAttribute="leading" secondItem="gsh-ws-D5N" secondAttribute="leading" id="3BG-Yz-Y7A"/>
<constraint firstItem="xur-C9-Tc1" firstAttribute="height" secondItem="EJ5-Hf-UMM" secondAttribute="height" constant="-150" id="D88-ER-CcS"/>
<constraint firstItem="bNl-1o-JmM" firstAttribute="top" secondItem="EJ5-Hf-UMM" secondAttribute="bottom" id="DLB-At-GP1"/>
<constraint firstAttribute="trailing" secondItem="xur-C9-Tc1" secondAttribute="trailing" id="Sih-Gb-ELE"/>
@@ -565,9 +612,13 @@
<constraint firstItem="bNl-1o-JmM" firstAttribute="top" secondItem="xur-C9-Tc1" secondAttribute="bottom" id="a1o-Ix-bA3"/>
<constraint firstItem="EJ5-Hf-UMM" firstAttribute="top" secondItem="SoT-jT-Jpl" secondAttribute="bottom" id="bff-NW-tC0"/>
<constraint firstItem="EJ5-Hf-UMM" firstAttribute="leading" secondItem="gsh-ws-D5N" secondAttribute="leading" id="dDa-xG-8H8"/>
<constraint firstAttribute="bottom" secondItem="VwP-wh-PsD" secondAttribute="bottom" id="fYG-72-Avb"/>
<constraint firstAttribute="trailing" secondItem="VwP-wh-PsD" secondAttribute="trailing" id="iTs-tl-kfZ"/>
</constraints>
</view>
<connections>
<outlet property="backButton" destination="AY6-Bh-fXh" id="cRW-dH-T2r"/>
<outlet property="cancelButton" destination="Ssh-a5-EGH" id="nBT-cm-Ons"/>
<outlet property="skillCategoriesCollectionView" destination="EJ5-Hf-UMM" id="WZ8-pq-Xox"/>
<outlet property="skillsCollectionView" destination="xur-C9-Tc1" id="VuZ-ln-vlC"/>
<outlet property="skillsCollectionViewBottomConstrain" destination="a1o-Ix-bA3" id="7Ht-mN-CpY"/>
@@ -782,5 +833,7 @@
<image name="button_camera_roll" width="40" height="40"/>
<image name="button_capture" width="70" height="70"/>
<image name="default_avatar" width="100" height="100"/>
<image name="flat_arrow_down" width="14" height="5"/>
<image name="flat_arrow_left" width="6" height="15"/>
</resources>
</document>
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "flat_arrow_down.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "flat_arrow_left.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "skill_bubble_large_empty.pdf",
"resizing" : {
"mode" : "3-part-horizontal",
"center" : {
"mode" : "fill",
"width" : 1
},
"capInsets" : {
"right" : 17,
"left" : 17
}
}
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
+8
View File
@@ -334,10 +334,18 @@ func syncMyInfoAndDoFurtherAction(furtherAction: () -> Void) {
// also save some infomation in YepUserDefaults
if let nickname = friendInfo["nickname"] as? String {
YepUserDefaults.nickname.value = nickname
}
if let introduction = friendInfo["introduction"] as? String {
YepUserDefaults.introduction.value = introduction
}
if let avatarURLString = friendInfo["avatar_url"] as? String {
YepUserDefaults.avatarURLString.value = avatarURLString
}
if let areaCode = friendInfo["phone_code"] as? String {
YepUserDefaults.areaCode.value = areaCode
}
@@ -53,7 +53,9 @@ class ContactsViewController: BaseViewController {
// MARK: Actions
func updateContactsTableView() {
contactsTableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.contactsTableView.reloadData()
}
}
func syncFriendships() {
@@ -1083,7 +1083,9 @@ class ConversationViewController: BaseViewController {
}
func reloadConversationCollectionView() {
conversationCollectionView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.conversationCollectionView.reloadData()
}
}
func cleanTextInput() {
@@ -84,8 +84,7 @@ class ConversationsViewController: UIViewController {
super.viewWillAppear(animated)
//Make sure unread message refreshed
conversationsTableView.reloadData()
reloadConversationsTableView()
}
override func viewDidAppear(animated: Bool) {
@@ -109,7 +108,9 @@ class ConversationsViewController: UIViewController {
func reloadConversationsTableView() {
// println("reloadConversationsTableView")
conversationsTableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.conversationsTableView.reloadData()
}
}
}
@@ -97,8 +97,10 @@ class DiscoverViewController: BaseViewController {
}
func updateDiscoverTableView() {
//discoverTableView.reloadData()
discoverTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Automatic)
dispatch_async(dispatch_get_main_queue()) {
//self.discoverTableView.reloadData()
self.discoverTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Automatic)
}
}
@@ -123,7 +123,9 @@ class PickLocationViewController: UIViewController {
}
func reloadTableView() {
tableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.tableView.reloadData()
}
}
}
@@ -515,9 +515,11 @@ class ProfileViewController: UIViewController {
}
func updateProfileCollectionView() {
profileCollectionView.collectionViewLayout.invalidateLayout()
profileCollectionView.reloadData()
profileCollectionView.layoutIfNeeded()
dispatch_async(dispatch_get_main_queue()) {
self.profileCollectionView.collectionViewLayout.invalidateLayout()
self.profileCollectionView.reloadData()
self.profileCollectionView.layoutIfNeeded()
}
}
func sayHi() {
@@ -19,6 +19,7 @@ class RegisterPickSkillsViewController: BaseViewController {
var learningSkills = [Skill]()
let skillSelectionCellIdentifier = "SkillSelectionCell"
let skillAddCellIdentifier = "SkillAddCell"
let addSkillsReusableViewIdentifier = "AddSkillsReusableView"
let skillTextAttributes = [NSFontAttributeName: UIFont.skillTextLargeFont()]
@@ -51,6 +52,7 @@ class RegisterPickSkillsViewController: BaseViewController {
skillsCollectionView.registerNib(UINib(nibName: addSkillsReusableViewIdentifier, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: addSkillsReusableViewIdentifier)
skillsCollectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "footer")
skillsCollectionView.registerNib(UINib(nibName: skillSelectionCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillSelectionCellIdentifier)
skillsCollectionView.registerNib(UINib(nibName: skillAddCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillAddCellIdentifier)
allSkillCategories(failureHandler: { (reason, errorMessage) -> Void in
defaultFailureHandler(reason, errorMessage)
@@ -63,7 +65,9 @@ class RegisterPickSkillsViewController: BaseViewController {
// MARK: Actions
func updateSkillsCollectionView() {
skillsCollectionView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.skillsCollectionView.reloadData()
}
}
@IBAction func saveSkills(sender: AnyObject) {
@@ -252,11 +256,12 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
switch section {
case Section.Master.rawValue:
return masterSkills.count
return masterSkills.count + 1
case Section.Learning.rawValue:
return learningSkills.count
return learningSkills.count + 1
default:
return 0
@@ -265,22 +270,56 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell
switch indexPath.section {
case Section.Master.rawValue:
let skill = masterSkills[indexPath.item]
cell.skillLabel.text = skill.localName
if indexPath.item < masterSkills.count {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell
let skill = masterSkills[indexPath.item]
cell.skillLabel.text = skill.localName
return cell
} else {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillAddCellIdentifier, forIndexPath: indexPath) as! SkillAddCell
cell.skillSetType = .Master
cell.addSkillsAction = { skillSetType in
self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue)
}
return cell
}
case Section.Learning.rawValue:
let skill = learningSkills[indexPath.item]
cell.skillLabel.text = skill.localName
if indexPath.item < learningSkills.count {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell
let skill = learningSkills[indexPath.item]
cell.skillLabel.text = skill.localName
return cell
} else {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillAddCellIdentifier, forIndexPath: indexPath) as! SkillAddCell
cell.skillSetType = .Learning
cell.addSkillsAction = { skillSetType in
self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue)
}
return cell
}
default:
break
return UICollectionViewCell()
}
return cell
}
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
@@ -301,10 +340,6 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
break
}
header.addSkillsAction = { skillSetType in
self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue)
}
return header
} else {
@@ -316,6 +351,7 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
switch section {
case Section.Master.rawValue:
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset)
@@ -332,13 +368,24 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
var skillString = ""
switch indexPath.section {
case Section.Master.rawValue:
let skill = masterSkills[indexPath.item]
skillString = skill.localName
if indexPath.item < masterSkills.count {
let skill = masterSkills[indexPath.item]
skillString = skill.localName
} else {
return CGSize(width: SkillSelectionCell.height, height: SkillSelectionCell.height)
}
case Section.Learning.rawValue:
let skill = learningSkills[indexPath.item]
skillString = skill.localName
if indexPath.item < learningSkills.count {
let skill = learningSkills[indexPath.item]
skillString = skill.localName
} else {
return CGSize(width: SkillSelectionCell.height, height: SkillSelectionCell.height)
}
default:
break
@@ -346,13 +393,35 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec
let rect = skillString.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: SkillSelectionCell.height), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: skillTextAttributes, context: nil)
return CGSizeMake(rect.width + 24, SkillSelectionCell.height)
return CGSize(width: rect.width + 24, height: SkillSelectionCell.height)
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSizeMake(collectionViewWidth - (sectionLeftEdgeInset + sectionRightEdgeInset), 70)
}
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
switch indexPath.section {
case Section.Master.rawValue:
if indexPath.item == masterSkills.count {
if let cell = collectionView.cellForItemAtIndexPath(indexPath) as? SkillAddCell {
cell.addSkillsAction?(cell.skillSetType)
}
}
case Section.Learning.rawValue:
if indexPath.item == learningSkills.count {
if let cell = collectionView.cellForItemAtIndexPath(indexPath) as? SkillAddCell {
cell.addSkillsAction?(cell.skillSetType)
}
}
default:
break
}
}
}
@@ -21,6 +21,9 @@ class RegisterSelectSkillsViewController: UIViewController {
@IBOutlet weak var skillsCollectionView: UICollectionView!
@IBOutlet weak var skillsCollectionViewBottomConstrain: NSLayoutConstraint!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var backButton: UIButton!
let annotationHeight: CGFloat = 150
@IBOutlet weak var skillsCollectionViewEqualHeightToSkillCategoriesCollectionViewConstraint: NSLayoutConstraint!
@@ -75,6 +78,12 @@ class RegisterSelectSkillsViewController: UIViewController {
skillsCollectionView.registerNib(UINib(nibName: skillSelectionCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillSelectionCellIdentifier)
cancelButton.setTitle(NSLocalizedString("Cancel", comment: ""), forState: .Normal)
backButton.setTitle(NSLocalizedString("Back", comment: ""), forState: .Normal)
cancelButton.alpha = 1
backButton.alpha = 0
let layout = self.skillCategoriesCollectionView.collectionViewLayout as! UICollectionViewFlowLayout
let originLineSpacing = layout.minimumLineSpacing
@@ -130,9 +139,19 @@ class RegisterSelectSkillsViewController: UIViewController {
// MARK: Actions
func updateSkillsCollectionView() {
skillsCollectionView.collectionViewLayout.invalidateLayout()
skillsCollectionView.reloadData()
skillsCollectionView.layoutIfNeeded()
dispatch_async(dispatch_get_main_queue()) {
self.skillsCollectionView.collectionViewLayout.invalidateLayout()
self.skillsCollectionView.reloadData()
self.skillsCollectionView.layoutIfNeeded()
}
}
@IBAction func cancel() {
dismiss()
}
@IBAction func back() {
currentSkillCategoryButton?.toggleSelectionState()
}
func dismiss() {
@@ -211,8 +230,20 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl
let skillCategory = skillCategories[indexPath.item]
let categoryImageNames = [
"Art": "icon_skill_art",
"Technology": "icon_skill_tech",
"Sport": "icon_skill_sport",
"Life Style": "icon_skill_life",
]
cell.categoryTitle = skillCategory.localName
//cell.categoryImage =
if let categoryImageName = categoryImageNames[skillCategory.name] {
cell.categoryImage = UIImage(named: categoryImageName)
} else {
cell.categoryImage = UIImage(named: "icon_skill_art")
}
let tintColor = skillCategoryTintColors[indexPath.item % skillCategoryTintColors.count]
cell.skillCategoryButton.setBackgroundImage(UIImage(named: "button_skill_category")!.imageWithGradientTintColor(tintColor).resizableImageWithCapInsets(UIEdgeInsets(top: 30, left: 40, bottom: 30, right: 40)), forState: .Normal)
@@ -301,6 +332,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl
self.skillsCollectionView.alpha = 1
self.cancelButton.alpha = 0
self.backButton.alpha = 1
}, completion: { (finished) -> Void in
})
@@ -324,6 +358,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl
collectionView.alpha = 1
self.cancelButton.alpha = 1
self.backButton.alpha = 0
}, completion: { (_) -> Void in
button.removeFromSuperview()
@@ -367,9 +404,10 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl
private func updateSkillSelectionCell(skillSelectionCell: SkillSelectionCell, withSkill skill: Skill) {
if selectedSkillsSet.contains(skill) {
skillSelectionCell.tintColor = UIColor.darkGrayColor()
skillSelectionCell.skillSelected = true
} else {
skillSelectionCell.tintColor = UIColor.yepTintColor()
skillSelectionCell.skillSelected = false
}
}
@@ -44,7 +44,9 @@ class SearchedUsersViewController: BaseViewController {
// MARK: Actions
func updateSearchedUsersTableView() {
searchedUsersTableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.searchedUsersTableView.reloadData()
}
}
// MARK: Navigation
@@ -97,7 +97,9 @@ class SocialWorkDribbbleViewController: BaseViewController {
// MARK: Actions
func updateDribbbleCollectionView() {
dribbbleCollectionView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.dribbbleCollectionView.reloadData()
}
}
func share() {
@@ -125,7 +125,9 @@ class SocialWorkGithubViewController: BaseViewController {
// MARK: Actions
func updateGithubTableView() {
githubTableView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.githubTableView.reloadData()
}
}
func share() {
@@ -94,7 +94,9 @@ class SocialWorkInstagramViewController: BaseViewController {
// MARK: Actions
func updateInstagramCollectionView() {
instagramCollectionView.reloadData()
dispatch_async(dispatch_get_main_queue()) {
self.instagramCollectionView.reloadData()
}
}
func share() {
@@ -0,0 +1,16 @@
//
// SkillAddCell.swift
//
//
// Created by NIX on 15/6/23.
//
//
import UIKit
class SkillAddCell: UICollectionViewCell {
var skillSetType: SkillSetType = .Master
var addSkillsAction: ((SkillSetType) -> ())?
}
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A178w" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</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" reuseIdentifier="SkillAddCell" id="gTV-IL-0wX" customClass="SkillAddCell" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="skill_add" translatesAutoresizingMaskIntoConstraints="NO" id="CF3-PA-x8h">
<rect key="frame" x="10" y="10" width="30" height="30"/>
<animations/>
</imageView>
</subviews>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<animations/>
<constraints>
<constraint firstAttribute="centerY" secondItem="CF3-PA-x8h" secondAttribute="centerY" id="F9p-PM-DCD"/>
<constraint firstAttribute="centerX" secondItem="CF3-PA-x8h" secondAttribute="centerX" id="GIJ-AH-SFU"/>
</constraints>
</collectionViewCell>
</objects>
<resources>
<image name="skill_add" width="30" height="30"/>
</resources>
</document>
@@ -16,6 +16,19 @@ class SkillSelectionCell: UICollectionViewCell {
@IBOutlet weak var skillLabel: UILabel!
var skillSelected: Bool = false {
willSet {
if newValue {
backgroundImageView.image = UIImage(named: "skill_bubble_large_empty")
skillLabel.textColor = UIColor.yepTintColor()
} else {
backgroundImageView.image = UIImage(named: "skill_bubble_large")
skillLabel.textColor = UIColor.whiteColor()
}
}
}
override func awakeFromNib() {
super.awakeFromNib()
@@ -29,26 +29,6 @@ class AddSkillsReusableView: UICollectionReusableView {
skillTypeLabel.text = "\(newValue)"
}
}
var addSkillsAction: ((SkillSetType) -> ())?
@IBOutlet weak var skillTypeLabel: UILabel!
@IBOutlet weak var addSkillsButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
addSkillsButton.tintColor = UIColor.yepTintColor()
addSkillsButton.addTarget(self, action: "tryAddSkills", forControlEvents: .TouchUpInside)
}
func tryAddSkills() {
if let action = addSkillsAction {
action(skillSetType)
}
}
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A178w" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
@@ -11,36 +11,22 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Skill Type" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zXh-oX-lPA" userLabel="Skill Type Label">
<rect key="frame" x="20" y="23" width="118.5" height="36"/>
<rect key="frame" x="20" y="23" width="119" height="36"/>
<animations/>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="30"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TWY-sr-X81" userLabel="Add Skills Button">
<rect key="frame" x="138.5" y="19" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="L4S-hn-J1Q"/>
<constraint firstAttribute="width" constant="44" id="Qii-1x-s7B"/>
</constraints>
<state key="normal" image="skill_add">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<animations/>
<constraints>
<constraint firstItem="TWY-sr-X81" firstAttribute="centerY" secondItem="zXh-oX-lPA" secondAttribute="centerY" id="2v5-S5-iKY"/>
<constraint firstItem="TWY-sr-X81" firstAttribute="leading" secondItem="zXh-oX-lPA" secondAttribute="trailing" id="QzM-8D-33Y"/>
<constraint firstItem="zXh-oX-lPA" firstAttribute="leading" secondItem="U6b-Vx-4bR" secondAttribute="leading" constant="20" id="eii-nG-1pk"/>
<constraint firstAttribute="centerY" secondItem="zXh-oX-lPA" secondAttribute="centerY" id="hOl-bD-9z7"/>
</constraints>
<connections>
<outlet property="addSkillsButton" destination="TWY-sr-X81" id="xoJ-Re-HWz"/>
<outlet property="skillTypeLabel" destination="zXh-oX-lPA" id="qEO-HY-0G3"/>
</connections>
<point key="canvasLocation" x="318" y="411"/>
</collectionReusableView>
</objects>
<resources>
<image name="skill_add" width="30" height="30"/>
</resources>
</document>