【发布时间】:2019-12-11 13:51:06
【问题描述】:
我创建了六个按钮。但它们不在屏幕的中心。如何为这些按钮创建约束?
var x = 50;
var y = 50;
var n=6
int index = 0;
while (index < n)
{
if (index % 3 == 0)
{
y += 70;
x = 30;
}
UILabel btn = new UILabel(new CGRect(x, y, 90, 70));
btn.BackgroundColor = UIColor.Red;
btn.TextAlignment = UITextAlignment.Center;
btn.Text = "botton" + index;
x += 60;
index++;
this.View.add(btn)
}
【问题讨论】:
-
@jack-hua-msft 你能帮帮我吗
-
@Cheesebaron 你能帮帮我吗?
-
你试过我的解决方案了吗?
-
@JackHua-MSFT 我需要你的帮助来解决这个问题:stackoverflow.com/questions/59621176/…