UILabel (label): is a control provided in iOS that is used to display text, inheriting from UIView. Core Features: Display text
UIView: is the base class for the views provided in iOS, provides common properties of the view and public methods, and does not have specific functionality (display text, input text, etc.).
1. Create a View object
UILabel *alabel = [[UILabel alloc] Initwithframe:cgrectmake (30, 100, 300, 100)];
2. Configuring related properties
Alabel.backgroundcolor = [Uicolor Yellowcolor];
2.1 Display text
Alabel.text = @ "Ming Ming xi Huan wo, que bu gao su wo, wo xiang jingjing, jingjingshihshui,ni xian gao su wo mingming shi Shui ";
2.2 Text color
Alabel.textcolor = [Uicolor Redcolor];
2.3 How text is aligned
Alabel.textalignment = Nstextalignmentcenter;
2.4 Set label multi-line display
Alabel.numberoflines = 0; 0 is no limit to the number of rows
2.5 Set how lines are intercepted (line break mode)
Alabel.linebreakmode = nslinebreakbywordwrapping;
2.6 Shadow Color (text shadow)
Alabel.shadowcolor = [Uicolor Bluecolor];
2.7 Shadow offset (change the distance between shadow and solid word)
Alabel.shadowoffset = Cgsizemake (3, 3);
2.8 Text font (font style and size)
2.8.1 use system style to change font size
Alabel.font = [Uifont systemfontofsize:12]; 12 is the font size
2.8.2 use bold style to change font size
Alabel.font = [Uifont boldsystemfontofsize:15];
2.8.3 modifying font styles and font sizes
Alabel.font = [Uifont fontwithname:@ "Zapfino" size:13];
3. Add to Parent View
[Self.window Addsubview:alabel];
4. Release of ownership
[Alabel release];
UIButton Learning Knowledge points