Basic Control-uikit Uilable
All 1..ios applications are based on the Uikit
2.UIWindow defines an object for a program display window
3.alloc Allocating memory init initialization
Declares the Uilabel and specifies its position and width
UILabel *labelname = [UILabel
Alloc]initcgrectmake (50.0,100.0,100.0,50.0);
Sets the background of labelname to red, or to other colors
Labelname.background = [Uicolor Redcolor];
Set the text that the label displays
labelName.Text = @ "Name:";
Set the color of the display text, I set it to Gray
Labelname.textcolor = [Uicolor Graycolor];
Set the rotation angle of the labelname
Labelname.transfrom = cgaffinetransformmakerotation (0.2);
Sets the position of text displayed in LabelName, Nsuitextalignmentright to the right
Nsuitextalinmentleft Left Nsuitextalignmentcentee Center
Labelname.textalignment = Nsuitextalignmentcentee;
Set font: Normal state is systemfontofsize
Labelname.font = [Uifont boldsystemfontofsize:20];
Set the shadow color of text
Labelname.shadowcolor = [Uicolor Redcolor];
Set the color and transparency of the shadow
Labelname.shadowcolor = [Uicolor colorwithwhite:0.1 alpha:0.8];
Set the position of the shadow text
Labelname.shadowoffset = Cgsizemake (1.0f,2.0f);
Set Highlight Color
labelname.highlighted = Yes;
Set the color of the highlighted font
Labelname.highlightedtextcolor = [Uicolor Orangecolor];
Set the number of lines for Lablename, I set 2 rows
Labelname.numberoflines = 2;
Set whether you can interact with users
labelname.userinteractionenabled = Yes;
Sets whether the text in the LabelName is mutable, and the default value is Yes
labelname.enabled = NO;
Set the display format when the text is too long, I'm intercepting the middle part
Labelname.linebreakmode = uilinebreakmodemiddletruncation;
typedef enum{
Uilinebreakmodewordwrap = 0;
Uilinebreakmodecharacterwrap;
uilinebreakmodeclip;//Intercept Superfluous parts
uilinebreakmodeheadtruncation;//intercept the head.
uilinebreakmodetailtruncation;//Intercept Tail
uilinebreakmodemiddletruncation;//Intercept the middle
}uilinebreakmode;
If the Adjustsfontsizetofitwidth property is set to Yes, this property controls the behavior of the text baseline
Step-by-step learning iOS, (Uilabel controls) detailed use and special effects