Controls for adding text to UILabel iOS
UILabel is a control in iOS and a subclass of UIView. It only adds the text display function on the basis of UIView. UILabel is similar to that of UIView.
// 1. Create a view object
// 2. Configure view attributes
// 3. Add to parent View
// 4. Release ownership
// 1. Create an object
UILabel * aLabel = [[UILabel alloc] initWithFrame: CGRectMake (20,100,280, 40)];
// 2. Configure attributes
// (1) background color
ALabel. backgroundColor = [UIColor grayColor];
// (2) display text
ALabel. text = @ "plaintext, yyyyyy ";
// (3) set the method of Text
ALabel. textAlignment = NSTextAlignmentCenter;
// (4) set the text color
// ALabel. attributedText sets the color for each letter
ALabel. textColor = [UIColor redColor];
// (5) font style and size
// ALabel. font = [UIFont systemFontOfSize: 26];
// ALabel. font = [UIFont boldSystemFontOfSize: 26];
// ALabel. font = [UIFont fontWithName: @ "Didot-Italic" size: 26];
// (6) shadow color
// ALabel. shadowColor = [UIColor blueColor];
// ALabel. shadowOffset = CGSizeMake (1, 1 );
// (7) wrap the VIP label
ALabel. numberOfLines = 0;
// (8) whether the Label modifies the font size based on its own width
// ALabel. adjustsFontSizeToFitWidth = YES;
// (9) line truncation method
ALabel. lineBreakMode = NSLineBreakByTruncatingMiddle;
// 3. Add to parent View
[ContainterView addSubview: aLabel];
// 4. Release ownership
[ALabel release];