label自适应
//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自适应的更多相关文章
- iOS Label 自适应高度
推荐第二个 测试一,只改变numberOfLines属性,label的高度不会自适应(会有text中的一部分内容称为......) NSString *str = @"jgreijgirje ...
- TableView中Label自适应高度
//Xcode6.3以后label自适应需要添加两个属性 _tableView.rowHeight = UITableViewAutomaticDimension; //给予预计行高 _tableVi ...
- label自适应文本大小
UILabel *label = [[UILabelalloc] initWithFrame:CGRectZero]; NSString *string = @"aa2fkoksdajfis ...
- Label自适应高度的用法及设置倒角
UILabel *label = [[UILabel alloc] init]; //根据内容动态计算label的高度 label.text = @"Sent when the applic ...
- Label 自适应文本(StoryBoard/xib)
To make your label automatically resize height you need to do following: Set layout constrains for l ...
- Label自适应高度
每次都逼我翻代码 这次干脆写博客里面算了 哈哈哈 CGSize maxSize = CGSizeMake(ScreenWith-30,NSIntegerMax); CGSize labelsize ...
- 27、Label 自适应文本 xib
第一步: 第二步: 第三步: 第四步:
- iOS textFiledView,label自适应高度
CGSize constraintSize; constraintSize.width = 320; constraintSize.height = MAXFLOAT; CGSize sizeFram ...
- ios label根据内容自适应高度
label自适应高度,想必大家也都很熟悉怎么去做,上代码: UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(150, 50, 15 ...
随机推荐
- Struts2-2.了解struts.xml>package>action>result的name属性
result决定跳转到哪个视图(jsp),可以预设值有多个. <?xml version="1.0" encoding="UTF-8" ?> < ...
- JavaScript中的window对象
JavaScript中的window对象:http://www.cnblogs.com/kissdodog/archive/2013/01/01/2841464.html
- button,input type=button按钮在IE和w3c,firefox浏览器区别
在项目中遇到一个问题,是关于点击button按钮会自动刷新的问题.查阅了资料,做以下的整理: button,input type=button按钮在IE和w3c,firefox浏览器区别如下:当在IE ...
- mac 上面安装mysql-python
安装过程中一直报错: EnvironmentError: mysql_config not found 最终下面的方式解决: 58down voteaccepted +200 Ok, well, fi ...
- ubuntu libtiff-dev
cc@cc:~$ dpkg -L libti libtiff5 libtiffxx5 libtimezonemap1 libtinyxml2- libtiff5-dev libtimedate-per ...
- Openjudge-计算概论(A)-比饭量
描述: 3个人比饭量,每人说了两句话: A说:B比我吃的多,C和我吃的一样多 B说:A比我吃的多,A也比C吃的多 C说:我比B吃得多,B比A吃的多. 事实上,饭量和正确断言的个数是反序的关系. 请编程 ...
- Mybatis批量更新数据
转载:http://blog.csdn.net/tolcf/article/details/39213217 第一种方式 <update id="updateBatch" p ...
- GetWindowRect和GetClientRect的异同
由于项目需要,需要学习CGridCtrl控件的使用,测试控件时发现了一个问题,我无法将控件放在对话框的制定位置. 该问题的原因很容易发现,其实就是GetWindowRec()函数和GetClientR ...
- hadoop pig入门总结
在这里贴一个pig源码的分析,做pig很长时间没做笔记,不包含任何细节,以后有机会再说吧 http://blackproof.iteye.com/blog/1769219 hadoop pig入门总结 ...
- How to set a MySQL root user password in MAC OSX
https://www.youtube.com/watch?v=sFT9tGL54sI