本來已經(jīng)寫了很多,就因為切換頁面就沒有了,以后切之前得注意了 mac電腦的傷不起
成都創(chuàng)新互聯(lián)公司是專業(yè)的龍井網(wǎng)站建設(shè)公司,龍井接單;提供成都做網(wǎng)站、成都網(wǎng)站制作,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行龍井網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!UI里面有很多控件比如UIView UIControl UILabel UIButton UIScrollView UIWindow UIWebView UITabBar UITableView UITableViewCell UIToolbar UITextField UITextView UIImageView UIPageControl UIPickerView UIProgressView UIAlertView UISearchBar UISegmentedControl UISearchBar UISlider UISwitch UICollectionView 6.0 UICollectionReusableView等
控制器有
UIPageViewController UIPopoverController UIImagePickerController UINavigationController UISplitViewController UICollectionViewController UITableViewController
開在寫了,廢話少說,
先將UILabel UIView和UIResponder后面在寫,
UILabel的
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 280, 100)];
aLabel.backgroundColor = [UIColor greenColor];
aLabel.text = @"這是我在2013年的程序,今天也是我要寫ios、mac和操作系統(tǒng)相關(guān)的技術(shù)博文,我的bolg分別是(1)http://www.cnblogs.com/leevaboo(2)http://blog.csdn.net/leevaboo,(3)http://3660064.blog.51cto.com";
aLabel.textAlignment = NSTextAlignmentCenter;//左中右對其的模式 default is left
aLabel.textColor = [UIColor blueColor];//文本顏色default is blackColor
aLabel.font = [UIFont systemFontOfSize:20];//字體的大小default is 17
aLabel.shadowColor = [UIColor redColor];//陰影default is nil
aLabel.shadowOffset = CGSizeMake(0, 1);//陰影的位置,按照xy軸的坐標位置來,default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負到正,y上到下是負到正
aLabel.lineBreakMode = NSLineBreakByTruncatingTail;//文本超過label的邊界的文本截取方式default is NSLineBreakByTruncatingTail
aLabel.highlightedTextColor = [UIColor purpleColor];//設(shè)置文本的高亮顏色 default is nil
aLabel.highlighted = NO;//打開高亮default is NO
aLabel.userInteractionEnabled = NO;//是否交互.default is NP
aLabel.adjustsFontSizeToFitWidth = NO;//根據(jù)寬調(diào)整字體的大小 但是numberOfLines = 1;default is NO
aLabel.numberOfLines = 0;
float height = [aLabel.text sizeWithFont:aLabel.font constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:NSLineBreakByWordWrapping].height;//根據(jù)字符串的長度和字號的大小和Label的寬度自動計算label的高度
aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//設(shè)置label的基準線
aLabel.frame = CGRectMake(20, 100, 280, height);
[self.view addSubview:aLabel];
[aLabel release];
// Do any additional setup after loading the view.
}
本來已經(jīng)寫了很多,就因為切換頁面就沒有了,以后切之前得注意了 mac電腦的傷不起
UI里面有很多控件比如UIView UIControl UILabel UIButton UIScrollView UIWindow UIWebView UITabBar UITableView UITableViewCell UIToolbar UITextField UITextView UIImageView UIPageControl UIPickerView UIProgressView UIAlertView UISearchBar UISegmentedControl UISearchBar UISlider UISwitch UICollectionView 6.0 UICollectionReusableView等
控制器有
UIPageViewController UIPopoverController UIImagePickerController UINavigationController UISplitViewController UICollectionViewController UITableViewController
開在寫了,廢話少說,
先將UILabel UIView和UIResponder后面在寫,
UILabel的
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 280, 100)];
aLabel.backgroundColor = [UIColor greenColor];
aLabel.text = @"這是我在2013年的程序,今天也是我要寫ios、mac和操作系統(tǒng)相關(guān)的技術(shù)博文,我的bolg分別是(1)http://www.cnblogs.com/leevaboo(2)http://blog.csdn.net/leevaboo,(3)http://3660064.blog.51cto.com";
aLabel.textAlignment = NSTextAlignmentCenter;//左中右對其的模式 default is left
aLabel.textColor = [UIColor blueColor];//文本顏色default is blackColor
aLabel.font = [UIFont systemFontOfSize:20];//字體的大小default is 17
aLabel.shadowColor = [UIColor redColor];//陰影default is nil
aLabel.shadowOffset = CGSizeMake(0, 1);//陰影的位置,按照xy軸的坐標位置來,default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負到正,y上到下是負到正
aLabel.lineBreakMode = NSLineBreakByTruncatingTail;//文本超過label的邊界的文本截取方式default is NSLineBreakByTruncatingTail
aLabel.highlightedTextColor = [UIColor purpleColor];//設(shè)置文本的高亮顏色 default is nil
aLabel.highlighted = NO;//打開高亮default is NO
aLabel.userInteractionEnabled = NO;//是否交互.default is NP
aLabel.adjustsFontSizeToFitWidth = NO;//根據(jù)寬調(diào)整字體的大小 但是numberOfLines = 1;default is NO
aLabel.numberOfLines = 0;
float height = [aLabel.text sizeWithFont:aLabel.font constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:NSLineBreakByWordWrapping].height;//根據(jù)字符串的長度和字號的大小和Label的寬度自動計算label的高度
aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//設(shè)置label的基準線
aLabel.frame = CGRectMake(20, 100, 280, height);
[self.view addSubview:aLabel];
[aLabel release];
// Do any additional setup after loading the view.
}
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
分享文章:IOS#UI之UILabel-創(chuàng)新互聯(lián)
本文路徑:http://aaarwkj.com/article0/ccodoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、自適應(yīng)網(wǎng)站、網(wǎng)站策劃、網(wǎng)站收錄、響應(yīng)式網(wǎng)站、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)