the problem is in my project. But I also tried in new xcode draft project that Master-Detail Application one.
I have created base Cell class and mapped the cell on storyboard. After delete operation deinit never called. There is no strong or weak any reference to cell.
class Cell:UITableViewCell {
deinit{
print("Deinit Called")
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! Cell
let object = objects[indexPath.row] as! NSDate
cell.textLabel!.text = object.description
return cell
}
If you return nil from a failable initializer, init?() , or if you throw an error from a throwing initializer, init() throws , then deinit will not get called. This means you must clean up any manually allocated memory or other resources before you return nil or throw .
Overview. A UITableViewCell object is a specialized type of view that manages the content of a single table row.
UITableViewCells work as a lazy var, they are initialized on the first use and are kept alive as long the UITableView that initialized them is alive, that happens on the moment the register:forIdentifier: is called. If you're using the Storyboard that's is done for you.
Why it's done? Every cell can be reutilized using dequeueReusableCellWithIdentifier, so the UITableView keep a instance alive to be utilized if needed.
If you need to clear up some data, just call prepareForReuse on the UITableViewCell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With