0

I'm adding a view to view controller in which there are certain components. My project needs to support both orientation.

I designed the view controller using story board in landscape mode. When a button is pressed in the view controller the view is shown using the scaling animation.

It works perfect when its in landscape mode. When its in landscape mode and button is pressed it works perfect and also the rotation also works perfect. But if its in landscape mode and button is pressed the view doesn't get scaled according to the portrait mode and rotation is also a big problem.

I'm using autosizing and not auto layout

Can anyone please help me? Sorry for my bad english.

Any help is appreciated.

4

1 回答 1

0

自动调整大小从未被证明是方向模式中框架更改的最佳解决方案。相反,在方向委托方法中手动更改框架:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 持续时间:(NSTimeInterval)duration;
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

检查您当前的方向,例如:

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 持续时间:(NSTimeInterval)duration {

     if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {

       // change frames here for portrait mode
    }
    else
    {
       // change frames here for landscape mode
    }

}

于 2012-10-29T05:44:31.543 回答