Uilabel is a control in iOS, is a subclass of UIView, but adds a text display function based on UIView. Uilabel is also a view using procedures and UIView similar
1. Create a View object
2. Configure View Properties
3. Add to Parent View
4. Release of ownership
1. Create an Object
UILabel *alabel = [[UILabel alloc] Initwithframe:cgrectmake (20, 100, 280, 40)];
2. Configuration Properties
(1.) Background color
Alabel.backgroundcolor = [Uicolor Graycolor];
(2) Display text
Alabel.text = @ " Tyyyyyyyrrrrrrrrrrrrrrrmwqqqqqqq346werrrrrrrrdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffjhgggggjhkkkkkkkk Kkkkkkkkkkk,yyyyyy ";
(3) Set the text to its way
Alabel.textalignment = Nstextalignmentcenter;
(4) Set text color
Alabel.attributedtext to set the color of 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) The new line of VIP label
Alabel.numberoflines = 0;
(8) Whether the label modifies the font size according to its width
Alabel.adjustsfontsizetofitwidth = YES;
(9) How the line is intercepted
Alabel.linebreakmode = Nslinebreakbytruncatingmiddle;
3. Add to Parent View
[Containterview Addsubview:alabel];
4. Release of ownership
[Alabel release];
UILabel controls for adding text to iOS