Skip to content

Instantly share code, notes, and snippets.

@lukedesu
Created April 27, 2016 09:23
Show Gist options
  • Save lukedesu/96fb90daef3c7b7eb8767aad0893d5fe to your computer and use it in GitHub Desktop.
Save lukedesu/96fb90daef3c7b7eb8767aad0893d5fe to your computer and use it in GitHub Desktop.
//
// messageDetailViewController.swift
// testapp
//
// Created by SenseLuo on 4/27/16.
// Copyright © 2016 Unicorn, Inc. All rights reserved.
//
import UIKit
class myCollectionViewController: UICollectionViewController {
private let detailCellId = "detailCellId"
override func viewDidLoad() {
super.viewDidLoad()
collectionView?.backgroundColor = UIColor.whiteColor()
collectionView?.registerClass(detailCell.self, forCellWithReuseIdentifier: detailCellId)
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(detailCellId, forIndexPath: indexPath) as! detailCell
return cell
}
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
}
class detailCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupViews() {
backgroundColor = UIColor.redColor()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment