Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-22-2011, 11:20 AM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
Echilon is on a distinguished road
Default Modal UITabBarController

I'm trying to present a TabBarController on top of another TabBarController. My application's MainWindow.xib looks like this:

Code:
Files Owner
First Responder
My App App Delegate
Window
TabBarContoller
    +TabBar
    +Nav Controller Subclass (a custom class)
        +Navigation Bar
        +Table View Contoller Subclass (custom class)
        +Tab Bar Item
    +Second View Controller (not yet hooked up)
I'm trying to display a xib file when an item is clicked in the TableView. This xib file has a TabBarController as it's main view, but when the view displays, the tab bar and navigation bar are both invisible. The code I'm using to display it is:

Code:
MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.customNavController presentModalViewController:customDetailEditViewController animated:YES];
If I use the code below to push the view controller onto the stack, I see the correct navigation bar, but the TabBar from the root view controller is shown instead of the one from the view which has been pushed. This is called from the tableViewController (a custom class).

Code:
[delegate.customNavController pushViewController:customDetailEditViewController animated:YES];
I even tried removing the TabBarController and manually implementing my own TabBar delegates but the same effect occurs (either no NavigationBar or TabBar, or the NavigationBar/TabBar from the root ViewController).

I've uploaded the source to http://mi6.nu/tabcontroller.zip . I'd really appreciate it if someone with a bt more experience with iOS could take a look.
Echilon is offline   Reply With Quote
Old 05-24-2011, 06:38 AM   #2 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
Echilon is on a distinguished road
Default

The closest I've come so far is presenting a modal view controller inside the first tabbar, so my view looks like this:

Code:
    NavigationBar  
    [          ]
    [          ] 
    [---View---]
    [          ] 
    [          ] 
    TabBar from the pushed view 
    TabBar from the root view
To achieve this, I'm using:

Code:
 UITabBarController *tabBarController = [[UITabBarController alloc] init];
    	
    	UIViewController *directionsView = [[UIViewController alloc] init];
    	txtDirections = [[UITextView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)]; 
     	[directionsView.view addSubview:txtDirections];
    	
    	IconPickerViewController *iconPicker = [[IconPickerViewController alloc]init];
    	tabBarController.viewControllers = [NSArray arrayWithObjects:recipeDetailEditViewController,directionsView,iconPicker, nil];
    	[directionsView release];
    	[iconPicker release];
    	
    	MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
    	[delegate.rootNavController presentModalViewController:recipeDetailEditViewController animated:YES];
This just complicates everything though, since a) It's not ideal as I have two tabbars and b) all controls (all of the editing controls) need to be in the TableViewController so their values can be loaded/saved to edit items. It would be much easier if the pushed view could handle loading/saving and appear on top of the root tabs.

Surely this must be possible?
Echilon is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, modal view, subview, tab bar controller, uitabbarcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 356
7 members and 349 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, PlutoPrime, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:08 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0