IOS#UI之UILabel-创新互联

本来已经写了很多,就因为切换页面就没有了,以后切之前得注意了 mac电脑的伤不起

成都创新互联公司是专业的龙井网站建设公司,龙井接单;提供成都做网站、成都网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行龙井网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

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和操作系统相关的技术博文,我的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];//设置文本的高亮颜色 default is nil

  aLabel.highlighted = NO;//打开高亮default is NO

  aLabel.userInteractionEnabled = NO;//是否交互.default is NP

  aLabel.adjustsFontSizeToFitWidth = NO;//根据宽调整字体的大小 但是numberOfLines = 1;default is NO

  aLabel.numberOfLines = 0;

  float height = [aLabel.text sizeWithFont:aLabel.font constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:NSLineBreakByWordWrapping].height;//根据字符串的长度和字号的大小和Label的宽度自动计算label的高度

  aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//设置label的基准线

  aLabel.frame = CGRectMake(20, 100, 280, height);

  [self.view addSubview:aLabel];

  [aLabel release];

  // Do any additional setup after loading the view.

}

本来已经写了很多,就因为切换页面就没有了,以后切之前得注意了 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和操作系统相关的技术博文,我的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];//设置文本的高亮颜色 default is nil

  aLabel.highlighted = NO;//打开高亮default is NO

  aLabel.userInteractionEnabled = NO;//是否交互.default is NP

  aLabel.adjustsFontSizeToFitWidth = NO;//根据宽调整字体的大小 但是numberOfLines = 1;default is NO

  aLabel.numberOfLines = 0;

  float height = [aLabel.text sizeWithFont:aLabel.font constrainedToSize:CGSizeMake(280, 100000) lineBreakMode:NSLineBreakByWordWrapping].height;//根据字符串的长度和字号的大小和Label的宽度自动计算label的高度

  aLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;//设置label的基准线

  aLabel.frame = CGRectMake(20, 100, 280, height);

  [self.view addSubview:aLabel];

  [aLabel release];

  // Do any additional setup after loading the view.

}

IOS#UI之UILabel

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

分享文章:IOS#UI之UILabel-创新互联
本文路径:https://www.cdcxhl.com/article0/ccodoo.html

成都网站建设公司_创新互联,为您提供企业建站自适应网站网站策划网站收录响应式网站品牌网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计