这个标签似乎返回 nil,即使我正确设置了重用标识符和标签。
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var identifier: String = "CollectionCell"
var cell: UICollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier(identifier, forIndexPath: indexPath) as! UICollectionViewCell
// Configure the cell
//save till later, when images are actually present
//var cellItem1 = hostManager[indexPath.row * 2]
let label:UILabel = cell.viewWithTag(1) as! UILabel
return cell
}
程序在标签设置 = viewWithTag 的地方中断。我没有为单元设置自定义类,只有原型。标签设置在情节提要上。收到错误“EXC_BAD_INSTRUCTION...”。任何帮助将不胜感激,谢谢!