开发者

textfield animation in iPad rotation

开发者 https://www.devze.com 2023-02-15 04:24 出处:网络
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?

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?

In portrait, they are at the middle of the view, but in landscape, I want them in the right side o开发者_JAVA百科f 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. 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
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号