Last active
August 29, 2015 14:17
-
-
Save mertsimsek/8d6029b7f6600e11f3a9 to your computer and use it in GitHub Desktop.
Dynamic text size for iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 20)]; | |
/* | |
set your label's font to the suitable one of the below to make your text size dynamic. | |
*/ | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2]; | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; | |
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment