force app to go back to portrait mode from landscape mode programmatically

Discussion in 'iOS Programming' started by ssacong, Aug 28, 2008.

  1. macrumors newbie

    Joined:
    Jun 9, 2008
    #1
    Hi. I have a question regarding the view orientation. As title asks, is there anyway to make app to go back to portrait mode from landscape mode by coding? Here is my situation. I am in landscape view seeing stuff, and when I touch something I would like to show new view in a portrait view, not in landscape. like in Youtube app or movie player. after you done watching the video, the view just goes back to the portrait view.

    it seem like when i load up the new view it just slides in landscape mode.
    is there anyway to fix this? Appreciate any suggestions
     
  2. macrumors regular

    Joined:
    Mar 24, 2008
    #2
    bumping this old thread, I would like to know too.

    I have a couple Table Views in portrait, then when I go into the detail view, I want to be in Landscape. And when I leave Detail, I want to be in portrait for my Table Views.

    and my Landscape detail isn't a graphic, it has like UILabels and UITextViews. I can't just make a landscape graphic and put it on.
     
  3. macrumors regular

    Joined:
    Mar 24, 2008
    #3
    I think the YouTube and MoviePlayer go in Landscape because videos MUST play in landscape mode.

    [[UIDevice currentDevice] setOrientation:(UIDeviceOrientation)]

    You can call this and it works, but XCode gives a warning. I have no idea if it will pass Apple's review or if the function will even exist in later versions of the SDK.

    [[UIApplication sharedApplication]setStatusBarOrientation(UIInterfaceOrientation)]

    I also tried this, but it only moves the status bar, it doesn't transform the view to the specified orientation.
     

Share This Page