UILable usage in xcode
Initialization
UILabel * lable = [[UILabel alloc] init]; // initialize lable. frame = CGRectMake (30, 30,200, 50); // you can specify the lable position and size. backgroundColor = [UIColor orangeColor]; // set the lable background color [self. window addSubview: lable]; // Add [lable release];
Basic operations
Lable. alpha = 0.2; // The transparency range is 0-1 lable. text = @ "Zhao yadong"; // set the name lable. textColor = [UIColor redColor]; // font color lable. textAlignment = NSTextAlignmentCenter; // alignment lable. font = [UIFont boldSystemFontOfSize: 17]; // 17 lable font. numberOfLines = 0; // sets the number of rows to 0 and automatically adjusts the number of rows.
Other operations
NSLog (@ "% @", [UIFont familyNames]); // print all existing fonts lable. font = [UIFont systemFontOfSize: 22.2]; // only set the font color lable. highlighted = YES; // sets the highlight.