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

我Label自适应高度和自适应宽度不起作用 #281

Open xhjss opened 6 years ago

xhjss commented 6 years ago
self.titleLabel.sd_layout
.topSpaceToView(self.iconImageView, 14)
.centerXEqualToView(self.iconImageView)
.autoWidthRatio(0)
.autoHeightRatio(0);
liujunliuhong commented 6 years ago

[self.titleLabel setSingleLineAutoResizeWithMaxWidth:100]; 这个再加上试试

bolee commented 5 years ago

[self.titleLabel setSingleLineAutoResizeWithMaxWidth:100]; 这个再加上试试

那自动设置宽度还有啥用?

pantaopt commented 4 years ago

[self.titleLabel setSingleLineAutoResizeWithMaxWidth:100]; 这个再加上试试

那自动设置宽度还有啥用?

看源码对于宽度自适应的逻辑都是基于maxWidth的if条件里面