UILabel
Essential controls in iOS development, this article lists commonly used properties and methods (note that the Xcode version is 7.2)
1. Create a Uilabel object, you can set the starting position and size when you create it, or you can
UIL. Frame = CGRectMake (100, 100, 100, 100); To set the starting position and size.
UILabel *uil=[[UILabel alloc] initwithframe: CGRectMake (+, +, + )];
2. Setting text content
UIL. text = @ "Hello,word" ;
3. Set the text color
UIL. TextColor = [uicolor orangecolor];
4. Set the alignment,
UIL. TextAlignment = Nstextalignmentleft ;
nstextalignmentleft//left Justified
nstextalignmentcenter//Center
nstextalignmentright//Right Alignment
5. Set the font size
UIL. Font =[uifont systemfontofsize:];
6. Setting the background color
UIL. BackgroundColor =[uicolor redcolor];
7. Set whether you can interact with users
UIL. userinteractionenabled = YES ;
8. Set the number of lines (if equal to 0, you can automatically wrap the content)
UIL. NumberOfLines = 2;
9. set the font size to fit the label width
UIL. Adjustsfontsizetofitwidth = YES ;
This article is from the "Red Corner Antelope" blog, please be sure to keep this source http://2254359459.blog.51cto.com/10776102/1743124
The Uilabel of ios-oc-basic control