Use SizeToFit() on a UILabel with a shadow?
I am having some UILabel
elements for which a dynamically alter the text. I also add shadows to the labels using label.Layer.ShadowOffset
and dito color.
When the text of a label has been changed I use SizeToFit
. Problem: That method do开发者_开发技巧es not take into account the shadows - which leads to labels that are too small and the shadows are cut of.
Is there an easy way to fix this, or do I have to manually alter the size after the SizeToFit
call?
Why are you setting the shadow on the layer, instead of using UILabel's shadowOffset and shadowColor properties? I would expect sizeToFit to account for the shadow in that case.
精彩评论