Dynamic height of my OHAttributedLabel
I am using the Custom UILabel class OHAttributedLabel
to display my text as JUSTFIED . After my OHAttributedLabel
i want to display a UIButtton
. How to get the Dynamic height of my OHAttributedLabel
. I tried many ways that found in stackoverflow itself. Unfortunately none 开发者_StackOverflow中文版of the methods are giving me the correct Height . Help me to fox this issue ......
Hi I am the author of OHAttributedLabel. Thanks for using it.
Did you try to use sizeToFit an sizeThatFits: methods? sizeThatFits: is a UIView method (that I override in OHAttributedLabel) that gives you the ideal size of the view/label depending on it's content.
You can also use my NSAttributedString+Attributes addition to compute the size of you NSAttributedString in pixels (I recently added a method in the header for that, and actually sizeThatFits call it)
HTH
精彩评论