【发布时间】:2014-12-17 01:52:15
【问题描述】:
我有一个类文件,它是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 添加到单元格中?
【问题讨论】:
标签: ios swift uicollectionview uicollectionviewcell textlabel