views:

140

answers:

0

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];


UIView * obtainedView = [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