Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

UISplitView and TabBar question.

jelkimantisjelkimantis Posts: 14Registered Users
edited October 2010 in iPhone SDK Development
Since it seems the iPad SplitViewController works differently than anything else, I have not found any answer to this question. While I have gotten zero responses here for any post I've made (not even a "check here" or "man that's a bummer"), I'll try one last time to get some guidance.

I have a split view that I want to have a tabBar embedded in the DetailView. I feel confident that once I get this accomplished, I understand how the SplitViewController passes information to the detail view, but I just want it to have a tabBarController. Seems like this *should* be possible.

So summary:

UISplitViewController with a UITabBarController in the detailed view. Possible or not?
Post edited by jelkimantis on

Replies

  • BrianSlickBrianSlick Treadmill Desk Ninja Northern Virginia / DCPosts: 10,067Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited June 2010
    Try it and find out. It should take all of two minutes to build a test app to figure out whether or not it will work.

    When paired with a navigation controller, Apple wants the tab bar controller to be the 'root'. I would assume the same when used with a split controller, but don't know for certain.

    Worst case, you can add your own tab bar, and then you will have to supplement that with your own view management.
  • jelkimantisjelkimantis Posts: 14Registered Users
    edited June 2010
    BrianSlick wrote: »
    Try it and find out. It should take all of two minutes to build a test app to figure out whether or not it will work.

    When paired with a navigation controller, Apple wants the tab bar controller to be the 'root'. I would assume the same when used with a split controller, but don't know for certain.

    Worst case, you can add your own tab bar, and then you will have to supplement that with your own view management.

    Yeah, I did try it. I built it both ways, once in View Builder, referencing a tabBarController, and once programmatically... I think you are right, they both want to be root.

    I know there is a work-around for putting a UISplitView inside a tab-bar, but I'm not sure if there is a work around for doing it the other way round.
  • middiumiddiu Posts: 3New Users
    edited June 2010
    I know there is a work-around for putting a UISplitView inside a tab-bar, but I'm not sure if there is a work around for doing it the other way round.

    Hi jelki,
    I need to put a UISplitView inside a tab-bar...... can you tell me what is this work-around? can you send me a link to an example of it?

    Thanks!!!
    bye bye
  • dogsplayingpokerdogsplayingpoker Posts: 3New Users
    edited June 2010
    middiu wrote: »
    Hi jelki,
    I need to put a UISplitView inside a tab-bar...... can you tell me what is this work-around? can you send me a link to an example of it?

    Thanks!!!
    bye bye

    middiu,

    Did you ever find a way to successfully do this? I'm trying to figure it out and I'm being stumped at every turn. One would think that this would be a no-brainer.

    -Adam
  • mikezangmikezang Posts: 42Registered Users
    edited August 2010
    Hi, I had made a tabbar controller and one of tab is a splitview, you have to made splitview in programming, as IB doesn't support it.
    SnapShot 2010-08-12 at 17.46.41.jpg
    1 x 1 - 13K
    SnapShot 2010-08-12 at 20.15.45.jpg
    1 x 1 - 12K
    <font size="2"><font face="Comic Sans MS"><font color="Blue">iPad Wi-Fi 32GB, </font><font color="Sienna">Mac mini 2.53GHz 4GB 320GB,</font> 32" Sharp AQUOS TV, ThinkPad T43<br />
    <br />
    MyApp: <a href="http://itunes.apple.com/us/app/market-event/i
  • ArrosArros Posts: 12Registered Users
    edited September 2010
    mikezang wrote: »
    Hi, I had made a tabbar controller and one of tab is a splitview, you have to made splitview in programming, as IB doesn't support it.

    How did you manage that? I'm stuck on this for days now :(
  • mikezangmikezang Posts: 42Registered Users
    edited September 2010
    Arros wrote: »
    How did you manage that? I'm stuck on this for days now :(
    try this code
    -(void) makeSplitViewController {
    	NSMutableArray *controllers = [NSMutableArray arrayWithArray:tabBarController.viewControllers];
    	int index = 0;
    	
    	for (UIViewController *controller in tabBarController.viewControllers) {
    		if ([controller.tabBarItem.title isEqualToString:@"Stock"]) {
    			stockDetailController = [[StockDetailController alloc] initWithNibName:@"StockDetailController" bundle:nil];
    			
    			stockMasterController = [[StockMasterController alloc] initWithStyle:UITableViewStylePlain]; 
    			stockMasterController.navigationItem.title = date;
    			stockMasterController.stockDetailController = stockDetailController;
    			
    			UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:stockMasterController] autorelease];
    			
    			splitViewController = [[UISplitViewController alloc] init];
    			splitViewController.tabBarItem = controller.tabBarItem;
    			splitViewController.viewControllers = [NSArray arrayWithObjects:nav, stockDetailController, nil];
    			splitViewController.delegate = stockDetailController;
    			
    			[controllers replaceObjectAtIndex:index withObject:splitViewController];
    		}
    		
    		index++;
    	}
    	
    	tabBarController.viewControllers = controllers;
    }
    
    <font size="2"><font face="Comic Sans MS"><font color="Blue">iPad Wi-Fi 32GB, </font><font color="Sienna">Mac mini 2.53GHz 4GB 320GB,</font> 32" Sharp AQUOS TV, ThinkPad T43<br />
    <br />
    MyApp: <a href="http://itunes.apple.com/us/app/market-event/i
  • ArrosArros Posts: 12Registered Users
    edited September 2010
    thanks.. I take you put this in your App Delegate and call it before showing the views (so in the applicationdidlaunch method?). How did you define your controllers in the app delegate?

    I did
    IBOutlet UITabBarController *rootController;
        CharacterViewSplitController *characterSplitViewController;
        CharacterViewTableController *tableController;
        CharacterViewDetailController *detailController;
    

    where the splitviewcontroller is a UISsplitViewController subclass, the tablecontroller a UITableViewController subclass and the detailController a UIViewController.

    I tried to change your implementation into mine, but some things dont work..
  • mikezangmikezang Posts: 42Registered Users
    edited September 2010
    Arros wrote: »
    thanks.. I take you put this in your App Delegate and call it before showing the views (so in the applicationdidlaunch method?). How did you define your controllers in the app delegate?

    I did
    IBOutlet UITabBarController *rootController;
        CharacterViewSplitController *characterSplitViewController;
        CharacterViewTableController *tableController;
        CharacterViewDetailController *detailController;
    

    where the splitviewcontroller is a UISsplitViewController subclass, the tablecontroller a UITableViewController subclass and the detailController a UIViewController.

    I tried to change your implementation into mine, but some things dont work..
    Here is my code
    @interface StockManagerAppDelegate : NSObject <UIApplicationDelegate> {
        UIWindow *window;
        UITabBarController *tabBarController;
    	UISplitViewController *splitViewController;
    	UINavigationController *navigationController;
    	StockMasterController *stockMasterController;
    	StockDetailController *stockDetailController;
    }
    
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
    @property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
    @property (nonatomic, retain) IBOutlet StockMasterController *stockMasterController;
    @property (nonatomic, retain) IBOutlet StockDetailController *stockDetailController;
    
    @end
    

    and StockMasterController and StockDetailController are used from template SplitViewController.
    #import <UIKit/UIKit.h>
    
    @class StockDetailController;
    
    @interface StockMasterController : UITableViewController {
        StockDetailController *stockDetailController;
    }
    
    @property (nonatomic, retain) IBOutlet StockDetailController *stockDetailController;
    
    @end
    
    @interface StockDetailController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate, UITableViewDelegate, UITableViewDataSource> {
        UIPopoverController *popoverController;
        UIToolbar *toolbar;
        
    }
    
    @property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
    @property (nonatomic, retain) UIPopoverController *popoverController;
    
    -(void) configureView;
    
    @end
    
    <font size="2"><font face="Comic Sans MS"><font color="Blue">iPad Wi-Fi 32GB, </font><font color="Sienna">Mac mini 2.53GHz 4GB 320GB,</font> 32" Sharp AQUOS TV, ThinkPad T43<br />
    <br />
    MyApp: <a href="http://itunes.apple.com/us/app/market-event/i
  • ArrosArros Posts: 12Registered Users
    edited September 2010
    Hey, thanks again. The bug wasnt in your code or mine, but in the interface builder. As described here here I had to change the NIB's class to a ViewController and link the view to the correct view! It seems to be working now, and its even rotating nicely.. Now the next step, adding the popover menu :)
  • ArrosArros Posts: 12Registered Users
    edited September 2010
    Thanks, I got it working. The only thing I seem to have missed is linking the view outlet to the view in interface builder. It even orientates correctly!
  • wamballiwamballi Posts: 1New Users
    edited October 2010
    It seems to me that the iPad programming guide answers this quite well:

    "The split view controller’s view should always be installed as the root view of your application window. You should never present a split view inside of a navigation or tab bar interface."

    How did your app submission go?
  • ArrosArros Posts: 12Registered Users
    edited October 2010
    Even big apps like Amazon.com and IMDB use splitviews in tab bars. I guess that won't be a problem. Plus I'm going to develop in-house applications anyways so I won't have to submit the app to Apple anyways :) The most important thing is that it works!
  • KinaraKinara Posts: 2New Users
    edited October 2010
    Arros wrote: »
    Even big apps like Amazon.com and IMDB use splitviews in tab bars. I guess that won't be a problem. Plus I'm going to develop in-house applications anyways so I won't have to submit the app to Apple anyways :) The most important thing is that it works!

    Would you be able to post a sample project of the SplitView working in the TabBar Controller? I would really appreciate it.

    Thanx

    Kinara :)
  • mikezangmikezang Posts: 42Registered Users
    edited October 2010
    Kinara wrote: »
    Would you be able to post a sample project of the SplitView working in the TabBar Controller? I would really appreciate it.
    Thanx
    Kinara :)
    Check here
    http://www.iphonedevsdk.com/forum/iphone-sdk-development/62217-simplest-way-make-split-controller-tab-bar-controller.html
    <font size="2"><font face="Comic Sans MS"><font color="Blue">iPad Wi-Fi 32GB, </font><font color="Sienna">Mac mini 2.53GHz 4GB 320GB,</font> 32" Sharp AQUOS TV, ThinkPad T43<br />
    <br />
    MyApp: <a href="http://itunes.apple.com/us/app/market-event/i
Sign In or Register to comment.