-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
子视图联合布局 #12
Comments
您好,您的需求是A和C均分S的高度,而且A和S,A和C,以及S和C之间要有10的间隔对吧。上面的代码您写复杂了。 这个需求你可以用线性布局来实现
或者线性布局更加简单来实现
这个需求你可以用相对布局来实现(具体例子见相对布局第2个例子)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我企图给定父视图的高度,两个子视图给定间隔且等高来平分剩余高度。但是貌似第一个视图必须是独立能根据自身限定确定布局的。子视图能否这样联合布局?
不知道说清楚没有,程序员还是用代码交流吧:
S = TGRelativeLayout()
S.backgroundColor = UIColor.lightGray
S.tg_width.equal(100)
S.tg_height.equal(400)
S.tg_top.equal(64)
view.addSubview(S)
A = UIView()
C = UIView()
C.backgroundColor = UIColor.blue
A.backgroundColor = UIColor.red
A.tg_left.equal(0).and().tg_right.equal(0).and().tg_top.equal(10)
//A没有给定高度,和C等高来平分S剩余空间
C.tg_left.equal(0).and().tg_right.equal(0).and().tg_top.equal(A.tg_bottom).offset(10).and().tg_bottom.equal(10)
C.tg_height.equal(A.tg_height)//A和C等高
S.addSubview(A)
S.addSubview(C)
The text was updated successfully, but these errors were encountered: