ios6--UILabel

來源:互聯網
上載者:User

標籤:背景顏色   1.4   run   nes   trunc   col   陰影   nbsp   imp   

////  ViewController.m//  02-UILabel的使用////  UILabel顯示一段文字。#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];        // 1.1 建立UILabel對象    UILabel *label = [[UILabel alloc] init];        // 1.2 設定frame    label.frame = CGRectMake(100, 100, 202, 175);        // 1.3 設定背景顏色    label.backgroundColor = [UIColor redColor];        // 1.4 設定文字    label.text = @"da shen 11期最牛逼!!!!da shen da shen da shen da shen da shen ";        // 1.5 置中    label.textAlignment = NSTextAlignmentCenter;        // 1.6 設定字型大小    label.font = [UIFont systemFontOfSize:20.f];    label.font = [UIFont boldSystemFontOfSize:25.f];    label.font = [UIFont italicSystemFontOfSize:20.f];        // 1.7 設定文字的顏色    label.textColor = [UIColor whiteColor];        // 1.8 設定陰影(預設是有值)    label.shadowColor = [UIColor blackColor];    label.shadowOffset = CGSizeMake(-2, 1);        // 1.9 設定行數(0:自動換行)    label.numberOfLines = 0;        // 1.10 顯示模式    label.lineBreakMode =  NSLineBreakByTruncatingMiddle;        /*     NSLineBreakByWordWrapping = 0,  // 單詞包裹,換行的時候會以一個單詞換行     NSLineBreakByCharWrapping,        // 字元包裹換行,換行的時候會以一個字元換行     NSLineBreakByClipping,        // 裁剪超出的內容     NSLineBreakByTruncatingHead,    // 一行中頭部省略(注意:numberOfLines要為1): "...wxyz"     NSLineBreakByTruncatingTail,    // 一行中尾部省略: "abcd..."     NSLineBreakByTruncatingMiddle    // 一行中中間部省略:  "ab...yz"     */            // 2.0 添加到控制器的view中    [self.view addSubview:label];}@end

 

ios6--UILabel

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.