【问题标题】:Issue with animation of UITextView in a UIViewUIView 中 UITextView 的动画问题
【发布时间】:2011-12-10 21:11:12
【问题描述】:

我有一个设置,其中我有我的主要UIView,在此我显示另一个UIView,它似乎可以滑动和展开,直到完全在视图中。在这个新视图中,我有一个UITextView,但是当我运行动画以使UIView 出现时,它似乎没有将动画应用于UITextView。这样做的效果是UITextView 立即出现在其最终位置,然后 UIView 的其余部分滑入到位。有没有办法让动画也适用于视图内的小部件?

这是我目前正在使用的代码。

[self.view addSubview:innerView];
[innerView setFrame:CGRectMake(29.5,127,261,0)];
[textView setFrame:CGRectMake(20,20,221,0)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:5.0];
[innerView setFrame:CGRectMake(29.5,127,261,275)];
[textView setFrame:CGRectMake(20,128,221,129)];
[UIView commitAnimations];

请问有人可以帮我吗?我已经在这个问题上玩了很长时间了,一点运气都没有。

【问题讨论】:

    标签: iphone animation uiview uitextview


    【解决方案1】:

    我在我的一个应用中遇到了类似的行为。这是由于 UITextView 上的autoresizingMask。还要确保您的顶级 UIView 没有启用 autoresizesSubviews 选项,因为它会影响您的 UITextView 在动画上的行为。

    【讨论】:

    • 感谢您的建议 - 我设法使用您建议的方法解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-19
    • 2013-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多