//label自适应

self.label = [UILabel new];

self.label.font = [UIFont systemFontOfSize:14];

NSString *titleContent = @"亲,欢迎您通过以下方式与我们的营销顾问取得联系,交流您再营销推广工作中遇到的问题,营销顾问将免费为您提供咨询服务。亲,欢迎您通";

self.label.text = titleContent;

self.label.textAlignment = NSTextAlignmentRight;

self.label.textColor = [UIColor redColor];

self.label.numberOfLines = 0;//多行显示,计算高度

CGSize titleSize = [titleContent boundingRectWithSize:CGSizeMake(self.view.frame.size.width -80, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;

self.label.frame = CGRectMake(40,40, titleSize.width, titleSize.height);

[self.view addSubview:self.label];

label自适应的更多相关文章

  1. iOS Label 自适应高度

    推荐第二个 测试一,只改变numberOfLines属性,label的高度不会自适应(会有text中的一部分内容称为......) NSString *str = @"jgreijgirje ...

  2. TableView中Label自适应高度

    //Xcode6.3以后label自适应需要添加两个属性 _tableView.rowHeight = UITableViewAutomaticDimension; //给予预计行高 _tableVi ...

  3. label自适应文本大小

    UILabel *label = [[UILabelalloc] initWithFrame:CGRectZero]; NSString *string = @"aa2fkoksdajfis ...

  4. Label自适应高度的用法及设置倒角

    UILabel *label = [[UILabel alloc] init]; //根据内容动态计算label的高度 label.text = @"Sent when the applic ...

  5. Label 自适应文本(StoryBoard/xib)

    To make your label automatically resize height you need to do following: Set layout constrains for l ...

  6. Label自适应高度

    每次都逼我翻代码   这次干脆写博客里面算了 哈哈哈 CGSize maxSize = CGSizeMake(ScreenWith-30,NSIntegerMax); CGSize labelsize ...

  7. 27、Label 自适应文本 xib

    第一步: 第二步: 第三步: 第四步:

  8. iOS textFiledView,label自适应高度

    CGSize constraintSize; constraintSize.width = 320; constraintSize.height = MAXFLOAT; CGSize sizeFram ...

  9. ios label根据内容自适应高度

    label自适应高度,想必大家也都很熟悉怎么去做,上代码: UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(150, 50, 15 ...

随机推荐

  1. Android Monkey 测试策略【转】

    Monkey 测试针对不同的对象和不同的目的,需要采用不同的测试方案. 首先测试的对象.目的及类型如下: 测试的类型 应用程序的稳定性测试 应用程序的压力测试 测试对象 单一 apk apk 集合 测 ...

  2. EasyuiAPI:基础

    一.EasyLoader(简单加载) locale属性:值类型是string locales属性:值类型是object 二.Draggable(拖动) 1.通过标签创建: <div id=&qu ...

  3. 13.hibernate的native sql查询(转自xiaoluo501395377)

    hibernate的native sql查询   在我们的hibernate中,除了我们常用的HQL查询以外,还非常好的支持了原生的SQL查询,那么我们既然使用了hibernate,为什么不都采用hi ...

  4. OC之消息基本概念

    要说清楚消息这个话题,我们必须先来了解三个概念 Class, SEL, IMP,它们在 objc/objc.h 中定义: typedef struct objc_class *Class; typed ...

  5. 一把刀终极配置Win7/8版 v2.0 绿色版

    软件名称: 一把刀终极配置Win7/8版 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win8 / Win7 软件大小: 1.3MB 图片预览: 软件简介: 一把刀终极配置 For Win ...

  6. 关于springboot启动时候报错:springboot Failed to parse configuration class [Application]

    把运行的java类放在一个package下后就不再提示这个错误. 使用的ide是intellij,之前也有因为没有创建package报错的经历,可能这是intellij必须的

  7. onmousedown活用之鼠标拖动

    这个布局蛮简单的就是一个div块,通过定位,固定位置 <html> <head> <meta charset="UTF-8"> <titl ...

  8. F - 娜娜梦游仙境系列——多民族王国

    F - 娜娜梦游仙境系列——多民族王国 Time Limit: 2000/1000MS (Java/Others)    Memory Limit: 128000/64000KB (Java/Othe ...

  9. 杭电21题 Palindrome

    Problem Description A palindrome is a symmetrical string, that is, a string read identically from le ...

  10. Linux内核协议栈 NAT性能优化之FAST NAT

    各位看官非常对不起,本文是用因为写的,如果多有不便敬请见谅 代码是在商业公司编写的,在商业产品中也不能开源,再次抱歉   This presentation will highlight our ef ...