Я пытаюсь создать пользовательскую ячейку, которая расширяется при нажатии. Я использую этот GitHub пример: https://github.com/rcdilorenzo/Cell-ExpanderНе удалось присвоить значение типа 'UITableViewCell' в 'AppName.CustomCellName'
Эта линия дает ошибку во время выполнения SIGABRT:
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
(cell as! EventTableViewCell).watchFrameChanges()
//Could not cast value of type 'UITableViewCell' (0x105aa1b80) to 'AppName.EventTableViewCell' (0x104287fe0).
}
Я также проверил ответ от этой должности, а затем три шага, но не повезло: Could not cast value of type 'UITableViewCell' to '(AppName).(CustomCellName)'
Мой заказ класс клетка выглядит следующим образом:
import UIKit
class EventTableViewCell : UITableViewCell {
...
}
cellForRowAtIndexPath:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("eventCell", forIndexPath: indexPath)
let date = self.eventArray[indexPath.row].startTime
let calendar = NSCalendar.currentCalendar()
let minutes = calendar.component(NSCalendarUnit.Minute, fromDate: date)
var minutesString: String
if (minutes == 0) {
minutesString = "00"
} else {
minutesString = String(calendar.component(NSCalendarUnit.Minute, fromDate: date))
}
let hours = calendar.component(NSCalendarUnit.Hour, fromDate: date)
cell.textLabel?.text = self.eventArray[indexPath.row].title + " - \(hours):\(minutesString)"
return cell
}
}
Просьба помочь.
показать код для метода cellForRowAtIndexPath – MobileMon
@MobileMon редактировал вопрос^ –