autoLayout cell中添加UILabel 多行显示问题
来源:互联网 发布:判断矩阵的一致性检验 编辑:程序博客网 时间:2024/06/15 01:00
场景:autoLayout自动布局 ,在UITableView的cell中添加UILabel,UILabel需要多行显示。
我原先的设置的约束:
//添加子控件- (void)addComponents{ self.tagView = [[UIView alloc] init]; [self addSubview:self.tagView]; self.descLabel = [[UILabel alloc] init]; self.descLabel.numberOfLines = 0; self.descLabel.lineBreakMode = NSLineBreakByWordWrapping;//拆行 [self addSubview:self.descLabel];}
//添加约束- (void)addContraints{ [self.tagView tn_pinEdgeToSuperviewEdge:TNAEdgeLeading withInset:10.0f]; [self.tagView tn_pinEdgeToSuperviewEdge:TNAEdgeTop withInset:2.0f]; [self.tagView tn_setDimension:TNADimensionWidth toSize:50.0f]; [self.tagView tn_setDimension:TNADimensionHeight toSize:21.0f]; [self.descLabel tn_pinEdge:TNAEdgeLeading toEdge:TNAEdgeTrailing ofView:self.tagView withOffset:0.0f]; [self.descLabel tn_pinEdgeToSuperviewEdge:TNAEdgeTop withInset:2.0f];}
出现的效果:
最后解决如下,在约束中再添加一个约束,让UILabel依靠父view的右边
[self.descLabel tn_pinEdgeToSuperviewEdge:TNAEdgeTrailing withInset:0.0f];
得出的效果图:
完成!
1 0
- autoLayout cell中添加UILabel 多行显示问题
- AutoLayout下多行UILabel无法显示多行文本的问题
- UILabel在Autolayout中的多行显示/动态高度
- 自定义cell中UILabel文字换行显示
- ios cell添加多个UILabel
- iOS中UILabel 多行显示
- ios下label多行无效问题(google : uilabel multiline autolayout)
- UILabel 多行显示
- 动态向cell中添加控件,cell复用问题
- Swift autoLayout 下的UILabel 换行问题
- IOS中TableView的cell显示问题
- UITableViewCell中自定义cell上UILabel添加手势没有响应解决方案
- UIlabel设置显示多行
- 关于UILabel的多行显示 UILabel numberOfLines
- 关于UILabel的多行显示 UILabel numberOfLines
- 关于UILabel的多行显示 UILabel numberOfLines
- 关于UILabel的多行显示 UILabel numberOfLines
- 关于UILabel的多行显示 UILabel numberOfLines
- 推荐!手把手教你使用Git
- Power Designer 使用记录
- Spring之IOC学习
- AtomicInteger 中 incrementAndGet与getAndIncrement 两个方法的区别
- 上机题目(初级)- Java网络操作-Socket实现客户端和服务器端通信二(Java)
- autoLayout cell中添加UILabel 多行显示问题
- python cookie
- Java5实现阻塞队列
- 简单工厂模式
- LMS学习管理系统综述
- Android编码规范
- 计算共有多少个单词,并输出最长和最短的单词
- SQL四个排名函数的区别
- 自定义UITableViewCell上的delete按钮