////VIEWCONTROLLER.M//Use of 02-uilabel////Uilabel displays a paragraph of text. #import "ViewController.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //1.1 Creating a Uilabel objectUILabel *label =[[UILabel alloc] init]; //1.2 Set FrameLabel.frame = CGRectMake ( -, -,202,175); //1.3 Setting the background colorLabel.backgroundcolor =[Uicolor Redcolor]; //1.4 Setting TextLabel.text =@"da Shen 11 best!!!! Da Shen da shen da shen da shen da shen"; //1.5 centeringLabel.textalignment =Nstextalignmentcenter; //1.6 Setting the font sizeLabel.font = [Uifont systemfontofsize: -. f]; Label.font= [Uifont boldsystemfontofsize: -. f]; Label.font= [Uifont italicsystemfontofsize: -. f]; //1.7 Setting the color of textLabel.textcolor =[Uicolor Whitecolor]; //1.8 Setting Shadows (default is a value)Label.shadowcolor =[Uicolor Blackcolor]; Label.shadowoffset= Cgsizemake (-2,1); //1.9 Set number of lines (0: Wrap line)Label.numberoflines =0; //1.10 display ModeLabel.linebreakmode =Nslinebreakbytruncatingmiddle; /*nslinebreakbywordwrapping = 0,//word wrap, newline will be wrapped in a word nslinebreakbycharwrapping,//character wrap wrap, line break will be a character NewLine nslinebreakbyclipping,//clip out of content nslinebreakbytruncatinghead,//head omitted in one line (note: NumberOfLines to 1): "... W XYZ "nslinebreakbytruncatingtail,//End of line omitted:" ABCD ... " Nslinebreakbytruncatingmiddle//The middle part of a line is omitted: "Ab ... YZ "*/ //2.0 Adding to the view of the controller[Self.view Addsubview:label];}@end
Ios6--uilabel