2

クラスのサブクラスであるクラスファイルがあります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をセルに追加するにはどうすればよいですか?

4

3 に答える 3