我已动态创建一些控件出现在设备的底部,对于我需要给框架基于设备height.But当设备高度得到改变,这是复杂的所有控件,我的代码是如何为动态创建的控件实现自动布局?
-(void)viewWillAppear:(BOOL)animated
{
if([[UIScreen mainScreen]bounds].size.height==568)
{
xaxis=25;
yaxis=350;
}
else
{
xaxis=25;
yaxis=260;
}
UILabel *label1=[[UILabel alloc]initWithFrame:CGRectMake(xaxis+35, yaxis+35, 250, 50)];
label1 [email protected]“This is first Label;
UILabel *label2=[[UILabel alloc]initWithFrame:CGRectMake(xaxis+100, yaxis+50, 120,50)];
[email protected]"This is second Label";
[self.view addSubview: label1];
[self.view addSubview: label2];
}
任何人都可以建议如何为这些控件实现自动布局,以及它应该在启用个人热点时进行调整。
使用约束来管理控制3.5“和4” – Spynet 2014-10-30 11:44:38
使用[parentView addConstraint:[NSLayoutConstraint constraintWithItem:... – Astoria 2014-10-30 11:54:30
可以你简要解释一下吗? – StackUser 2014-10-30 12:01:59