如何隐藏UIView并删除“空”空间?-iOS /单声道

Chr*_*ssi 5 constraints xamarin.ios ios autolayout xamarin

我需要能够在使用约束的页面上隐藏控件,并删除Hidden=true留下的空白区域。它需要类似于网络处理可见性的方式。如果它是不可见的,则不会占用空间。

有谁知道一个干净的方法来做到这一点?

如果您需要更多详细信息,请告诉我。谢谢


例:

UIButton | UIButton | UIButton
"empty space for hidden UIButton"
UIButton 
Run Code Online (Sandbox Code Playgroud)

确实应该这样渲染:

UIButton | UIButton | UIButton
UIButton 
Run Code Online (Sandbox Code Playgroud)

编辑:我正在使用Xamarin Studio和VS2012进行开发。

小智 1

在故事板中首先连接你的约束。然后试试这个

    self.viewToHideHeight.constant = 0;
    self.lowerButtonHeightFromTop.constant = self.viewToHideHeightFromTop.constant + self.viewToHideHeight.constant;

    [UIView animateWithDuration:0.5f animations:^{
        self.viewToHide.alpha = 0.0f;
        [self.view layoutIfNeeded];
    }];
Run Code Online (Sandbox Code Playgroud)