Use of UILabel, use of UILabel
// Create UILabel
UILabel * label = [[UILabelalloc] initWithFrame: CGRectMake (150, 50)];
// Set the background color
Label. backgroundColor = [UIColorgreenColor];
// Set the displayed content
Label. text = @ "hahahahahahahahaha ";
// Set the font size. The default font size is 17. Use the default font style.
// Label. font = [UIFont systemFontOfSize: 14.0f];
// Label. font = [UIFont boldSystemFontOfSize: 14.0f];
// Set the font style and size
Label. font = [UIFontfontWithName: @ "Hoefler Text" size: 16366f];
// Set the rounded corner attributes
Label. layer. cornerRadius = 5;
// Obtain the names of all fonts
// NSArray * names = [UIFont familyNames];
// Set the alignment mode. The default value is left.
Label. textAlignment = NSTextAlignmentCenter;
// Set the font color. The default value is black.
Label. textColor = [UIColorredColor];
// Set the number of lines to be displayed. The default value is one line. If multiple lines are set, the height is sufficient.
// Label. numberOfLines = 2;
// If it is set to 0, multiple rows are displayed.
Label. numberOfLines = 0;
// Set to automatically adjust the width and height. Make sure there is content before setting it.
[Label sizeToFit];