Reputation: 1249
I want to change a view's orientation as and when it is displayed.
For Example:
Whenever the user clicks a button a new view is displayed to the user. Whatever may be the orientation,I want to display this view in Landscape mode.
Any Ideas.....
Upvotes: 0
Views: 478
Reputation: 1439
Use this function in your class.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
Upvotes: 2
Reputation: 26390
Add this to your view controller
- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
}
Upvotes: 0
Reputation: 6402
Add this function the in the new view to change the Orientation to landscape mode.
- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
}
Upvotes: 2