UILabel *label = [[Uilabelalloc] initwithframe:cgrectmake (0, 0, 75, 40)]; Declare Uilbel and specify its position and length width
Label.backgroundcolor = [Uicolorclearcolor]; Sets the label's background color, which is set to a transparent color.
Label.font = [Uifont fontwithname:@ "Helvetica-bold" size:13]; Sets the font and font size of the label.
Label.transform = Cgaffinetransformmakerotation (0.1); Set the rotation angle of a label
Label.text = @ "HelloWorld"; Set the text that the label displays
Label.textcolor = [Uicolorwhitecolor]; Set the color of text
Label.shadowcolor = [uicolorcolorwithwhite:0.1falpha:0.8f]; Sets the shadow color and transparency of the text.
Label.shadowoffset = Cgsizemake (2.0f, 2.0f); Sets the tilt angle of the shadow.
Label.textalignment = Uitextalignmentcenter; Sets the position of the text to be displayed in the label, centered here.
Line wrapping: The following line breaks enable multiple lines of display, but requires a label to be of sufficient width.
Label.linebreakmode = Uilinebreakmodewordwrap; Specify line break mode
Label.numberoflines = 2; Specify the number of rows for a label
The rotation of the lable
Label.transform = cgaffinetransformmakerotation (0.2); Set the rotation angle of a label
[Self.view Addsubview:label]; Load a label into
Label beautification and Effects:
Here use Fxlabel to achieve special effects, such as the "daily" word is used Fxlabel to achieve, but to join FXLbal.h and fxlabel.m two files, the specific code is as follows.
Fxlabel *label = [[Fxlabelalloc] initwithframe:cgrectmake (0, 0, 100, 30)];
Label.backgroundcolor = [Uicolorclearcolor];
Label.font = [uifontfontwithname:@ "Helvetica-bold" size:15];
Label.text = [Secondtitle objectatindex:i];
Label.textcolor = [Uicolorgraycolor];
Label.shadowcolor = [uicolorcolorwithwhite:1.0falpha:0.8f];
Label.shadowoffset = Cgsizemake (1.0f, 2.0f);
Label.shadowblur = 1.0f;
Label.innershadowcolor = [uicolorcolorwithwhite:0.0falpha:0.8f];
Label.innershadowoffset = Cgsizemake (1.0f, 2.0f);
Label.textalignment = Uitextalignmentleft;
[View Addsubview:label];
Its usage and Uilabel difference is not small, very good understanding, code can be called directly, the specific properties of their own modification. The effect is as follows:
You can go to http://www.cocoachina.com/downloads/code/2011/1108/3463.html to download the instance code, remember to copy the Fxlabel header files and source files to join your own project, So you can use the Fxlbel freely.