动画使用自动布局IB创建视图 [英] Animating a view created in IB using Autolayout

查看:110
本文介绍了动画使用自动布局IB创建视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多标签和按钮的这是在code创建,因为在IB过于复杂的视图。这工作正常。

I have a view with a lot of labels and buttons which are created on code because in IB is too complicated. This works ok.

在IB我也创建了我想通过一个按钮,水龙头从底部出现的输入视图。如果你会非常喜欢的键盘。由于此输入观点strigth前进,它已经在IB创建,它包含滑块,标签等。我还没有增加一条,作为self.view对IB子视图。

In IB I also created an input view which I want to appear from the bottom by the tap on a button. Very much like a keyboard if you will. Because this input view is strigth forward, it has been created on IB and it contains sliders, labels, etc. I haven't added it as a subview of self.view on IB.

通过按钮的水龙头,我成立了所有的约束为输入观点:我设置宽度,我将它与垂直尺寸的self.view的底部,然后我删除此约束,我添加了实际heigth然后我用动画[self.view layoutIfNeeded]

By the tap of the button, I set up all the constrains for the input view: I set the width, I set it on the bottom of the self.view with vertical size, then I remove this constraint, I add the actual heigth and then I animate with [self.view layoutIfNeeded].

问题是,输入视图itsef正确动画,但其子视图没有这么多。他们那种出现一次。

The thing is that the input view itsef animates correctly, but its subviews not so much. They kind of appear at once.

我曾尝试加入了输入视图编程,只有一个开关。它动画相当不错。

I have tried adding a input view programmatically, with only one switch. It animates quite nicely.

我猜测,有一个与控制及其上海华之间的约束问题。但我不知道这件事,因为虽然他们不正确的动画,他们在正确的地方,witht正确的比例。我想我在这里失去了一些东西。也许这不是一个好主意,混合IB集控制和意见,并以编程方式修改呢?

I'm guessing that there is a problem with the constrains between the controls and their superView. But I'm not sure about it, because although they do not animate correctly, they are on the correct place and witht the correct proportions. I guess I'm missing something here. Maybe it's not a good idea to mix IB set controls and views and programmatically modifying them?

是否有人有任何的经验吗?

Does somebody have any experience with that?

由于提前,

推荐答案

我建议你发布到苹果的开发板在这个问题上。我见过几个职位最近出现。谁回答苹果的工程师表示,随着自动布局,你基本上给自动布局视图的中心,大小的所有权,有时,改造。

I suggest you post to Apple's dev boards on this subject. I've seen several posts there recently. The Apple Engineers who replied said that with Autolayout, you basically give autolayout ownership of your view's center, size, and sometimes, transform.

要动画使用自动版式视图,您应该使用显然块的UIView动画和意见动画约束设置。然后,系统将动画所做的更改。

To animate views that use autolayout, you should apparently use UIView block animation and animate the constraint settings on the views. The system will then animate the changes you make.

不知道有关以编程方式添加新的意见,并让他们动画到位但是。

Not sure about adding new views programmatically and having them animate into place however.

这篇关于动画使用自动布局IB创建视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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