From 688175f4687599cbf605fe8fec5d0c568f0c5929 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 12:11:27 +0800 Subject: [PATCH 1/9] new skillSelected style of SkillSelectionCell --- .../Contents.json | 23 ++++++++++++++++++ .../skill_bubble_large_empty.pdf | Bin 0 -> 4265 bytes .../RegisterSelectSkillsViewController.swift | 5 ++-- .../SkillSelection/SkillSelectionCell.swift | 13 ++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json create mode 100644 Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf diff --git a/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json new file mode 100644 index 00000000..87661c83 --- /dev/null +++ b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7bf76597c626cee4c34780bba7f74ff789fb9d63 GIT binary patch literal 4265 zcmai%2{@E(+sDyl8A4^rQYM)Z6|-8BeVtPFGM1Rl&eT{_vSfLP>|qL_>|3Ek$ewsj zvR7!bWzUjbzL}Qq>3MtKC1a4Rj-!hQkxak4U_FRhL_CQ=1gWS1-95-e ztSiumdC0WdO%%p8`<1_N--pnI+)IAer$-}hykrhNIJ*~G{A$5oZ?0XPYv9VH9n2ys zmxf=_h+ffdQ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8Vqi+7Guaw{6`-*`d5W?Q6Zhg>KiQ=AF5V zLi&oW-ao(KZCzhQ`&v5_?Fw?$8~oC)(;h_>8F7mk?lF2`R9b86P_{79qVZhAh*oo| z(~{ez*@fR_Zpf~z$mxBO_~ovzxb{yGpA5hs;$}uLewQ|eI#z?{Y96gV+VcMB#qRxK zXsT-2JOzijJou*gqjk}E$5Q6fv+7H;wHL9LS8aJ5qY2UF@Z2XgXG@%Pdvm5AP6rA{ zQzmMruRohheb@TFzi!0UzneK~Pcxg!5kAou{;$>yor~06o3S5gg^kpi%;~B+dw&~$ ztvS8LSgLM_?xWU*XwP1yo__gU`2@L!sJNELqgPu=J0HJlUO!kcWr)anz79}0s<`;6 zbzN*BjqA+dwFtlbDaoDm)u(SPA}licKJlW!!BR3+4d>^kge`$|Q>K+ZLllt~_ zEwQU0{igR;jXkcd>5FsMOp5B+;oMrq&AwIFNy6u`Zg0nh?3{?H8nM`?nDBJ z0kFm(>t7)Zw*JM$f1|hie}QQRC416|90rm-=SXm;(=!9z>FItWWEca!|Cv$~>w$G4 z+5fOVCE3ifARd4)gbB9MxI#3AGmf5yrEhq>|y`bqt&>p{jk zx)90V`+pNhU;6&h`yXQxiS7=D1LzxxcC#bVt@2~6MK{YCqMQN(DNi8S5#U4=5edg( pu_#3X3`Zm)=^KZKssR6Y$Pcr*d(f@%{Xh^3NChAmtZkqJ{6CMHQc3^- literal 0 HcmV?d00001 diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index 6a13fe31..ced7debc 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -367,9 +367,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 } } diff --git a/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift b/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift index d7e54801..1488c382 100644 --- a/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift +++ b/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift @@ -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() From 92118e21c32a771eb1c74370d080c19be72813d3 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 12:51:43 +0800 Subject: [PATCH 2/9] cancelButton in RegisterSelectSkillsViewController --- Yep/Base.lproj/Intro.storyboard | 35 +++++++++++++++++- .../flat_arrow_down.imageset/Contents.json | 12 ++++++ .../flat_arrow_down.pdf | Bin 0 -> 3957 bytes .../flat_arrow_left.imageset/Contents.json | 12 ++++++ .../flat_arrow_left.pdf | Bin 0 -> 3962 bytes .../RegisterSelectSkillsViewController.swift | 8 ++++ 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json create mode 100644 Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf create mode 100644 Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json create mode 100644 Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf diff --git a/Yep/Base.lproj/Intro.storyboard b/Yep/Base.lproj/Intro.storyboard index c443fbed..6d26a659 100644 --- a/Yep/Base.lproj/Intro.storyboard +++ b/Yep/Base.lproj/Intro.storyboard @@ -475,7 +475,7 @@ - + @@ -553,11 +553,40 @@ + + + + + + + + + + + + + + @@ -565,9 +594,12 @@ + + + @@ -782,5 +814,6 @@ + diff --git a/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json b/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json new file mode 100644 index 00000000..f9b973b8 --- /dev/null +++ b/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "flat_arrow_down.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf b/Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf new file mode 100644 index 0000000000000000000000000000000000000000..97f500e34dd1da8e7d39773c68f15d653cb4f394 GIT binary patch literal 3957 zcmai%c{r4P7soAA7?Mgv%ALoIWScRARQ6#gWlI_Rj2SzlG1%Qjx&G$a{`JLZ6=a0{Un4%06;ED(^q>(w# zoXlUi^RlrCj09i+5$6s*b_`H5CV0D$T>%xAWDY19xOtKZB-YatOD3QQPDDHb(9{I` zl1T)t7dU{^%e2kCL0h1DU2e?wvtLC~>Y4Enol~n}+CFs(piQmQkBwTgs6Fi;Ro?I@ z1~^_HD}%1+c#UXJhL1U0F&6o#%Wo!mLa-16qB2z0o~BIVZF9_>dfD#o(k6?N>o^`K zZGX@`Cof3IvXJ0VBW_NxK2W80#s95_q1?{gJ2HVYjUMBhZ{`ax`uo3jhF=_6@Ywb4 zv8^qHqPY{}BH*6wW08-gVP}NK2sm@af-mtr$%)_#sQwW2h~8w@dtZQ^ zT2>xU67X(VU19)W17itrB%opkX65ncChU)X<=>PSA0w9axL43fgqlUXdW-&%#rd&}GP(Rcb1K}OAXYi+=aiXK8 zob-kHFJHp-@y!dFHr1J-^qB(`55C!Am4(6djb_YH|M-)>ewW$czA6sWua`jeWGl`v zWR{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*hCr&ah8y+;c>mI12-qJQLK(?A z!awX_%71Fghgn0*KkSgOKQx3gj8*G@+NrUoqW{(q@WX%DArOD=i$JLT5eovT%xacj z{>UV(nV-{eQL`I1?!@x34j6(kG{f#{nUfd37MptOkq literal 0 HcmV?d00001 diff --git a/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json b/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json new file mode 100644 index 00000000..e65b817c --- /dev/null +++ b/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "flat_arrow_left.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf b/Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf new file mode 100644 index 0000000000000000000000000000000000000000..092c20a30672ff1a1b43f29da582954ae6fadbdc GIT binary patch literal 3962 zcmai%c{r4P7soAA7?R2oDR&-AO3X^iKGvuqkzK>g*p0?mODIbi$=0AGd$Jalr6D`% zHOZC=S%&OcvL^3L%lp*(yw~;K*L}_Xo9}(@^EC<^j z_g^Xcy2olnH9&Z@SCyLVght}9`cHdRG%l#9XJ7&0Bb938sdA&_{zDdiG1GnBE>}PO>G`Y(D<5S$To+j=m9%M&V3ty;kgxQ&7jklT49Yt4QBjvrR; zii@5tlCCr+y~%bejuGA5b=LqbTG_0ye`$eoDRA+1p}A)ZUFeK}ULqLhf&F2;=zumx%Kq0q`HWI*0QjcoQ9PUVy?60Y&g2G2VLt z%=|Kvc?O4d#%L1!04oSXPynDv8!#i8KR021^s5L)M1q3}js#dScGA)TYyf!_!HqyP z@x(ab0A`g?UQj^syH{0JW6giO~SBk(97i{8CWFQd$YsdoOPqBM7 zA(i143Df2mo{L;$W8q9}RC-S2jb2xBy2s*|>o^t#iqyBy-P4!sO#jr1-&iO!S+|EC zOKdnZe8bO>wp`A06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iiQX8!U{x{~N BxEBBb literal 0 HcmV?d00001 diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index ced7debc..bb58c23e 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -21,6 +21,8 @@ class RegisterSelectSkillsViewController: UIViewController { @IBOutlet weak var skillsCollectionView: UICollectionView! @IBOutlet weak var skillsCollectionViewBottomConstrain: NSLayoutConstraint! + @IBOutlet weak var cancelButton: UIButton! + let annotationHeight: CGFloat = 150 @IBOutlet weak var skillsCollectionViewEqualHeightToSkillCategoriesCollectionViewConstraint: NSLayoutConstraint! @@ -75,6 +77,8 @@ class RegisterSelectSkillsViewController: UIViewController { skillsCollectionView.registerNib(UINib(nibName: skillSelectionCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillSelectionCellIdentifier) + cancelButton.setTitle(NSLocalizedString("Cancel", comment: ""), forState: .Normal) + let layout = self.skillCategoriesCollectionView.collectionViewLayout as! UICollectionViewFlowLayout let originLineSpacing = layout.minimumLineSpacing @@ -135,6 +139,10 @@ class RegisterSelectSkillsViewController: UIViewController { skillsCollectionView.layoutIfNeeded() } + @IBAction func cancel() { + dismiss() + } + func dismiss() { presentingViewController?.dismissViewControllerAnimated(true, completion: nil) } From 473425f926ee94c6cbfbdae7322d68830c967b88 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 13:18:18 +0800 Subject: [PATCH 3/9] backButton for cancel detail skill select --- Yep/Base.lproj/Intro.storyboard | 20 +++++++++++++++++++ .../RegisterSelectSkillsViewController.swift | 15 ++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/Yep/Base.lproj/Intro.storyboard b/Yep/Base.lproj/Intro.storyboard index 6d26a659..f5a77713 100644 --- a/Yep/Base.lproj/Intro.storyboard +++ b/Yep/Base.lproj/Intro.storyboard @@ -572,12 +572,30 @@ + + + @@ -599,6 +617,7 @@ + @@ -815,5 +834,6 @@ + diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index bb58c23e..b45d7fbd 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -22,6 +22,7 @@ class RegisterSelectSkillsViewController: UIViewController { @IBOutlet weak var skillsCollectionViewBottomConstrain: NSLayoutConstraint! @IBOutlet weak var cancelButton: UIButton! + @IBOutlet weak var backButton: UIButton! let annotationHeight: CGFloat = 150 @IBOutlet weak var skillsCollectionViewEqualHeightToSkillCategoriesCollectionViewConstraint: NSLayoutConstraint! @@ -78,6 +79,10 @@ 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 @@ -143,6 +148,10 @@ class RegisterSelectSkillsViewController: UIViewController { dismiss() } + @IBAction func back() { + currentSkillCategoryButton?.toggleSelectionState() + } + func dismiss() { presentingViewController?.dismissViewControllerAnimated(true, completion: nil) } @@ -309,6 +318,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl self.skillsCollectionView.alpha = 1 + self.cancelButton.alpha = 0 + self.backButton.alpha = 1 + }, completion: { (finished) -> Void in }) @@ -332,6 +344,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl collectionView.alpha = 1 + self.cancelButton.alpha = 1 + self.backButton.alpha = 0 + }, completion: { (_) -> Void in button.removeFromSuperview() From 6d7614a01848c8960b7599c3b1cd95c9b759f6f9 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 13:33:26 +0800 Subject: [PATCH 4/9] skill categoryImageNames (we need Sport icon) --- .../RegisterSelectSkillsViewController.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index b45d7fbd..e9117d8a 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -228,8 +228,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) From 1be2aa95c4b16a72795abee55d7adff1af2b8ed5 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 15:40:42 +0800 Subject: [PATCH 5/9] add SkillAddCell --- Yep.xcodeproj/project.pbxproj | 16 +++++ .../RegisterPickSkillsViewController.swift | 65 ++++++++++++++----- Yep/Views/Cells/SkillAdd/SkillAddCell.swift | 18 +++++ Yep/Views/Cells/SkillAdd/SkillAddCell.xib | 33 ++++++++++ .../AddSkills/AddSkillsReusableView.xib | 11 ++-- 5 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 Yep/Views/Cells/SkillAdd/SkillAddCell.swift create mode 100644 Yep/Views/Cells/SkillAdd/SkillAddCell.xib diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 4252a091..86e0535e 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -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 = ""; }; 5033159B1AC101C80008A209 /* ChatRightTextCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ChatRightTextCell.xib; path = Views/Cells/ChatRightText/ChatRightTextCell.xib; sourceTree = ""; }; 5033159F1AC126100008A209 /* MessageToolbar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageToolbar.swift; path = Views/MessageToolbar/MessageToolbar.swift; sourceTree = ""; }; + 50392CCF1B393FF60009D647 /* SkillAddCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillAddCell.swift; path = Views/Cells/SkillAdd/SkillAddCell.swift; sourceTree = ""; }; + 50392CD01B393FF60009D647 /* SkillAddCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SkillAddCell.xib; path = Views/Cells/SkillAdd/SkillAddCell.xib; sourceTree = ""; }; 5039594C1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileSocialAccountGithubCell.swift; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.swift; sourceTree = ""; }; 5039594D1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileSocialAccountGithubCell.xib; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.xib; sourceTree = ""; }; 503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSLocale+Yep.swift"; path = "Extensions/NSLocale+Yep.swift"; sourceTree = ""; }; @@ -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 = ""; }; + 50392CCE1B393FAE0009D647 /* SkillAdd */ = { + isa = PBXGroup; + children = ( + 50392CCF1B393FF60009D647 /* SkillAddCell.swift */, + 50392CD01B393FF60009D647 /* SkillAddCell.xib */, + ); + name = SkillAdd; + sourceTree = ""; + }; 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 */, diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index e91edee6..41db38fc 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -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) @@ -252,11 +254,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 +268,42 @@ 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 + 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 + return cell + } default: - break + return UICollectionViewCell() } - - return cell } func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { @@ -333,12 +356,22 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec 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,7 +379,7 @@ 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 { diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift new file mode 100644 index 00000000..bd7e55b5 --- /dev/null +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift @@ -0,0 +1,18 @@ +// +// SkillAddCell.swift +// +// +// Created by NIX on 15/6/23. +// +// + +import UIKit + +class SkillAddCell: UICollectionViewCell { + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + +} diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.xib b/Yep/Views/Cells/SkillAdd/SkillAddCell.xib new file mode 100644 index 00000000..0d7929ef --- /dev/null +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.xib @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib index 251f1cdd..0cc3c7ce 100644 --- a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib +++ b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib @@ -1,5 +1,5 @@ - + @@ -11,13 +11,15 @@ - + From e7c011c1c49d3a7700705f69b3d2b45c0cb0f8c4 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 15:53:15 +0800 Subject: [PATCH 6/9] addSkillsAction logic for SkillAddCell --- .../RegisterPickSkillsViewController.swift | 42 ++++++++++++++++++- Yep/Views/Cells/SkillAdd/SkillAddCell.swift | 9 ++-- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index 41db38fc..54c937c8 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -148,12 +148,12 @@ class RegisterPickSkillsViewController: BaseViewController { if let skillSetType = sender as? Int { switch skillSetType { - case SkillSetType.Master.rawValue: + case SkillAddCell.SkillSetType.Master.rawValue: vc.annotationText = NSLocalizedString("What are you good at?", comment: "") vc.selectedSkillsSet = Set(self.masterSkills) vc.failedSelectSkillMessage = NSLocalizedString("This skill already in another learning skills set!", comment: "") - case SkillSetType.Learning.rawValue: + case SkillAddCell.SkillSetType.Learning.rawValue: vc.annotationText = NSLocalizedString("What are you learning?", comment: "") vc.selectedSkillsSet = Set(self.learningSkills) vc.failedSelectSkillMessage = NSLocalizedString("This skill already in another master skills set!", comment: "") @@ -283,6 +283,13 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec } 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 } @@ -298,6 +305,13 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec } 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 } @@ -339,6 +353,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) @@ -355,6 +370,7 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec var skillString = "" switch indexPath.section { + case Section.Master.rawValue: if indexPath.item < masterSkills.count { let skill = masterSkills[indexPath.item] @@ -386,6 +402,28 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec 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 + } + } } diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift index bd7e55b5..3f476b9f 100644 --- a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift @@ -10,9 +10,12 @@ import UIKit class SkillAddCell: UICollectionViewCell { - override func awakeFromNib() { - super.awakeFromNib() - // Initialization code + enum SkillSetType: Int { + case Master + case Learning } + var skillSetType: SkillSetType = .Master + + var addSkillsAction: ((SkillSetType) -> ())? } From 823c949901a185526fd92ef6fc78b828495c9ed0 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 15:59:01 +0800 Subject: [PATCH 7/9] clean AddSkillsReusableView --- .../RegisterPickSkillsViewController.swift | 8 ++------ Yep/Views/Cells/SkillAdd/SkillAddCell.swift | 5 ----- .../AddSkills/AddSkillsReusableView.swift | 20 ------------------- .../AddSkills/AddSkillsReusableView.xib | 17 ---------------- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index 54c937c8..62883ff4 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -148,12 +148,12 @@ class RegisterPickSkillsViewController: BaseViewController { if let skillSetType = sender as? Int { switch skillSetType { - case SkillAddCell.SkillSetType.Master.rawValue: + case SkillSetType.Master.rawValue: vc.annotationText = NSLocalizedString("What are you good at?", comment: "") vc.selectedSkillsSet = Set(self.masterSkills) vc.failedSelectSkillMessage = NSLocalizedString("This skill already in another learning skills set!", comment: "") - case SkillAddCell.SkillSetType.Learning.rawValue: + case SkillSetType.Learning.rawValue: vc.annotationText = NSLocalizedString("What are you learning?", comment: "") vc.selectedSkillsSet = Set(self.learningSkills) vc.failedSelectSkillMessage = NSLocalizedString("This skill already in another master skills set!", comment: "") @@ -338,10 +338,6 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec break } - header.addSkillsAction = { skillSetType in - self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue) - } - return header } else { diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift index 3f476b9f..55b98530 100644 --- a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift @@ -10,11 +10,6 @@ import UIKit class SkillAddCell: UICollectionViewCell { - enum SkillSetType: Int { - case Master - case Learning - } - var skillSetType: SkillSetType = .Master var addSkillsAction: ((SkillSetType) -> ())? diff --git a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift index 8966f132..153888d4 100644 --- a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift +++ b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift @@ -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) - } - } - } diff --git a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib index 0cc3c7ce..662d5770 100644 --- a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib +++ b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib @@ -17,33 +17,16 @@ - - - - - - - From 72a68f8ce4f37f555cf94bc37496e04d99e1b97d Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 18:09:03 +0800 Subject: [PATCH 8/9] fix sync My user info to YepUserDefaults; conversationsTableView.reloadData need in main queue (realm may change in other thread to trigger listener) --- Yep/Services/YepServiceSync.swift | 8 ++++++++ .../Conversations/ConversationsViewController.swift | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Yep/Services/YepServiceSync.swift b/Yep/Services/YepServiceSync.swift index 065f84bf..429ecc93 100644 --- a/Yep/Services/YepServiceSync.swift +++ b/Yep/Services/YepServiceSync.swift @@ -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 } diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index d58b9d61..179ea77d 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -109,7 +109,9 @@ class ConversationsViewController: UIViewController { func reloadConversationsTableView() { // println("reloadConversationsTableView") - conversationsTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.conversationsTableView.reloadData() + } } } From ff18a076361551ef8f3ed48036196960bcd96c39 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Tue, 23 Jun 2015 18:16:34 +0800 Subject: [PATCH 9/9] put all reloadData() in main queue --- Yep/ViewControllers/Contacts/ContactsViewController.swift | 4 +++- .../Conversation/ConversationViewController.swift | 4 +++- .../Conversations/ConversationsViewController.swift | 3 +-- Yep/ViewControllers/Discover/DiscoverViewController.swift | 6 ++++-- .../PickLocation/PickLocationViewController.swift | 4 +++- Yep/ViewControllers/Profile/ProfileViewController.swift | 8 +++++--- .../Register/RegisterPickSkillsViewController.swift | 4 +++- .../Register/RegisterSelectSkillsViewController.swift | 8 +++++--- .../SearchedUsers/SearchedUsersViewController.swift | 4 +++- .../SocialWorks/SocialWorkDribbbleViewController.swift | 4 +++- .../SocialWorks/SocialWorkGithubViewController.swift | 4 +++- .../SocialWorks/SocialWorkInstagramViewController.swift | 4 +++- 12 files changed, 39 insertions(+), 18 deletions(-) diff --git a/Yep/ViewControllers/Contacts/ContactsViewController.swift b/Yep/ViewControllers/Contacts/ContactsViewController.swift index 91ca87af..3910e943 100644 --- a/Yep/ViewControllers/Contacts/ContactsViewController.swift +++ b/Yep/ViewControllers/Contacts/ContactsViewController.swift @@ -53,7 +53,9 @@ class ContactsViewController: BaseViewController { // MARK: Actions func updateContactsTableView() { - contactsTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.contactsTableView.reloadData() + } } func syncFriendships() { diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 55138d4e..2027790b 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -1083,7 +1083,9 @@ class ConversationViewController: BaseViewController { } func reloadConversationCollectionView() { - conversationCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.conversationCollectionView.reloadData() + } } func cleanTextInput() { diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index 179ea77d..51ddf211 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -84,8 +84,7 @@ class ConversationsViewController: UIViewController { super.viewWillAppear(animated) //Make sure unread message refreshed - conversationsTableView.reloadData() - + reloadConversationsTableView() } override func viewDidAppear(animated: Bool) { diff --git a/Yep/ViewControllers/Discover/DiscoverViewController.swift b/Yep/ViewControllers/Discover/DiscoverViewController.swift index c2bc2679..de5425ef 100644 --- a/Yep/ViewControllers/Discover/DiscoverViewController.swift +++ b/Yep/ViewControllers/Discover/DiscoverViewController.swift @@ -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) + } } diff --git a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift index d0ffcea9..e3b15ea5 100644 --- a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift +++ b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift @@ -123,7 +123,9 @@ class PickLocationViewController: UIViewController { } func reloadTableView() { - tableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.tableView.reloadData() + } } } diff --git a/Yep/ViewControllers/Profile/ProfileViewController.swift b/Yep/ViewControllers/Profile/ProfileViewController.swift index 4444bb5f..5b12986d 100644 --- a/Yep/ViewControllers/Profile/ProfileViewController.swift +++ b/Yep/ViewControllers/Profile/ProfileViewController.swift @@ -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() { diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index 62883ff4..c10001ea 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -65,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) { diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index e9117d8a..9bffd82e 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -139,9 +139,11 @@ 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() { diff --git a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift index a458620e..336b50de 100644 --- a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift +++ b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift @@ -44,7 +44,9 @@ class SearchedUsersViewController: BaseViewController { // MARK: Actions func updateSearchedUsersTableView() { - searchedUsersTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.searchedUsersTableView.reloadData() + } } // MARK: Navigation diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift index edac1fad..912c0d0f 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift @@ -97,7 +97,9 @@ class SocialWorkDribbbleViewController: BaseViewController { // MARK: Actions func updateDribbbleCollectionView() { - dribbbleCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.dribbbleCollectionView.reloadData() + } } func share() { diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift index c5bd5451..b98006d5 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift @@ -125,7 +125,9 @@ class SocialWorkGithubViewController: BaseViewController { // MARK: Actions func updateGithubTableView() { - githubTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.githubTableView.reloadData() + } } func share() { diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift index d9b4baab..ac621def 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift @@ -94,7 +94,9 @@ class SocialWorkInstagramViewController: BaseViewController { // MARK: Actions func updateInstagramCollectionView() { - instagramCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.instagramCollectionView.reloadData() + } } func share() {