Closed gentleboy closed 7 years ago
现在我有一个这样的布局需求,子视图距父视图顶部的间距为20,距父视图底部的间距为20,centerX与父视图相同,子视图的宽度为自身高度的一半。我写的布局代码如下:
UIView *subView = [[UIView alloc] init]; subView.backgroundColor = [UIColor redColor]; [self.view addSubview:subView]; subView.sd_layout .topSpaceToView(self.view,20) .bottomSpaceToView(self.view,20) .centerXEqualToView(self.view) .autoHeightRatio(2);
发现不起作用,子视图不显示。我看了一下SDAutolayout的源码,并未找到设置自动宽高比的方法。求大神指点~
目前只有高度为自身宽度的多少倍的api
现在我有一个这样的布局需求,子视图距父视图顶部的间距为20,距父视图底部的间距为20,centerX与父视图相同,子视图的宽度为自身高度的一半。我写的布局代码如下:
发现不起作用,子视图不显示。我看了一下SDAutolayout的源码,并未找到设置自动宽高比的方法。求大神指点~