Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 目标c中的隐藏约束_Objective C - Fatal编程技术网

Objective c 目标c中的隐藏约束

Objective c 目标c中的隐藏约束,objective-c,Objective C,我希望在我的应用程序中以可编程的方式隐藏约束。我在这个应用程序中有三个按钮,我想隐藏中间的按钮。当我运行应用程序时,它显示了第一个和第三个按钮之间的一些间隙。怎么能把那个地方藏在两个按钮之间 UIView *viewButtonsContainer; UIButton *btnFirst=[[UIButton alloc]init]; UIButton *btnSecond=[[UIButton alloc]init]; UIButton *btnThird=[[UIButton all

我希望在我的应用程序中以可编程的方式隐藏约束。我在这个应用程序中有三个按钮,我想隐藏中间的按钮。当我运行应用程序时,它显示了第一个和第三个按钮之间的一些间隙。怎么能把那个地方藏在两个按钮之间

 UIView *viewButtonsContainer;
 UIButton *btnFirst=[[UIButton alloc]init];
 UIButton *btnSecond=[[UIButton alloc]init];
 UIButton *btnThird=[[UIButton alloc]init];

[btnFirst setFrame:CGRectMake(0, 0, viewButtonsContainer.width/2, btnFirst.height)];
[btnThird setFrame:CGRectMake(btnFirst.width, 0, viewButtonsContainer.width/2, btnThird.height)];

//这是非常简单和基本的,我希望它会有帮助

你能显示一个屏幕截图吗?请提供更多关于布局/消费设置的信息。有不同的方法。方法:您可以为button1到button2和button2到button3设置具有水平间距的约束,并在button2中使用宽度约束,例如,当隐藏时,宽度约束的值为0。