I have a case where a portrait only mode view needs to be pushed into a navigation controller which has a landscape mode view as its current view.
Although I have reimplemented
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
but it is still pushing the view in landscape mode. I have also tried the following way, but even this is not working.
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES];
}
I tried looking into other related questions but did not find anything.
Any idea how I can solve this?
Thanks!