我有一个类文件,它是该类的子UICollectionViewController
类。在我的cellForItemAtIndexPath
方法中,我试图设置textLabel
单元格的。但是,完成中没有textLabel
选项。这是迄今为止的方法:
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as UICollectionViewCell
// Configure the cell
cell.backgroundColor = cellColor ? UIColor.blueColor() : UIColor.orangeColor()
//cell.textLabel.text = "Text"???
switch indexPath.item {
case 0...5:
cellColor = true
case 6...13:
cellColor = false
default:
cellColor = true
}
}
我该怎么做才能添加textLabel
到单元格中?