ios - Single line UILabel hugging not working with autoshrink -


i've uilabel following properties:

  • a big font
  • fixed left margin superview
  • fixed right margin superview
  • centered vertically
  • autoshrinks minimum font size avoid truncating text as possible.
  • single line
  • vertical hugging priority set required (1000)

the problem i'm having label doesn't vertically hug text, can see in image bellow there's lot of space on top , bellow text.

i uploaded sample project here.

thanks!

enter image description here enter image description here enter image description here

try following code :

[self.mylabel setautoresizingmask:uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblebottommargin | uiviewautoresizingflexiblewidth];  

Comments