Created
February 13, 2015 10:03
-
-
Save peerax/ce78797b7e714cd5299b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { | |
return 2 | |
} | |
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | |
switch(section){ | |
case(0): return 3 | |
case(1): return 4 | |
default: return 0 | |
} | |
} | |
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { | |
//let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as UICollectionViewCell | |
let cell:testCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as testCollectionViewCell | |
cell.layer.cornerRadius = 10.0 | |
cell.layer.masksToBounds = false; | |
cell.layer.borderColor = UIColor.whiteColor().CGColor | |
cell.layer.borderWidth = 0.5; | |
cell.layer.shadowOpacity = 0.75; | |
cell.layer.shadowRadius = 5.0; | |
cell.layer.shadowOffset = CGSizeZero | |
cell.layer.shouldRasterize = true; | |
return cell | |
} | |
private let sectionInsets = UIEdgeInsets(top: 50.0, left: 20.0, bottom: 50.0, right: 20.0) | |
func collectionView(collectionView: UICollectionView!, | |
layout collectionViewLayout: UICollectionViewLayout!, | |
insetForSectionAtIndex section: Int) -> UIEdgeInsets { | |
return sectionInsets | |
} | |
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat { | |
return 33.0 | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment