Help! Problems appear when rotate device to Landscape

Discussion in 'iOS Programming' started by cthesky, Jan 12, 2012.

Thread Status:
Not open for further replies.
  1. cthesky macrumors member

    Aug 21, 2011
    Hi all,

    I am developing an IPad application. In my IPad application, all the views must portrait and landscape supported. I found out a way to make the views can autorotate that is set the shouldAutorotateToInterfaceOrientation method return YES. So, now all the views in my application can be autorotate based on device orientation. But it appear many problems ... ...

    One of the problem I need to clarify is when the IPad device rotate to landscape, I saw the status bar can aligned to landscape nicely but the view is just appear as rectangle with right side cut-off. I think may be this is view autoresize problem... So I set the Autosizing property in Interface Builder under Size Inspector with UIViewAutoresizingFlexibleWidth and UIViewAutoresizingFlexibleHeight selected. But this still didn't solve my problem... and this problem happens for all views except root view, so I wondering is it possible caused by the views hierachy of my application does not organised well? And this problem does not appear when I run in IPad Simulator.

    After a few days research, I found out some solution, but this is my first time develop IPad application, I don't know what I do is corrrect or not... Hope someone can give me some ideas... I have listed the solutions as below:

    1.) When I display all the views using -(void)presentModalViewController: (UIViewController *)modalViewController animated: (BOOL)animated, all the views can autoresize properly when I rotate my IPad device to landscape. But when I display them using - (void)addSubview: (UIView *)view, the problem happens again...

    2.) Reset the frame size based on the status bar orientation in ViewDidLoad method. But is it a correct solution since I need to reset frame size for every views in my application every time they loaded?

    So, is it the correct way to solve the problem?

    I really need some advice and opinion to solve this problem ... Any comments are welcome. Thanks a lot :)
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
  3. cthesky thread starter macrumors member

    Aug 21, 2011
    Yes... Do you have any ideas on this issues? I am researching a few days... and not sure whether what I get is correct way to solve my problems... :(

    Really appreciate if you can give me some suggestions ...
Thread Status:
Not open for further replies.

Share This Page