How to push this view controller ?
Posted
by hib
on Stack Overflow
See other posts from Stack Overflow
or by hib
Published on 2010-05-27T10:32:10Z
Indexed on
2010/05/27
12:21 UTC
Read the original article
Hit count: 370
Hello all,
I am caught in a strange requirement .See the following view hierarchy and scenario .
I have a tab bar application in which I have three tabs .
In first tab I am showing some content with a small image title and date (uitableview in navigation controller).
In the detail view of that controller there are more buttons that shows different sorts of detail like gallery button and , more details button and some , more button .
On tapping each button I will push each individual view controller in the main navigation controller .
Now on the horizontal orientation I am showing same list of content but in the cover flow ( in modal view controller ) fashion like the ipod application .
On tapping any image we will show the same buttons like gallery and more details and tapping on it will show the new controller with the following code :
UINavigationController *modalNavController = [[UINavigationController alloc] initWithRootViewController:myPhotoController];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(backButtonPressed)];
myPhotoController.navigationItem.leftBarButtonItem = backButton;
[backButton release];
if([self.modalViewController isViewLoaded]){
[self dismissModalViewControllerAnimated:YES];
}
modalNavController.navigationBar.barStyle = UIBarStyleBlackOpaque;
[self presentModalViewController:modalNavController animated:YES];
[modalNavController release];
All this is working nicely . but when I get back the device in vertical orientation . the main modal controller will be dismissed and all the containing modal controller also will be dismissed if they are open or not .
Instead of this what I want is If chooses an item in the coverflow and then if chooses gallery and if I put the device in vertical orientaion the gallery should be in the navigation hierarchy that drove me to the main list and gallery should be in horizonatal fashion .
So what I want to do is that just to push the gallery controller in the main navigation hierarchy instead of showing from a madal controller .
If someone wants reference then see the application "net a porter" I want to do like that . Just tell me how the controller hierarchy is working in that app . I need the help .
Thanks
© Stack Overflow or respective owner