Uisplitview with Uitabbar

UISplitView with UITabbar

I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.

self.extendedLayoutIncludesOpaqueBars = YES;

UISplitViewController in a TabBar ( UITabBarController )?

I made a sample application. and found we can do it programmatically like:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

NSMutableArray *array = [NSMutableArray array];

NSMutableArray *tabArray = [NSMutableArray array];

UISplitViewController *splitViewConntroller = [[UISplitViewController alloc] init];

MainViewController *viewCont = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
[array addObject:viewCont];
[viewCont release];

viewCont = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[array addObject:viewCont];
[viewCont release];

[splitViewConntroller setViewControllers:array];

[tabArray addObject:splitViewConntroller];

[splitViewConntroller release];

array = [NSMutableArray array];

splitViewConntroller = [[UISplitViewController alloc] init];

viewCont = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
[array addObject:viewCont];
[viewCont release];

viewCont = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[array addObject:viewCont];
[viewCont release];

[splitViewConntroller setViewControllers:array];

[tabArray addObject:splitViewConntroller];

[splitViewConntroller release];

// Add the tab bar controller's current view as a subview of the window
[tabBarController setViewControllers:tabArray];

[window addSubview:tabBarController.view];
[window makeKeyAndVisible];

return YES;
}

Hope this helps.

UISplitViewController inside UITabbarController: master controller doesn't go under UITabbar

This is quite an odd issue. Testing with your project, it seems to only affect iPad Air and iPad Air2 and iPhone 6+, not iPad Retina or iPad 2.

The issue relates to the setting of the UINavigationBar barTintColor and the UITabBar barTintColor.

You can fix your issue by doing the following:

1) For each UINavigationController, set the UINavigationBar barTintColor to white or deselect the translucent switch. You can do this in IB by selecting the navigation controller and then selecting the contained nav bar in the view hierarchy.

This deals with the top shadow.

2) For the UITabBarController, set the UITabBar barTintColor to white or deselect the translucent switch. You can do this in IB by selecting the tab bar controller and then selecting the contained tab bar in the view hierarchy.

This deals with the bottom shadow.


When I set both to white it works. When I set both to be not translucent it works. Setting the color you want seems the best idea rather than changing the translucent setting.

As to why? Using the 3D viewer it looks like there is a long navigation bar style UIView which is 64 points high and grey which runs along the whole width of the split view controller. For whatever reason, on iPad Air and iPhone 6s, this is showing through. I guess it relates to the hardware acceleration or some other device specific feature in the newer devices.

Update:

Had another look, and the cause of the shadow is the background color of the UISplitViewController. You can not set this in IB it seems, but it looks like it has a grey color by default which is what you see showing through.

To fix this you need to create a class for the UISplitViewController and set the main views background color. Something like:

class MySplitViewController: UISplitViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Set the background color to white instead of default grey.
self.view.backgroundColor=UIColor.whiteColor()
}
}

So this seems the simplest solution.

UISplitview with UITabBar behavior

You should make a navigation controller for each cell in the master table. When tapping a cell, you switch it accordingly. If the selected cell is tapped, you call popToRootViewController:animated: on the visible navigation controller. Of course, you have to subclass UISplitViewController to keep a reference to your navigation controllers. You would also have to create a MaterTableDelegate to tell you split VC, he should change the navcon in the detail side.

UISplitview: access UITabBarController from appDelegate

Finally I found a solution. I had to use "childViewControllers" of the navigation controller like this:

let splitViewController = self.window!.rootViewController as! UISplitViewController
let leftNavController = splitViewController.viewControllers.first as! UINavigationController
let tabController = leftNavController.childViewControllers.first as! UITabBarController
let viewControllers : Array = tabController.viewControllers!
print("viewControllers \(viewControllers)")

Now I can easily access any of the viewControllers and run their methods from appDelegate :-)



Related Topics



Leave a reply



Submit