mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-13 23:07:37 +10:00
add ProfileSeparationLineCell; adjust section insets
This commit is contained in:
@@ -135,6 +135,8 @@
|
||||
508D17481ACCF4710092D666 /* ChatLeftAudioCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508D17461ACCF4710092D666 /* ChatLeftAudioCell.xib */; };
|
||||
508D174C1ACCF49B0092D666 /* ChatRightAudioCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508D174A1ACCF49B0092D666 /* ChatRightAudioCell.swift */; };
|
||||
508D174D1ACCF49B0092D666 /* ChatRightAudioCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508D174B1ACCF49B0092D666 /* ChatRightAudioCell.xib */; };
|
||||
508F8FC81B0161EF00461B0B /* ProfileSeparationLineCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FC61B0161EF00461B0B /* ProfileSeparationLineCell.swift */; };
|
||||
508F8FC91B0161EF00461B0B /* ProfileSeparationLineCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508F8FC71B0161EF00461B0B /* ProfileSeparationLineCell.xib */; };
|
||||
5099B9C41AB9510D002F940B /* RankView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C31AB9510D002F940B /* RankView.swift */; };
|
||||
5099B9C71AB99F7B002F940B /* RegisterPickAvatarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C61AB99F7B002F940B /* RegisterPickAvatarViewController.swift */; };
|
||||
5099B9C91AB9A7CB002F940B /* CameraPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5099B9C81AB9A7CB002F940B /* CameraPreviewView.swift */; };
|
||||
@@ -314,6 +316,8 @@
|
||||
508D17461ACCF4710092D666 /* ChatLeftAudioCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ChatLeftAudioCell.xib; path = Views/Cells/ChatLeftAudio/ChatLeftAudioCell.xib; sourceTree = "<group>"; };
|
||||
508D174A1ACCF49B0092D666 /* ChatRightAudioCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatRightAudioCell.swift; path = Views/Cells/ChatRightAudio/ChatRightAudioCell.swift; sourceTree = "<group>"; };
|
||||
508D174B1ACCF49B0092D666 /* ChatRightAudioCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ChatRightAudioCell.xib; path = Views/Cells/ChatRightAudio/ChatRightAudioCell.xib; sourceTree = "<group>"; };
|
||||
508F8FC61B0161EF00461B0B /* ProfileSeparationLineCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileSeparationLineCell.swift; path = Views/Cells/ProfileSeparationLine/ProfileSeparationLineCell.swift; sourceTree = "<group>"; };
|
||||
508F8FC71B0161EF00461B0B /* ProfileSeparationLineCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileSeparationLineCell.xib; path = Views/Cells/ProfileSeparationLine/ProfileSeparationLineCell.xib; sourceTree = "<group>"; };
|
||||
5099B9C31AB9510D002F940B /* RankView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RankView.swift; path = Views/Rank/RankView.swift; sourceTree = "<group>"; };
|
||||
5099B9C61AB99F7B002F940B /* RegisterPickAvatarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RegisterPickAvatarViewController.swift; path = ViewControllers/Register/RegisterPickAvatarViewController.swift; sourceTree = "<group>"; };
|
||||
5099B9C81AB9A7CB002F940B /* CameraPreviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CameraPreviewView.swift; path = Views/CameraPreview/CameraPreviewView.swift; sourceTree = "<group>"; };
|
||||
@@ -634,6 +638,7 @@
|
||||
504F415C1AD5028500FBB19A /* Skill */,
|
||||
502AE5501AB93178005BD199 /* ProfileHeader */,
|
||||
502AE5551AB93218005BD199 /* ProfileFooter */,
|
||||
508F8FCA1B0161F400461B0B /* ProfileSeparationLine */,
|
||||
0A9018801B01152D00AE4B7F /* ProfileSocialAccount */,
|
||||
50E114FE1ABC549800F13000 /* Contacts */,
|
||||
503315991AC101830008A209 /* ChatLeftText */,
|
||||
@@ -1042,6 +1047,15 @@
|
||||
name = ChatRightAudio;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
508F8FCA1B0161F400461B0B /* ProfileSeparationLine */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
508F8FC61B0161EF00461B0B /* ProfileSeparationLineCell.swift */,
|
||||
508F8FC71B0161EF00461B0B /* ProfileSeparationLineCell.xib */,
|
||||
);
|
||||
name = ProfileSeparationLine;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5099B9C51AB95111002F940B /* Rank */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1287,6 +1301,7 @@
|
||||
502AE5541AB93215005BD199 /* ProfileFooterCell.xib in Resources */,
|
||||
50CDBE4A1ACBAD3200459CE0 /* ChatLeftImageCell.xib in Resources */,
|
||||
0A90187F1B01152800AE4B7F /* ProfileSocialAccountCell.xib in Resources */,
|
||||
508F8FC91B0161EF00461B0B /* ProfileSeparationLineCell.xib in Resources */,
|
||||
50894CF61AEA4A01000981AF /* SettingsUserCell.xib in Resources */,
|
||||
508D17481ACCF4710092D666 /* ChatLeftAudioCell.xib in Resources */,
|
||||
0A8F54B61AB67D11004AD60E /* Main.storyboard in Resources */,
|
||||
@@ -1409,6 +1424,7 @@
|
||||
5023DE331AB688F600B3EE96 /* UIColor+Yep.swift in Sources */,
|
||||
503315971AC1017E0008A209 /* ChatLeftTextCell.swift in Sources */,
|
||||
0A8F54B11AB67D11004AD60E /* AppDelegate.swift in Sources */,
|
||||
508F8FC81B0161EF00461B0B /* ProfileSeparationLineCell.swift in Sources */,
|
||||
508D174C1ACCF49B0092D666 /* ChatRightAudioCell.swift in Sources */,
|
||||
502AE53D1AB87C0D005BD199 /* YepUserDefaults.swift in Sources */,
|
||||
50EB8CC41AE89F12001AC1EE /* ChatRightVideoCell.swift in Sources */,
|
||||
|
||||
@@ -96,6 +96,7 @@ class ProfileViewController: CustomNavigationBarViewController {
|
||||
let footerCellIdentifier = "ProfileFooterCell"
|
||||
let sectionHeaderIdentifier = "ProfileSectionHeaderReusableView"
|
||||
let sectionFooterIdentifier = "ProfileSectionFooterReusableView"
|
||||
let separationLineCellIdentifier = "ProfileSeparationLineCell"
|
||||
let socialAccountCellIdentifier = "ProfileSocialAccountCell"
|
||||
|
||||
lazy var collectionViewWidth: CGFloat = {
|
||||
@@ -103,7 +104,7 @@ class ProfileViewController: CustomNavigationBarViewController {
|
||||
}()
|
||||
lazy var sectionLeftEdgeInset: CGFloat = { return YepConfig.Profile.leftEdgeInset }()
|
||||
lazy var sectionRightEdgeInset: CGFloat = { return YepConfig.Profile.rightEdgeInset }()
|
||||
lazy var sectionBottomEdgeInset: CGFloat = { return 15 }()
|
||||
lazy var sectionBottomEdgeInset: CGFloat = { return 0 }()
|
||||
|
||||
let introductionText = "I would like to learn Design or Speech, I can teach you iOS Dev in return. 😃"
|
||||
|
||||
@@ -126,6 +127,7 @@ class ProfileViewController: CustomNavigationBarViewController {
|
||||
profileCollectionView.registerNib(UINib(nibName: skillCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: headerCellIdentifier, bundle: nil), forCellWithReuseIdentifier: headerCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: footerCellIdentifier, bundle: nil), forCellWithReuseIdentifier: footerCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: separationLineCellIdentifier, bundle: nil), forCellWithReuseIdentifier: separationLineCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: socialAccountCellIdentifier, bundle: nil), forCellWithReuseIdentifier: socialAccountCellIdentifier)
|
||||
profileCollectionView.registerNib(UINib(nibName: sectionHeaderIdentifier, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: sectionHeaderIdentifier)
|
||||
profileCollectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: sectionFooterIdentifier)
|
||||
@@ -315,12 +317,13 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
case Footer
|
||||
case Master
|
||||
case Learning
|
||||
case SeparationLine
|
||||
case SocialAccount
|
||||
}
|
||||
|
||||
|
||||
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
|
||||
return 5
|
||||
return 6
|
||||
}
|
||||
|
||||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
@@ -359,6 +362,9 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return 1
|
||||
|
||||
case ProfileSection.SeparationLine.rawValue:
|
||||
return 1
|
||||
|
||||
case ProfileSection.SocialAccount.rawValue:
|
||||
return 3
|
||||
@@ -436,6 +442,11 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
cell.introductionLabel.text = introductionText
|
||||
|
||||
return cell
|
||||
|
||||
case ProfileSection.SeparationLine.rawValue:
|
||||
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(separationLineCellIdentifier, forIndexPath: indexPath) as! ProfileSeparationLineCell
|
||||
|
||||
return cell
|
||||
|
||||
case ProfileSection.SocialAccount.rawValue:
|
||||
|
||||
@@ -492,16 +503,19 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: sectionBottomEdgeInset, right: 0)
|
||||
|
||||
case ProfileSection.Master.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset)
|
||||
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: 15, 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)
|
||||
return UIEdgeInsets(top: 20, left: 0, bottom: 20, right: 0)
|
||||
|
||||
case ProfileSection.SeparationLine.rawValue:
|
||||
return UIEdgeInsets(top: 40, left: 0, bottom: 30, right: 0)
|
||||
|
||||
case ProfileSection.SocialAccount.rawValue:
|
||||
return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset)
|
||||
return UIEdgeInsets(top: 0, left: 0, bottom: sectionBottomEdgeInset, right: 0)
|
||||
|
||||
default:
|
||||
return UIEdgeInsetsZero
|
||||
@@ -557,6 +571,9 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
|
||||
case ProfileSection.Footer.rawValue:
|
||||
return CGSizeMake(collectionViewWidth, footerCellHeight)
|
||||
|
||||
case ProfileSection.SeparationLine.rawValue:
|
||||
return CGSizeMake(collectionViewWidth, 1)
|
||||
|
||||
case ProfileSection.SocialAccount.rawValue:
|
||||
return CGSizeMake(collectionViewWidth, 40)
|
||||
@@ -568,11 +585,11 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
|
||||
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
||||
|
||||
if section == ProfileSection.Header.rawValue || section == ProfileSection.Footer.rawValue {
|
||||
return CGSizeMake(collectionViewWidth, 0)
|
||||
if section == ProfileSection.Master.rawValue || section == ProfileSection.Learning.rawValue {
|
||||
return CGSizeMake(collectionViewWidth, 40)
|
||||
|
||||
} else {
|
||||
return CGSizeMake(collectionViewWidth, 40)
|
||||
return CGSizeMake(collectionViewWidth, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// ProfileSeparationLineCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/5/12.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ProfileSeparationLineCell: UICollectionViewCell {
|
||||
|
||||
var leftEdgeInset: CGFloat = YepConfig.Profile.leftEdgeInset
|
||||
var rightEdgeInset: CGFloat = YepConfig.Profile.rightEdgeInset
|
||||
var lineColor: UIColor = UIColor.grayColor()
|
||||
|
||||
lazy var separationLineLayer: CAShapeLayer = {
|
||||
let layer = CAShapeLayer()
|
||||
layer.lineWidth = 1.0 / UIScreen.mainScreen().scale
|
||||
layer.strokeColor = self.lineColor.CGColor
|
||||
return layer
|
||||
}()
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
layer.addSublayer(separationLineLayer)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
let path = UIBezierPath()
|
||||
path.moveToPoint(CGPoint(x: leftEdgeInset, y: CGRectGetHeight(bounds) * 0.5))
|
||||
path.addLineToPoint(CGPoint(x: CGRectGetWidth(bounds) - rightEdgeInset, y: CGRectGetHeight(bounds) * 0.5))
|
||||
|
||||
separationLineLayer.path = path.CGPath
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
</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="ProfileSeparationLineCell" id="gTV-IL-0wX" customClass="ProfileSeparationLineCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="268" 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="268" height="50"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<size key="customSize" width="268" height="50"/>
|
||||
<point key="canvasLocation" x="332" y="324"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user