Add following code in viewDidLoad
UIViewController *viewController = [[UIViewController alloc] init];
[self presentModalViewController:viewController animated:NO];
[self dismissModalViewControllerAnimated:NO];
For locking portrait orientation
- Select attribute inspector tab.
- Set orientation into portrait.
Add the function
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ( UIInterfaceOrientationIsPortrait(interfaceOrientation));
}
For locking landscape orientation
- Select attribute inspector tab.
- Set orientation into landscape.
Add the function
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ( UIInterfaceOrientationIsLandscape(interfaceOrientation) );
}