PDA

View Full Version : Push a view on top of NOT within tab bar controller




newtoiphonesdk
Sep 4, 2012, 07:53 PM
I have a few tab bar applications that also use navigation controllers within the tab bar. I would like to be able to present a view when a cell in the table view is clicked, but have it not be IN the tab bar controller. This would be similar to the Twitter app when a link is clicked from within a Tweet. This way, the view for that link can be rotated, while everything else in the tab bar won't rotate. Here is how my code is setup now:

self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
[self.navigationController pushViewController:_webViewController animated:YES];
I just want the view to cover up the tab bar, and therefore, let it rotate without needing to allow everything in tab bar to also rotate.



CodeBreaker
Sep 8, 2012, 10:20 AM
You can add it as a subview to your applications window or perhaps the tab bar itself?

Duncan C
Sep 9, 2012, 02:45 PM
I have a few tab bar applications that also use navigation controllers within the tab bar. I would like to be able to present a view when a cell in the table view is clicked, but have it not be IN the tab bar controller. This would be similar to the Twitter app when a link is clicked from within a Tweet. This way, the view for that link can be rotated, while everything else in the tab bar won't rotate. Here is how my code is setup now:

self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
[self.navigationController pushViewController:_webViewController animated:YES];
I just want the view to cover up the tab bar, and therefore, let it rotate without needing to allow everything in tab bar to also rotate.

Apple's UI guidelines specifically tell you not to do this. Tab bar applications are supposed to use the tab bar as the underlying way of presenting their UI.
If some tabs hide the tab bar it breaks the paradigm.

What you can do is to push a full-screen modal view controller using presentViewController:animated:completion: Modal view controllers temporarily break the flow of an application by displaying a modal view that must be acted on and dismissed before the user can continue. Thus it's reasonable to have a modal view controller NOT have a tab bar, then when the user dismisses it, the modal goes away and the tab bar is still there.

That would be my suggestion.