add InstagramMediaCell

This commit is contained in:
nixzhu
2015-05-14 17:04:47 +08:00
parent eede229ff8
commit ca9b41ab4e
5 changed files with 156 additions and 2 deletions
+16
View File
@@ -144,6 +144,8 @@
508F8FD71B01EDB400461B0B /* DribbbleShotCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FD51B01EDB400461B0B /* DribbbleShotCell.swift */; };
508F8FD81B01EDB400461B0B /* DribbbleShotCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508F8FD61B01EDB400461B0B /* DribbbleShotCell.xib */; };
508F8FDB1B0479E700461B0B /* SocialWorkInstagramViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FDA1B0479E700461B0B /* SocialWorkInstagramViewController.swift */; };
508F8FDE1B049ACF00461B0B /* InstagramMediaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508F8FDC1B049ACF00461B0B /* InstagramMediaCell.swift */; };
508F8FDF1B049ACF00461B0B /* InstagramMediaCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508F8FDD1B049ACF00461B0B /* InstagramMediaCell.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 */; };
@@ -332,6 +334,8 @@
508F8FD51B01EDB400461B0B /* DribbbleShotCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DribbbleShotCell.swift; path = Views/Cells/DribbbleShot/DribbbleShotCell.swift; sourceTree = "<group>"; };
508F8FD61B01EDB400461B0B /* DribbbleShotCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DribbbleShotCell.xib; path = Views/Cells/DribbbleShot/DribbbleShotCell.xib; sourceTree = "<group>"; };
508F8FDA1B0479E700461B0B /* SocialWorkInstagramViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocialWorkInstagramViewController.swift; path = ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift; sourceTree = "<group>"; };
508F8FDC1B049ACF00461B0B /* InstagramMediaCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InstagramMediaCell.swift; path = Views/Cells/InstagramMedia/InstagramMediaCell.swift; sourceTree = "<group>"; };
508F8FDD1B049ACF00461B0B /* InstagramMediaCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = InstagramMediaCell.xib; path = Views/Cells/InstagramMedia/InstagramMediaCell.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>"; };
@@ -678,6 +682,7 @@
5053AD571AF83B1600B3CBFA /* ChatRightLocation */,
508F8FD21B01D04F00461B0B /* GithubRepo */,
508F8FD91B01EDBC00461B0B /* DribbbleShot */,
508F8FE01B049AD400461B0B /* InstagramMedia */,
);
name = Cells;
sourceTree = "<group>";
@@ -1101,6 +1106,15 @@
name = DribbbleShot;
sourceTree = "<group>";
};
508F8FE01B049AD400461B0B /* InstagramMedia */ = {
isa = PBXGroup;
children = (
508F8FDC1B049ACF00461B0B /* InstagramMediaCell.swift */,
508F8FDD1B049ACF00461B0B /* InstagramMediaCell.xib */,
);
name = InstagramMedia;
sourceTree = "<group>";
};
5099B9C51AB95111002F940B /* Rank */ = {
isa = PBXGroup;
children = (
@@ -1360,6 +1374,7 @@
50894D0D1AEE0177000981AF /* EditProfileColoredTitleCell.xib in Resources */,
50CDBE431ACA9B4200459CE0 /* ChatRightImageCell.xib in Resources */,
508C2AA51AD661B3002B8097 /* UserStateCell.xib in Resources */,
508F8FDF1B049ACF00461B0B /* InstagramMediaCell.xib in Resources */,
50E114FD1ABC549300F13000 /* ContactsCell.xib in Resources */,
502AE54F1AB93175005BD199 /* ProfileHeaderCell.xib in Resources */,
0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */,
@@ -1461,6 +1476,7 @@
508F8FDB1B0479E700461B0B /* SocialWorkInstagramViewController.swift in Sources */,
5099B9C91AB9A7CB002F940B /* CameraPreviewView.swift in Sources */,
502AE5581AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift in Sources */,
508F8FDE1B049ACF00461B0B /* InstagramMediaCell.swift in Sources */,
502AE5211AB71C7E005BD199 /* BorderButton.swift in Sources */,
502AE54E1AB93175005BD199 /* ProfileHeaderCell.swift in Sources */,
50553F8F1ADB8BA200F80B59 /* ChatSectionDateCell.swift in Sources */,
+27 -1
View File
@@ -1078,7 +1078,7 @@
<!--Social Work Instagram View Controller-->
<scene sceneID="3VB-zl-uHQ">
<objects>
<viewController storyboardIdentifier="SocialWorkInstagramViewController" id="L64-Fk-OjC" customClass="SocialWorkInstagramViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="SocialWorkInstagramViewController" hidesBottomBarWhenPushed="YES" id="L64-Fk-OjC" customClass="SocialWorkInstagramViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="55f-oB-O3f"/>
<viewControllerLayoutGuide type="bottom" id="4eT-IE-t1b"/>
@@ -1086,8 +1086,34 @@
<view key="view" contentMode="scaleToFill" id="P7v-N1-wiX">
<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="jiJ-Zu-mTf">
<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="0.0" minimumInteritemSpacing="0.0" id="oKY-qa-Jdp">
<size key="itemSize" width="50" height="50"/>
<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="L64-Fk-OjC" id="Ppo-eG-M82"/>
<outlet property="delegate" destination="L64-Fk-OjC" id="f7a-T2-uub"/>
</connections>
</collectionView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="jiJ-Zu-mTf" firstAttribute="top" secondItem="P7v-N1-wiX" secondAttribute="top" id="Ep7-Tb-Hdc"/>
<constraint firstAttribute="trailing" secondItem="jiJ-Zu-mTf" secondAttribute="trailing" id="UmQ-w2-FJq"/>
<constraint firstItem="jiJ-Zu-mTf" firstAttribute="leading" secondItem="P7v-N1-wiX" secondAttribute="leading" id="c7r-UL-WJV"/>
<constraint firstAttribute="bottom" secondItem="jiJ-Zu-mTf" secondAttribute="bottom" id="rhO-FO-Wj3"/>
</constraints>
</view>
<connections>
<outlet property="instagramCollectionView" destination="jiJ-Zu-mTf" id="k6j-JK-0DI"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zOv-Ou-71I" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -10,10 +10,67 @@ import UIKit
class SocialWorkInstagramViewController: UIViewController {
var socialAccount: SocialAccount?
var profileUser: ProfileUser?
@IBOutlet weak var instagramCollectionView: UICollectionView!
let instagramMediaCellIdentifier = "InstagramMediaCell"
lazy var collectionViewWidth: CGFloat = {
return CGRectGetWidth(self.instagramCollectionView.bounds)
}()
var dribbbleShots = Array<DribbbleWork.Shot>() {
didSet {
updateInstagramCollectionView()
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
instagramCollectionView.registerNib(UINib(nibName: instagramMediaCellIdentifier, bundle: nil), forCellWithReuseIdentifier: instagramMediaCellIdentifier)
}
// MARK: Actions
func updateInstagramCollectionView() {
instagramCollectionView.reloadData()
}
}
extension SocialWorkInstagramViewController: UICollectionViewDataSource, UICollectionViewDelegate {
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 30
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(instagramMediaCellIdentifier, forIndexPath: indexPath) as! InstagramMediaCell
cell.imageView.image = UIImage(named: "Cover3")!
return cell
}
func collectionView(collectionView: UICollectionView!, layout collectionViewLayout: UICollectionViewLayout!, sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize {
let width = collectionViewWidth * 0.5
let height = width
return CGSizeMake(width, height)
}
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
}
}
@@ -0,0 +1,21 @@
//
// InstagramMediaCell.swift
// Yep
//
// Created by NIX on 15/5/14.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
class InstagramMediaCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
@@ -0,0 +1,34 @@
<?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="InstagramMediaCell" id="gTV-IL-0wX" customClass="InstagramMediaCell" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="140" height="140"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="140" height="140"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="MQU-6a-QTM">
<rect key="frame" x="0.0" y="0.0" width="140" height="140"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="bottom" secondItem="MQU-6a-QTM" secondAttribute="bottom" id="DR5-ha-OcW"/>
<constraint firstItem="MQU-6a-QTM" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Kcd-lW-cVo"/>
<constraint firstItem="MQU-6a-QTM" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="q8C-RD-aiU"/>
<constraint firstAttribute="trailing" secondItem="MQU-6a-QTM" secondAttribute="trailing" id="tSw-Pz-L8c"/>
</constraints>
<size key="customSize" width="140" height="140"/>
<connections>
<outlet property="imageView" destination="MQU-6a-QTM" id="Ca9-ln-KKQ"/>
</connections>
<point key="canvasLocation" x="352" y="243"/>
</collectionViewCell>
</objects>
</document>