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 ...
随机推荐
- css布局理解
1.盒模型(页面的所有元素都看成一个类似于礼品盒的盒子:包括块级元素和行内元素(也叫内联元素)):http://www.cnblogs.com/cchyao/archive/2010/07/12/17 ...
- spring杂记
AOP(Aspect-Oriented Programming,面向切面编程)是一种编程思想,并不是一种具体的实现,谈到实现一般有Filter和代理模式两种常见的使用方式.Java中常见的AOP技术有 ...
- C#数组和元组
声明数组 int[] myArray; 初始化数组 myArray = new int[4]; 数组是引用类型当初始化完毕后,将在托管堆上分配内存空间,其结构图如下
- Android常用Permission
位置相关: android.permission.WRITE_GSERVICES 允许程序修改Google服务地图(Allows an application to modify the Google ...
- CDOJ 1270 Playfair(模拟)
题目链接 Playfair is a kind of substitution cipher.And the encryption role is simple.In general,there ar ...
- mysql的字符串处理函数
一.简明总结ASCII(char) 返回字符的ASCII码值BIT_LENGTH(str) 返回字符串的比特长度CONCAT(s1,s2…,sn) 将s1,s2…,sn连接成字符串CONCAT_WS( ...
- mnesia
1.模式创建 mnesia:create_schema([node()|nodes()]).集群的节点之间创建模式 2.启动和停止 application:start(mnesia). applica ...
- 让ECSHOP模板支持转smarty时间戳
找到includes/cls_template.php 在大约640行,加入: case 'time': $p = 'date("Y-m-d H:i:s",' . $p . ')' ...
- linux重新部署mysql和tomcat时乱码问题
mysql解决方法 vim /etc/my.cnf [client]default-character-set=utf8 [mysqld]default-storage-engine=INNODBch ...
- k个区间相交的段落数 Educational Codeforces Round 4 D
http://codeforces.com/contest/612/problem/D 题目大意:给你n个区间,这n个区间会有相交的部分,如果一个区间相交的部分>=k,那么就把这个区间记录下来. ...