pragma mark UILabel 標(biāo)簽
// 創(chuàng)建一個(gè)Label谍椅,標(biāo)簽,它主要的作用是用來(lái)呈現(xiàn)文字內(nèi)容
UILabel *myLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 30, 200, 100)];
myLabel.text = @"Landing landing landing landing landing landing landing landing";
// 設(shè)置label的實(shí)際行數(shù),前提是高度得夠,當(dāng)行數(shù)為零時(shí),當(dāng)前文字會(huì)根據(jù)高度自動(dòng)換行。
myLabel.numberOfLines = 2;
// 設(shè)置折行方式
myLabel.lineBreakMode = NSLineBreakByCharWrapping;
// 設(shè)置字體大小
myLabel.font = [UIFont systemFontOfSize:15];
// 得到系統(tǒng)的所有字體類(lèi)型
NSArray *font = [UIFont familyNames];
NSLog(@"%@",font);
// 設(shè)置字體樣式
myLabel.font = [UIFont fontWithName:@" Zapfino" size:15];
// 設(shè)置文字位置
myLabel.textAlignment = NSTextAlignmentCenter;
/**
* NSLineBreakByWordWrapping = 0,按照單詞換行氛悬,默認(rèn)用這個(gè)
NSLineBreakByCharWrapping,按照字符換行
NSLineBreakByClipping,基本不用
NSLineBreakByTruncatingHead,省略號(hào)在前段
NSLineBreakByTruncatingTail,省略號(hào)在末尾
NSLineBreakByTruncatingMiddle省略號(hào)在中間
*/
// 設(shè)置背景顏色
myLabel.backgroundColor = [UIColor orangeColor];
// 設(shè)置文字顏色
myLabel.textColor = [UIColor yellowColor];
// 設(shè)置字體陰影
myLabel.shadowColor = [UIColor purpleColor];
// 設(shè)置陰影大小
myLabel.shadowOffset = CGSizeMake(3, 2);
[self.window addSubview:myLabel];
//// 顯示圖片的視圖
// UIImageView *myImageView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
//// myImageView.backgroundColor = [UIColor redColor];
// [self.window addSubview:myImageView];
//
// UIImage *image = [UIImage imageNamed:@"1.png"];
// myImageView.image = image;
//
//// [self.window sendSubviewToBack:myImageView];
//
// [self.window exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1.png"]];
image.frame = [UIScreen mainScreen].bounds;
[self.window addSubview:image];