Open MyAnJuN opened 7 months ago
It is expected that custom views provide an intrinsicContentSize
. Are you able to implement intrinsicContentSize
on your custom view?
Currently, my custom view is not defined as a separate class. It is just defined as a UIView. Are you suggesting that I need to create a custom class that inherits from InputTextView and override intrinsicContentSize?
You don't need to inherit from InputTextView
, you can just inherit from UIView
After applying the suggested modifications, the intrinsicContentSize of the custom view limits the height. However, the height of the view still increases as the input text grows in UI.
override var intrinsicContentSize: CGSize {
let maxTextViewSize = CGSize(width: inputTextView.bounds.width, height: .greatestFiniteMagnitude)
let height = inputTextView.sizeThatFits(maxTextViewSize).height.rounded(.down)
return CGSize(width: size.width, height: min(height, 88))
}
Sorry I'm unclear as to what the problem is and what you have changed.
However, the height of the view still increases as the input text grows in UI
Are you trying to limit how high the input text view can grow?
1. my feature request related to a problem i have a feature, that's adds a emojiButton into middleContentView. so i set a customeView which contains inputTextView and emojiButton,and call setMiddleContentView(self.customeView, animated: false). it works,but maxTextViewHeight = 88 did't works. so i read the source code, find that problem lies in the following code snipped.
2. solution Because i set customeView so middleContentView == inputTextView alwals false. so i need override this requiredInputTextViewHeight property in the following code snipped.
but it's access modifier is public, so can changing it to open?