Я пытаюсь преобразовать Swift 1.2 до 2.0, но у меня возникли проблемы, назначить tablviewCell форму dequeueReusableCellWithIdentifier:Необязательные ошибки Swift 1,2 до 2,0
var cell:UITableViewCell? = tableview!.dequeueReusableCellWithIdentifier(identifier as String) as? UITableViewCell;
if (cell == nil)
{
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: identifier as String)
cell?.backgroundColor = UIColor.clearColor()
}
Ошибка:
Downcast form UITableViewCell to UITableViewcell only unwraps optionals, did you mean to use '!'?
Я верю функ dequeueReusableCellWithIdentifier не возврат необязательно, поэтому я пробовал:
var cell:UITableViewCell = tableview.dequeueReusableCellWithIdentifier(identifier as String)
if (cell == nil){
...
И я получаю два Ошибки:
value of optional type tableview not unwrapped, did you mean to use! Binary operator can not be applied to operands of type UITableViewCEll and Niliretalconversion.
Любой вклад оценили
Спасибо, все еще немного запутались с опциями! – dancingbush