gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.
MIT License
5.9k stars 1.28k forks source link

你好,请教一下 为何Lable无法自适应宽度呢? #205

Open jjzjx118 opened 7 years ago

jjzjx118 commented 7 years ago

按理说设置Label的时候不需要设定宽度的。代码: _dateL.sd_layout.leftSpaceToView(self.contentView, 10).topSpaceToView(self.contentView, 10);

这样设置后文字总是显示不完全,即便在赋值完后调用sizeToFit也不行。一定要自己设定宽度才可以。请问是哪里不对吗?

ShouBinCheng commented 7 years ago
[label setSingleLineAutoResizeWithMaxWidth:SCREEN_WIDTH];