调整的SuperView同时与自动布局动态地添加子视图 [英] Resize superview while adding subviews dynamically with autolayout

查看:153
本文介绍了调整的SuperView同时与自动布局动态地添加子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须展示iPhone屏幕与多个开关控制在酥料饼。并在/从酥料饼视图带ON / OFF开关动作分别添加和删除子视图。为了更好的说明情况见下文

I have to show a popover on iPhone screen with multiple "Switch" controls. And to add and remove subviews on/from popover view with switch on/off actions respectively. For better illustration of the situation see below

图像。

images.

当用户点击一个按钮,上面酥料饼视图第一次出现。该酥料饼必须在屏幕的中心始终停留,最初添加联系人开关将处于关闭状态。当在下面的子视图转向必须对酥料饼加入,同时保持酥料饼在屏幕的中心,并增加酥料饼的高度为每子视图。

The above popover view first appears when user taps on a button. The popover has to stay always at the center of the screen and initially add contact switch will be in off condition. When turned on the below subviews has to be added on popover while keeping the popover in center of the screen and increasing the height of popover as per subviews.

和就像在酥料饼视图上方有身高有增加了两个子视图再次增长时,添加邮箱开关将ON。最后是这样的,

And just like the above the popover view has to grow again in height with adding two more subviews when "Add mail" switch will be "ON". And finally look like this,

就是这样。我通过我的应用程序中使用的自动布局,这就是我茫然不知所措。我知道我可以删除popovers还有一新的每次但这似乎是那种新手的选项。那么,有没有简单的方法来添加子视图,并自动布局动态地扩展它的父?我见过用的UILabel许多问题和关于合作,它的内在含量的大小,但仍无法获得这种特殊情况的任何想法。任何帮助将AP preciated。快乐编码。

That's it. I am using auto-layout through out my application and this is where I am perplexed. I know I can remove the popovers and one more new each time but that seems to be kind of novice option. So is there any simple way to add subviews and expand its superview dynamically with auto-layout ? I've seen many questions with UILabel and working with respect to it's intrinsic content size but still unable to get any idea with this particular situation. Any help will be appreciated. Happy coding.

推荐答案

您可以相应地出口的观点高度约束,然后设置值的元素。

You can outlet height constraint of the view, and then set value accordingly to elements.

这篇关于调整的SuperView同时与自动布局动态地添加子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆