Navigation Controller Views in Landscape

Posted by Mahadevan S on Stack Overflow See other posts from Stack Overflow or by Mahadevan S
Published on 2010-04-28T11:17:41Z Indexed on 2010/04/28 11:23 UTC
Read the original article Hit count: 369

Filed under:
|
|
|
|

Hi,

I have set up a navigation controller ( navController ) in Portrait mode to which I push all the viewcontrollers I have. Now when a user switches to Landscape mode, I need to display all the views as a coverflow. For this I use [navController viewControllers] to get all the view controllers in the stack.

In the Landscape view controller

NSArray * arr = [navController viewControllers]; self.view = [arr objectAtIndex:0];

[arr objectAtIndex:0]; returns the correct view ( the bottombost viewcontroller's view in the nav stack ).

My problem is these views never get displayed ie the views extracted from the navController never gets displayed. If i try to create a new view and insert all the subviews of a view, it gets displayed.

eg :

UIView * newView = [[UIView alloc] init];

for (UIView *subView in [arr objectAtIndex:0]) [newView addSubView:subView];

self.view = newView;

The above piece of code works.

But simply adding the view doesnt seem to work.. Can anyone explain the solution?

Many thanks

© Stack Overflow or respective owner

Related posts about navigation

Related posts about controller