Reputation: 2457
Cell contains multiline text so I decided to use text view.
textView.textContainerInset = UIEdgeInsets.zero
removes extra padding. Code to center it vertically:
extension UITextView {
func centerVertically() {
var topCorrect = (self.bounds.size.height - self.contentSize.height * self.zoomScale) / 2
topCorrect = topCorrect < 0.0 ? 0.0 : topCorrect;
self.contentInset.top = topCorrect
}
}
This works if I predefine cell height in tableView(_:, heightForRowAt:)
.
But if I use UITableView.automaticDimension
to resize the cell everything becomes broken.
How to solve this issue?
Upvotes: 0
Views: 148
Reputation: 214
Try this and let me know if this worked out for you
Upvotes: 1