First step: Create a Uilable object
UILabel *lable = [[UILabel alloc]initwithframe:cgrectmake];
Step two: Set various properties of the object
//Set TextLable.text =@"Hello world!"; //Set Font (bold bold), font sizeLable.font = [Uifont boldsystemfontofsize: -]; //set Font position: 0 (left), 1 (center), 2 (right)Lable.textalignment =0; //set font size to fit lable widthLable.adjustsfontsizetofitwidth =YES; //set the number of rows for lableLable.numberoflines =5; //Remove Background colorLable.backgroundcolor =[Uicolor Clearcolor]; //set Whether you can interact with userslable.userinteractionenabled =YES; //set whether the text in the label changeslable.enabled =NO; //Set Highlightinglable.highlighted =YES; Lable.highlightedtextcolor=[Uicolor Redcolor]; //Set ShadowLable.shadowcolor =[Uicolor Graycolor]; Lable.shadowoffset= Cgsizemake (1,1);
Step three: Load the edited control into the view
[Self.view addsubview:lable];
====================================================================================
====================================================================================
====================================================================================
====================================================================================
====================================================================================
====================================================================================
iOS Learning--uilable User's Manual (20150120)