1

When I navigate from one view to another view, I want to open the view in portrait view only.ie I am navigating from a first view (landscape) to second view. I want the second view to always be open in portrait view.In my case when I launch in landscape, the view is in portrait but the device is in landscape mode. The output I expected was if I open the view in portrait and and on rotating it to landscape with no rotation.

EDIT:

If you open the app in portrait and if you given auto-rotate as NO.Then if you rotate the device to landscape,then there will be no rotation in output.I want the same effect when loading a view initially in landscape.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Warrior
  • 39,156
  • 44
  • 139
  • 214

2 Answers2

4

I'm pretty sure you cannot use setOrientation anymore, since it is deprecated and apps have been declined for using it.

This may be an option for you:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/33548-alternative-setorientation.html

It rotates the view using a transformation.

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144
0

Okay so what you want to do is edit one of the functions in the view file. You want to set;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return YES;
}

From return YES to return (interfaceOrientation == UIInterfaceOrientationPortrait);

Then your view should only be in potrait.

Pudgeball
  • 814
  • 8
  • 16
  • this delegate is called when the orientation changed while displaying the view/viewcontroller. Will not be called if you navigate from a landscape view. – palaniraja Nov 09 '10 at 13:21
  • the view is created in portrait frame that appears in landscape view. – Warrior Nov 09 '10 at 13:25
  • If you open the app in portrait and if you given auto-rotate as NO.then if you rotate the device to landscape,then there will be no rotation in output.i want the same effect when loading a view intially in landscape. – Warrior Nov 09 '10 at 13:28