mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-21 18:56:29 +10:00
UI of Profile
This commit is contained in:
@@ -41,6 +41,14 @@
|
||||
502AE5381AB866E3005BD199 /* LoginVerifyMobileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE5371AB866E3005BD199 /* LoginVerifyMobileViewController.swift */; };
|
||||
502AE53A1AB871C1005BD199 /* YepAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE5391AB871C1005BD199 /* YepAlert.swift */; };
|
||||
502AE53D1AB87C0D005BD199 /* YepUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE53C1AB87C0D005BD199 /* YepUserDefaults.swift */; };
|
||||
502AE5401AB88862005BD199 /* SkillRankCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE53E1AB88862005BD199 /* SkillRankCell.swift */; };
|
||||
502AE5411AB88862005BD199 /* SkillRankCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 502AE53F1AB88862005BD199 /* SkillRankCell.xib */; };
|
||||
502AE54E1AB93175005BD199 /* ProfileHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE54C1AB93175005BD199 /* ProfileHeaderCell.swift */; };
|
||||
502AE54F1AB93175005BD199 /* ProfileHeaderCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 502AE54D1AB93175005BD199 /* ProfileHeaderCell.xib */; };
|
||||
502AE5531AB93215005BD199 /* ProfileFooterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE5511AB93215005BD199 /* ProfileFooterCell.swift */; };
|
||||
502AE5541AB93215005BD199 /* ProfileFooterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 502AE5521AB93215005BD199 /* ProfileFooterCell.xib */; };
|
||||
502AE5581AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 502AE5561AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift */; };
|
||||
502AE5591AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 502AE5571AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -92,6 +100,14 @@
|
||||
502AE5371AB866E3005BD199 /* LoginVerifyMobileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoginVerifyMobileViewController.swift; path = ViewControllers/Login/LoginVerifyMobileViewController.swift; sourceTree = "<group>"; };
|
||||
502AE5391AB871C1005BD199 /* YepAlert.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepAlert.swift; path = Helpers/YepAlert.swift; sourceTree = "<group>"; };
|
||||
502AE53C1AB87C0D005BD199 /* YepUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepUserDefaults.swift; path = Helpers/YepUserDefaults.swift; sourceTree = "<group>"; };
|
||||
502AE53E1AB88862005BD199 /* SkillRankCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillRankCell.swift; path = Views/Cells/SkillRank/SkillRankCell.swift; sourceTree = "<group>"; };
|
||||
502AE53F1AB88862005BD199 /* SkillRankCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SkillRankCell.xib; path = Views/Cells/SkillRank/SkillRankCell.xib; sourceTree = "<group>"; };
|
||||
502AE54C1AB93175005BD199 /* ProfileHeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileHeaderCell.swift; path = Views/Cells/ProfileHeader/ProfileHeaderCell.swift; sourceTree = "<group>"; };
|
||||
502AE54D1AB93175005BD199 /* ProfileHeaderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileHeaderCell.xib; path = Views/Cells/ProfileHeader/ProfileHeaderCell.xib; sourceTree = "<group>"; };
|
||||
502AE5511AB93215005BD199 /* ProfileFooterCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileFooterCell.swift; path = Views/Cells/ProfileFooter/ProfileFooterCell.swift; sourceTree = "<group>"; };
|
||||
502AE5521AB93215005BD199 /* ProfileFooterCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileFooterCell.xib; path = Views/Cells/ProfileFooter/ProfileFooterCell.xib; sourceTree = "<group>"; };
|
||||
502AE5561AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileSectionHeaderReusableView.swift; path = Views/ReusableViews/ProfileSectionHeader/ProfileSectionHeaderReusableView.swift; sourceTree = "<group>"; };
|
||||
502AE5571AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileSectionHeaderReusableView.xib; path = Views/ReusableViews/ProfileSectionHeader/ProfileSectionHeaderReusableView.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -238,6 +254,7 @@
|
||||
5023DE3A1AB697A700B3EE96 /* Cells */,
|
||||
502AE5221AB71C82005BD199 /* Buttons */,
|
||||
502AE52F1AB8387D005BD199 /* TextFields */,
|
||||
502AE5471AB89A73005BD199 /* ReusableViews */,
|
||||
);
|
||||
name = Views;
|
||||
sourceTree = "<group>";
|
||||
@@ -246,6 +263,9 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5023DE3B1AB697B000B3EE96 /* Conversation */,
|
||||
502AE5421AB88866005BD199 /* SkillRank */,
|
||||
502AE5501AB93178005BD199 /* ProfileHeader */,
|
||||
502AE5551AB93218005BD199 /* ProfileFooter */,
|
||||
);
|
||||
name = Cells;
|
||||
sourceTree = "<group>";
|
||||
@@ -348,6 +368,50 @@
|
||||
name = Helpers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
502AE5421AB88866005BD199 /* SkillRank */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
502AE53E1AB88862005BD199 /* SkillRankCell.swift */,
|
||||
502AE53F1AB88862005BD199 /* SkillRankCell.xib */,
|
||||
);
|
||||
name = SkillRank;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
502AE5471AB89A73005BD199 /* ReusableViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
502AE55A1AB932D9005BD199 /* ProfileSectionHeader */,
|
||||
);
|
||||
name = ReusableViews;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
502AE5501AB93178005BD199 /* ProfileHeader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
502AE54C1AB93175005BD199 /* ProfileHeaderCell.swift */,
|
||||
502AE54D1AB93175005BD199 /* ProfileHeaderCell.xib */,
|
||||
);
|
||||
name = ProfileHeader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
502AE5551AB93218005BD199 /* ProfileFooter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
502AE5511AB93215005BD199 /* ProfileFooterCell.swift */,
|
||||
502AE5521AB93215005BD199 /* ProfileFooterCell.xib */,
|
||||
);
|
||||
name = ProfileFooter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
502AE55A1AB932D9005BD199 /* ProfileSectionHeader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
502AE5561AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift */,
|
||||
502AE5571AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib */,
|
||||
);
|
||||
name = ProfileSectionHeader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -431,11 +495,15 @@
|
||||
files = (
|
||||
5023DE4E1AB6B19300B3EE96 /* scarlett.png in Resources */,
|
||||
5023DE381AB6979600B3EE96 /* ConversationCell.xib in Resources */,
|
||||
502AE5591AB932D5005BD199 /* ProfileSectionHeaderReusableView.xib in Resources */,
|
||||
502AE5411AB88862005BD199 /* SkillRankCell.xib in Resources */,
|
||||
502AE5541AB93215005BD199 /* ProfileFooterCell.xib in Resources */,
|
||||
5023DE4B1AB6B19300B3EE96 /* kevin.png in Resources */,
|
||||
5023DE4A1AB6B19300B3EE96 /* jony.png in Resources */,
|
||||
5023DE4D1AB6B19300B3EE96 /* robert.png in Resources */,
|
||||
0A8F54B61AB67D11004AD60E /* Main.storyboard in Resources */,
|
||||
5023DE4C1AB6B19300B3EE96 /* nixzhu.png in Resources */,
|
||||
502AE54F1AB93175005BD199 /* ProfileHeaderCell.xib in Resources */,
|
||||
0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */,
|
||||
0A8F54B81AB67D11004AD60E /* Images.xcassets in Resources */,
|
||||
502AE5191AB70D72005BD199 /* Intro.storyboard in Resources */,
|
||||
@@ -457,7 +525,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
502AE5311AB85067005BD199 /* RegisterPickMobileViewController.swift in Sources */,
|
||||
502AE5581AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift in Sources */,
|
||||
502AE5211AB71C7E005BD199 /* BorderButton.swift in Sources */,
|
||||
502AE54E1AB93175005BD199 /* ProfileHeaderCell.swift in Sources */,
|
||||
502AE5381AB866E3005BD199 /* LoginVerifyMobileViewController.swift in Sources */,
|
||||
5023DE331AB688F600B3EE96 /* UIColor+Yep.swift in Sources */,
|
||||
0A8F54B11AB67D11004AD60E /* AppDelegate.swift in Sources */,
|
||||
@@ -465,6 +535,7 @@
|
||||
502AE51B1AB70DDB005BD199 /* WelcomeViewController.swift in Sources */,
|
||||
5023DE591AB6DBC100B3EE96 /* UIImage+Yep.swift in Sources */,
|
||||
502AE5331AB86020005BD199 /* RegisterVerifyMobileViewController.swift in Sources */,
|
||||
502AE5401AB88862005BD199 /* SkillRankCell.swift in Sources */,
|
||||
5023DE2D1AB685ED00B3EE96 /* DiscoverViewController.swift in Sources */,
|
||||
502AE53A1AB871C1005BD199 /* YepAlert.swift in Sources */,
|
||||
502AE52E1AB83879005BD199 /* UnderLineTextField.swift in Sources */,
|
||||
@@ -478,6 +549,7 @@
|
||||
5023DE371AB6979600B3EE96 /* ConversationCell.swift in Sources */,
|
||||
502AE5351AB8649F005BD199 /* LoginByMobileViewController.swift in Sources */,
|
||||
502AE52B1AB819AF005BD199 /* YepConfig.swift in Sources */,
|
||||
502AE5531AB93215005BD199 /* ProfileFooterCell.swift in Sources */,
|
||||
5023DE521AB6C51300B3EE96 /* CGRect+Yep.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -91,9 +91,35 @@
|
||||
<view key="view" contentMode="scaleToFill" id="i2Z-NU-5Yq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" 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">
|
||||
<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"/>
|
||||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
<cells/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="AyC-pt-NR2" id="Ncz-by-6sf"/>
|
||||
<outlet property="delegate" destination="AyC-pt-NR2" id="j2k-7a-66r"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="VZO-hp-fyU" firstAttribute="top" secondItem="i2Z-NU-5Yq" secondAttribute="top" id="2n3-L6-Rzr"/>
|
||||
<constraint firstAttribute="bottom" secondItem="VZO-hp-fyU" secondAttribute="bottom" id="5Xv-rO-oXy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VZO-hp-fyU" secondAttribute="trailing" id="Ag4-p9-ng1"/>
|
||||
<constraint firstItem="VZO-hp-fyU" firstAttribute="leading" secondItem="i2Z-NU-5Yq" secondAttribute="leading" id="EIq-yc-gkc"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Profile" id="4pO-kT-amp"/>
|
||||
<connections>
|
||||
<outlet property="profileCollectionView" destination="VZO-hp-fyU" id="xat-9E-RVG"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="9Oi-o8-uy7" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
||||
@@ -8,29 +8,156 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
let skillRanckCellIdentifier = "SkillRankCell"
|
||||
let headerCellIdentifier = "ProfileHeaderCell"
|
||||
let footerCellIdentifier = "ProfileFooterCell"
|
||||
let sectionHeaderIdentifier = "ProfileSectionHeaderReusableView"
|
||||
let sectionFooterIdentifier = "ProfileSectionFooterReusableView"
|
||||
|
||||
let screenWidth = UIScreen.mainScreen().bounds.width
|
||||
let sectionLeftEdgeInset: CGFloat = 20
|
||||
let sectionRightEdgeInset = sectionLeftEdgeInset
|
||||
let sectionBottomEdgeInset: CGFloat = 20
|
||||
let cellWidth = (screenWidth - (sectionLeftEdgeInset + sectionRightEdgeInset)) / 3
|
||||
|
||||
let introductionText = "I would like to learn Design or Speech, I can teach you iOS Dev in return. 😃"
|
||||
|
||||
|
||||
class ProfileViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var profileCollectionView: UICollectionView!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
view.backgroundColor = UIColor.darkGrayColor()
|
||||
}
|
||||
profileCollectionView.registerNib(UINib(nibName: skillRanckCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillRanckCellIdentifier)
|
||||
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)
|
||||
profileCollectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: sectionFooterIdentifier)
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// MARK: - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
// Get the new view controller using segue.destinationViewController.
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDelegate {
|
||||
|
||||
enum ProfileSection: Int {
|
||||
case Header = 0
|
||||
case Master
|
||||
case Learning
|
||||
case Footer
|
||||
}
|
||||
|
||||
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
|
||||
return 4
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
switch section {
|
||||
case ProfileSection.Header.rawValue:
|
||||
return 1
|
||||
case ProfileSection.Master.rawValue:
|
||||
return 5
|
||||
case ProfileSection.Learning.rawValue:
|
||||
return 2
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return 1
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||
switch indexPath.section {
|
||||
case ProfileSection.Header.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(headerCellIdentifier, forIndexPath: indexPath) as! ProfileHeaderCell
|
||||
return cell
|
||||
case ProfileSection.Master.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
return cell
|
||||
case ProfileSection.Learning.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
return cell
|
||||
case ProfileSection.Footer.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(footerCellIdentifier, forIndexPath: indexPath) as! ProfileFooterCell
|
||||
cell.introductionLabel.text = introductionText
|
||||
return cell
|
||||
default:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillRanckCellIdentifier, forIndexPath: indexPath) as! SkillRankCell
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
|
||||
if kind == UICollectionElementKindSectionHeader {
|
||||
let header = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: sectionHeaderIdentifier, forIndexPath: indexPath) as! ProfileSectionHeaderReusableView
|
||||
|
||||
switch indexPath.section {
|
||||
case ProfileSection.Header.rawValue:
|
||||
header.titleLabel.text = ""
|
||||
case ProfileSection.Master.rawValue:
|
||||
header.titleLabel.text = NSLocalizedString("Master", comment: "")
|
||||
case ProfileSection.Learning.rawValue:
|
||||
header.titleLabel.text = NSLocalizedString("Learning", comment: "")
|
||||
case ProfileSection.Footer.rawValue:
|
||||
header.titleLabel.text = NSLocalizedString("Introduction", comment: "")
|
||||
default:
|
||||
header.titleLabel.text = ""
|
||||
}
|
||||
|
||||
return header
|
||||
} else {
|
||||
let footer = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: sectionFooterIdentifier, forIndexPath: indexPath) as! UICollectionReusableView
|
||||
return footer
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
|
||||
switch section {
|
||||
case ProfileSection.Header.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: sectionBottomEdgeInset, right: 0)
|
||||
case ProfileSection.Master.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset)
|
||||
case ProfileSection.Learning.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset)
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: sectionBottomEdgeInset, right: 0)
|
||||
default:
|
||||
return UIEdgeInsetsZero
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView!, layout collectionViewLayout: UICollectionViewLayout!, sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize {
|
||||
switch indexPath.section {
|
||||
case ProfileSection.Header.rawValue:
|
||||
return CGSizeMake(screenWidth, 250)
|
||||
case ProfileSection.Master.rawValue:
|
||||
return CGSizeMake(cellWidth, 40)
|
||||
case ProfileSection.Learning.rawValue:
|
||||
return CGSizeMake(cellWidth, 40)
|
||||
case ProfileSection.Footer.rawValue:
|
||||
|
||||
let attributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue-Thin", size: 12)!]
|
||||
let rect = introductionText.boundingRectWithSize(CGSize(width: screenWidth - 20*2, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes:attributes, context:nil)
|
||||
|
||||
return CGSizeMake(screenWidth, ceil(rect.height))
|
||||
default:
|
||||
return CGSizeMake(cellWidth, 40)
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
||||
if section == ProfileSection.Header.rawValue {
|
||||
return CGSizeMake(screenWidth, 0)
|
||||
} else {
|
||||
return CGSizeMake(screenWidth, 40)
|
||||
}
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
|
||||
return CGSizeMake(screenWidth, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// ProfileFooterCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/3/18.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ProfileFooterCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet weak var introductionLabel: UILabel!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7525" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7516"/>
|
||||
</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="ProfileFooterCell" id="gTV-IL-0wX" customClass="ProfileFooterCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" 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="320" height="50"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I would like to learn Design or Speech, I can teach you iOS Dev in return. 😃" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Yw-Z7-Wv4">
|
||||
<rect key="frame" x="20" y="11" width="280" height="29"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Thin" family="Helvetica Neue" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="5Yw-Z7-Wv4" secondAttribute="trailing" constant="20" id="1L7-Px-Qtp"/>
|
||||
<constraint firstAttribute="centerY" secondItem="5Yw-Z7-Wv4" secondAttribute="centerY" id="wjT-t7-vno"/>
|
||||
<constraint firstItem="5Yw-Z7-Wv4" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="20" id="wyd-hx-NA8"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="320" height="50"/>
|
||||
<connections>
|
||||
<outlet property="introductionLabel" destination="5Yw-Z7-Wv4" id="2To-TB-hWM"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="237" y="285"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// ProfileHeaderCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/3/18.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ProfileHeaderCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var nameLabel: UILabel!
|
||||
@IBOutlet weak var joinedDateLabel: UILabel!
|
||||
@IBOutlet weak var locationLabel: UILabel!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
avatarImageView.alpha = 0
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
|
||||
if let avatarURLString = YepUserDefaults.avatarURLString() {
|
||||
if let url = NSURL(string: avatarURLString) {
|
||||
if let data = NSData(contentsOfURL: url) {
|
||||
let image = UIImage(data: data)
|
||||
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.avatarImageView.image = image
|
||||
|
||||
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseOut, animations: { () -> Void in
|
||||
self.avatarImageView.alpha = 1
|
||||
}, completion: { (finished) -> Void in
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7525" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7516"/>
|
||||
</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="ProfileHeaderCell" id="gTV-IL-0wX" customClass="ProfileHeaderCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="254"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9iO-cK-3UB" userLabel="Avatar Image View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="254"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Joined 1 week ago" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NGG-vt-AMI" userLabel="Joined Date Label">
|
||||
<rect key="frame" x="20" y="219" width="96" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000596046448" green="0.40000000596046448" blue="0.40000000596046448" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Nix" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g9S-Zs-82d" userLabel="Name Label">
|
||||
<rect key="frame" x="20" y="180" width="32" height="30"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-CondensedBold" family="Helvetica Neue" pointSize="25"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CandyStar" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8h-bQ-ZK8" userLabel="Location Label">
|
||||
<rect key="frame" x="320" y="219" width="53" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000596046448" green="0.40000000596046448" blue="0.40000000596046448" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="9iO-cK-3UB" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="0GC-5l-kfn"/>
|
||||
<constraint firstItem="O8h-bQ-ZK8" firstAttribute="centerY" secondItem="NGG-vt-AMI" secondAttribute="centerY" id="0l4-yp-iX1"/>
|
||||
<constraint firstItem="NGG-vt-AMI" firstAttribute="top" secondItem="g9S-Zs-82d" secondAttribute="bottom" constant="9" id="8I5-zm-l9l"/>
|
||||
<constraint firstItem="NGG-vt-AMI" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="20" id="8fv-Rm-QbG"/>
|
||||
<constraint firstAttribute="bottom" secondItem="NGG-vt-AMI" secondAttribute="bottom" constant="20" id="Cu1-M1-6gp"/>
|
||||
<constraint firstItem="g9S-Zs-82d" firstAttribute="leading" secondItem="NGG-vt-AMI" secondAttribute="leading" id="GmS-dS-tav"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9iO-cK-3UB" secondAttribute="trailing" id="Ykz-Gm-skT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="9iO-cK-3UB" secondAttribute="bottom" id="ZaW-Gv-rm4"/>
|
||||
<constraint firstAttribute="trailing" secondItem="O8h-bQ-ZK8" secondAttribute="trailing" constant="20" id="m1m-M7-tKT"/>
|
||||
<constraint firstItem="9iO-cK-3UB" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="sHm-q3-PrJ"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="393" height="254"/>
|
||||
<connections>
|
||||
<outlet property="avatarImageView" destination="9iO-cK-3UB" id="EVu-SY-baK"/>
|
||||
<outlet property="joinedDateLabel" destination="NGG-vt-AMI" id="zGq-tD-400"/>
|
||||
<outlet property="locationLabel" destination="O8h-bQ-ZK8" id="KRV-fd-AVq"/>
|
||||
<outlet property="nameLabel" destination="g9S-Zs-82d" id="VgN-iJ-P4Y"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="235.5" y="296"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// SkillRankCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/3/18.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SkillRankCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet weak var skillLabel: UILabel!
|
||||
@IBOutlet weak var rankView: UIView!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7525" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7516"/>
|
||||
</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="SkillRankCell" id="gTV-IL-0wX" customClass="SkillRankCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="126" 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="126" height="50"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZT8-FU-8G4" userLabel="Skill Label">
|
||||
<rect key="frame" x="0.0" y="18" width="19" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nCG-hS-MFu" userLabel="Rank View">
|
||||
<rect key="frame" x="29" y="11" width="30" height="30"/>
|
||||
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="30" id="Vno-Jh-muh"/>
|
||||
<constraint firstAttribute="height" constant="30" id="eem-1W-RUh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstItem="ZT8-FU-8G4" firstAttribute="centerY" secondItem="nCG-hS-MFu" secondAttribute="centerY" id="LaL-Ye-WJE"/>
|
||||
<constraint firstItem="nCG-hS-MFu" firstAttribute="leading" secondItem="ZT8-FU-8G4" secondAttribute="trailing" constant="10" id="MkA-Na-XGT"/>
|
||||
<constraint firstAttribute="centerY" secondItem="ZT8-FU-8G4" secondAttribute="centerY" id="dPn-w2-WCw"/>
|
||||
<constraint firstItem="ZT8-FU-8G4" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="xdn-IR-qTo"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="126" height="50"/>
|
||||
<connections>
|
||||
<outlet property="rankView" destination="nCG-hS-MFu" id="Tv6-RP-Odg"/>
|
||||
<outlet property="skillLabel" destination="ZT8-FU-8G4" id="uG6-qm-unQ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="383" y="460"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// ProfileSectionHeaderReusableView.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/3/18.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ProfileSectionHeaderReusableView: UICollectionReusableView {
|
||||
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7525" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7516"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionReusableView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ProfileSectionHeaderReusableView" id="U6b-Vx-4bR" customClass="ProfileSectionHeaderReusableView" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Master || Learning" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jUu-2Q-uyR">
|
||||
<rect key="frame" x="20" y="14" width="126" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="jUu-2Q-uyR" secondAttribute="centerY" constant="0.5" id="1ZI-gC-gcl"/>
|
||||
<constraint firstItem="jUu-2Q-uyR" firstAttribute="leading" secondItem="U6b-Vx-4bR" secondAttribute="leading" constant="20" id="dY5-Yz-hAH"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="titleLabel" destination="jUu-2Q-uyR" id="BZ3-xM-iK1"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="311" y="424"/>
|
||||
</collectionReusableView>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user