2009-11-09

How to allow landscape orientation in an iPhone application

Override the shouldAutorotateToInterfaceOrientation method in the particular view class file, as follows

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);

}

Now the view is supported for landscape orientation.

No comments: