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

发现一个widthRatioToView使用bug #30

Open junwangInChina opened 8 years ago

junwangInChina commented 8 years ago

使用widthRatioToView与heightRatioToView函数时,传入的第二个参数必须为float类型。 这样就可以:widthRatioToView(self.view1, 0.5).heightRatioToView(self.view1, 0.5); 这样就不行:widthRatioToView(self.view1, 1/2).heightRatioToView(self.view1, 1/2); 这样也不行:widthRatioToView(self.view1, (1/2)).heightRatioToView(self.view1, (1/2));

gsdios commented 8 years ago

你看下 1/2 的值 应该 为0 ,所以显示不出来,你用 1.0/2 再试下应该就可以了