When I build my project the screen just appears white in the simulator (where a collection view is black) and none of the cells that I want to appear either of course.
I am using xcode6-beta6 and this is for ios (ipad).
So I am trying to populate a collection view with labels. In my story board I have the view controller with just the collection view inside it with one cell which I placed a label inside. I know I have the identifier and tag properly set in the story board and my viewcontroller code. I know I also have my dataSource and delegate outlets properly set up. I have been following this tutorial https://www.youtube.com/watch?v=jiiN9oFH3vE however it is in xcode 5 and objective-c so I don't know if there is something that is completely different in swift/xcode6 that I am not doing.
Here is my code
import UIKit
class FirstViewController: UIViewController,UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
var testArray:[String]!
override func viewDidLoad() {
super.viewDidLoad()
testArray = ["hello","world","hola","mmg","me","la"]
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func numberOfSectionsInCollectionView(collectionView: UICollectionView!) -> Int{
return 1
}
func collectionView(collectionView: UICollectionView!, numberOfItemsInSection section: Int) -> Int{
return testArray.count
}
func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell!{
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as FirstCollectionViewCell
var label = cell.viewWithTag(1) as UILabel
label.text = testArray[indexPath.row]
return cell
}
}