0
//This is in the UITableViewCell class method
class func videoCellWithTableView(tableview:UITableView) -> OLVideoCell{
var cell = tableview .dequeueReusableCellWithIdentifier("OLVideoCell") as! OLVideoCell
// 「!cell」 Why you will be prompted 「 Unary operator '!' cannot be applied to an operand of type 'OLVideoCell'」
if !cell {
cell = OLVideoCell(style: .Default, reuseIdentifier: "OLVideoCell")
cell.selectionStyle = .None
}
return cell
}
因爲這是斯威夫特和'cell'不是'Bool'。寫下你的條件:'cell == nil'。 – werediver
謝謝但會提示「類型'OLVideoCell'的值不能爲零,不允許比較」 –
因爲您強制將您的單元格轉換爲非可選類型。如果您期望'nil',請使用可選類型。 – werediver