简体   繁体   English

iPad旋转中的textfield动画

[英]textfield animation in iPad rotation

I'm starting to upgrading a iPhone App to Universal App, and I have a question: when the user rotates the iPad, how can I animate a couple of textfields? 我开始将iPhone App升级为Universal App,但我有一个问题:当用户旋转iPad时,如何为两个文本字段设置动画?

In portrait, they are at the middle of the view, but in landscape, I want them in the right side of the view. 在肖像中,它们位于视图的中间,而在风景中,我希望它们位于视图的右侧。

How can I do that animated? 我该如何制作动画?

Thanks, 谢谢,

Rui

When the interface is rotating, your view controller's willAnimateRotationToInterfaceOrientation:duration: method will be called. 当界面旋转时,将调用视图控制器的willAnimateRotationToInterfaceOrientation:duration:方法。 It is called from inside the animation block for the rotation, so changes to any animatable properties should automatically be animated. 它是从动画块内部进行旋转调用的,因此对任何可动画设置的属性的更改都应自动进行动画处理。 The implementation should probably look something like this: 实现可能看起来像这样:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
    if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
        // Move views to the correct positions for landscape orientation
    } else {
        // Move views to the correct positions for portrait orientation
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM