本來(lái)已經(jīng)寫了很多,就因?yàn)榍袚Q頁(yè)面就沒(méi)有了,以后切之前得注意了 mac電腦的傷不起
成都創(chuàng)新互聯(lián)公司是專業(yè)的龍井網(wǎng)站建設(shè)公司,龍井接單;提供成都做網(wǎng)站、成都網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行龍井網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!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
開在寫了,廢話少說(shuō),
先將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;//左中右對(duì)其的模式 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軸的坐標(biāo)位置來(lái),default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負(fù)到正,y上到下是負(fù)到正
aLabel.lineBreakMode = NSLineBreakByTruncatingTail;//文本超過(guò)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ù)字符串的長(zhǎng)度和字號(hào)的大小和Label的寬度自動(dòng)計(jì)算label的高度
aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//設(shè)置label的基準(zhǔn)線
aLabel.frame = CGRectMake(20, 100, 280, height);
[self.view addSubview:aLabel];
[aLabel release];
// Do any additional setup after loading the view.
}
本來(lái)已經(jīng)寫了很多,就因?yàn)榍袚Q頁(yè)面就沒(méi)有了,以后切之前得注意了 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
開在寫了,廢話少說(shuō),
先將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;//左中右對(duì)其的模式 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軸的坐標(biāo)位置來(lái),default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負(fù)到正,y上到下是負(fù)到正
aLabel.lineBreakMode = NSLineBreakByTruncatingTail;//文本超過(guò)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ù)字符串的長(zhǎng)度和字號(hào)的大小和Label的寬度自動(dòng)計(jì)算label的高度
aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//設(shè)置label的基準(zhǔn)線
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元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
分享文章:IOS#UI之UILabel-創(chuàng)新互聯(lián)
本文路徑:http://chinadenli.net/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)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容