I want to ovrride init(frame: CGRect)
in a subclassed UITableViewCell.
override init(frame: CGRect) {
super.init(frame: CGRect)
}
But this throws an error: Initializer does not ovrride a designated initializer from its super class
, I did something wrong?
For an UITableViewCell
, you should be overriding this one:
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
See documentation.
If you would like to be able to vary cells' frame, you should look into delegate methods like:
tableView(_:heightForRowAtIndexPath:)
for row heighttableView(_:indentationLevelForRowAtIndexPath:)
for row indentSee documentation for UITableViewDelegate
.
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