Minimum Font Size deprecated on ios version 6.0

后端 未结 9 815
逝去的感伤
逝去的感伤 2021-02-02 05:07

I just upgraded to xcode 4.5 with iOS 6.0 and it\'s highlighting a warning on all the UILabels in my XIB files saying \"minimum font size deprecated on ios version 6.0\". Does a

相关标签:
9条回答
  • 2021-02-02 05:13

    Quick fix...Here minimum font size to be 8.0

                CGFloat size = textLabel.font.pointSize;// font size of label text
                [textLabel setMinimumScaleFactor:8.0/size];
    
    0 讨论(0)
  • 2021-02-02 05:18

    You can use minimum scale factor over there or drag a lable and set autoshrik-> minimum font.

    Maybe this can help you.

    0 讨论(0)
  • 2021-02-02 05:22

    Go into finder and find the .storyboard file or your .xib and open with TextEdit. Use find to locate the string "autoshrinkMode" and replace the value "minimumFontSize" to "minimumFontScale"

    Odd that the conversion wasn't written in the update scripts...

    Also credit to @Rob in the comments above for stating the same answer. He should receive credit for this one.

    0 讨论(0)
  • 2021-02-02 05:24

    minimumFontSize property of the UILabel is deprecated from iOS 6.0 onwards.

    An Alternative to the minimumFontSize is minimumScaleFactor. If you assign minimumFontSize/defaultFontSize to minimumScaleFactor, it works in the same way as minimumFontSize.

    The Code is as follows - For Example the font size is 30.0 and if you want the minimum font size to be 12.0

    YOURLABEL.font= [UIFont fontWithName:@"FONT_NAME" size:30.0];
    [YOURLABEL setMinimumScaleFactor:12.0/[UIFont labelFontSize]];
    
    0 讨论(0)
  • 2021-02-02 05:26

    I am answering very late, but might help any other. As every one knows that setMinimumFontSize has been deprecated, so other method replacing setMinimumFontSize is setAdjustFontToFitWidth which takes BOOL e.g

    [yourLabel setAdjustsFontSizeToFitWidth:YES];
    //or
    yourLabel.adjustsFontSizeToFitWidth = YES;
    
    0 讨论(0)
  • 2021-02-02 05:29

    I had similar problem. Quick fix is to use MinimumScaleFactor property of UILabel.

    0 讨论(0)
提交回复
热议问题