Ios6--uilabel

Source: Internet
Author: User

////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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.