I've already set the properties textContainerInset
and lineFragmentPadding
to zero as seen on this code thanks to this removing the padding and margin via this SO answer.
// this is inside a UITextView Subclass
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.textContainerInset = .zero
self.textContainer.lineFragmentPadding = 0
}
Here's how the UITextView
renders when it has text
Here it is with multiple lines
Here's how it renders without text
Is it possible to make the height 0
if the UITextView
's text is empty?
Edit:
There is no constraint being used on the
UITextView
and I'm not planning to set a height constraint as I want thisUITextView
to automatically resize depending on the text being set into itThis is a
isScrollEnabled = false
UITextView inside a UITableViewCell, which automatically resizes depending on the data fetched from the api server.
About:
Language: Swift 3.2
IDE: Xcode 9.2