本來已經(jīng)寫了很多,就因?yàn)榍袚Q頁(yè)面就沒有了,以后切之前得注意了 mac電腦的傷不起
成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站與策劃設(shè)計(jì),大關(guān)網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十多年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:大關(guān)等地區(qū)。大關(guān)做網(wǎng)站價(jià)格咨詢:028-86922220
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;//左中右對(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)位置來,default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負(fù)到正,y上到下是負(fù)到正
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ù)字符串的長(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.
}
本來已經(jīng)寫了很多,就因?yàn)榍袚Q頁(yè)面就沒有了,以后切之前得注意了 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;//左中右對(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)位置來,default is (0 -1)表示x = 0 ,y = -1 表示在陰影在正下方 x軸左到右是負(fù)到正,y上到下是負(fù)到正
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ù)字符串的長(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.
}