force Portrait mode after being in Landscape mode and tapping back

563 views Asked by At

I have a Tabbar App with a Navigationcontroller on each Tab. The first tab shows a list of entries (RoomsViewController) which all navigate to a detail view (RoomDetailViewController). On that detail view there's a button which navigates to another ViewController (PhotoViewController). I have set everything up so that only that one last ViewController supports orientation changes, the rest doesn't. Everything works fine, but I have the problem when I'm in Landscape mode and then go back 1 ViewController (to RoomDetailViewController), it stays in Landscape mode and just looks ugly.

I would like to have it being in Portrait mode after tapping back.

On iOS 5 and below I just added this to RoomDetailViewController and it worked:

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];

Unfortunately this doesn't work on iOS 6.

Any solutions for that? Thanks in advance

1

There are 1 answers

0
karthika On BEST ANSWER
Implement this method in RoomDetailViewController,

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}