Controlling Tab Bar Visibility

I am experimenting with a Tabbed app. One of the Views (tabs) shows a list of items. I want the user to be able to select any item and be navigated into a View that shows details pertaining to the item.

In that subsequent detailed View, is it possible to hide the Tab Bar?

A bit of experimentation suggests that if an app is initially set up as tabbed, then all views must display the Tab Bar.

Because the tab is setup in the iOS Screen that would be the case. Think of the screen is that which holds the views even though each container (single view, tab view, left/right split) can have fully independent views.

I think that want you want to look into iOSToolbar.

Russ - is this any help?

Examples/iOS/Controls/SplitViewExample

[quote=151432:@Bob Keeney]Because the tab is setup in the iOS Screen that would be the case. Think of the screen is that which holds the views even though each container (single view, tab view, left/right split) can have fully independent views.

I think that want you want to look into iOSToolbar.[/quote]

I think I follow you.

iOSToolbar seems to be a good candidate since I can control in on a view by view basis. The only downside I see so far is that iOSToolButtons don’t seem to be able to contain both an image and a caption (like a Tab Bar).

[quote=151433:@Richard Summers]Russ - is this any help?

Examples/iOS/Controls/SplitViewExample[/quote]

The split view is an excellent suggestion for larger views and screens. Thanks.

Yes - you can have your list on the left - which updates the actual content on the right.
Glad to have helped :slight_smile:

Although I’ve not been able to get it to work properly with iPad Portrait. Any trick to this?

No idea??
I just saw it and thought it may be beneficial to Russ.

I was also hoping to use that myself - so I hope someone finds out how it works :slight_smile:

It looks like the Tab Bar can be hidden on a View using a Declare. I googled this up:

ViewController *viewController = [[ViewController alloc] init]; viewController.hidesBottomBarWhenPushed = YES; // This property needs to be set before pushing viewController to the navigationController's stack. [self.navigationController pushViewController:viewController animated:YES];

I have tried to morph this into a Xojo-friendly declare, with only comical results.

Comical? You should see my normal coding!!! :slight_smile:

File a feature request asking for the ability to hide the tab bar for a given view.

Seems like this might work:

  // @property(nonatomic) BOOL hidesBottomBarWhenPushed
  
  Dim v As New View3
  
  Declare Sub setHidesBottomBarWhenPushed Lib "UIKit" _
  Selector "setHidesBottomBarWhenPushed:" (id As Ptr, value As Boolean)
  
  setHidesBottomBarWhenPushed(v.Handle, True)
  
  Self.PushTo(v)

[quote=151609:@Paul Lefebvre]Seems like this might work:

  // @property(nonatomic) BOOL hidesBottomBarWhenPushed
  
  Dim v As New View3
  
  Declare Sub setHidesBottomBarWhenPushed Lib "UIKit" _
  Selector "setHidesBottomBarWhenPushed:" (id As Ptr, value As Boolean)
  
  setHidesBottomBarWhenPushed(v.Handle, True)
  
  Self.PushTo(v)[/code][/quote]

It works great :)

Do you think it could be made into a method for the wrapper ?

I tried wrapping it as such :

[code]Sub hideTabBar(v as iOSView, slf as iOSView)
  // @property(nonatomic) BOOL hidesBottomBarWhenPushed
  
  Declare Sub setHidesBottomBarWhenPushed Lib "UIKit" _
  Selector "setHidesBottomBarWhenPushed:" (id As Ptr, value As Boolean)
  
  setHidesBottomBarWhenPushed(v.Handle, True)
  
  Slf.PushTo(v)
End Sub

But when I try to call it with

hideTabBar(View1,self)

I get

Expected a value of type class View1.View1, but found a static namespace reference to class View1.View1.

What am I missing ?

You are missing an instance to the new view.

Dim v As New View1 hideTabBar(v, Self)

[quote=151616:@Paul Lefebvre]You are missing an instance to the new view.

Dim v As New View1 hideTabBar(v, Self)[/quote]

Duh. Now I will be able to add that to the wrapper :slight_smile:

Thank you for sharing this, Paul.

I’d love a version of this that selects a tab (so simulates the user clicking on a TabBar icon)… :slight_smile:

The method hideTabBar is now part of the wrapper. I also found how to reinstate the tab bar : simply go self.close on the pushed tabless view.

That would be real great. I am battling at the moment the lack of this feature.

On Tab1 I have a view (‘Letter)’ that displays a letter for children to copy
On Tab 2 the user picks a new letter to display using the keyboard (‘Pick’ view). When the letter has been found, I PushTo a copy of the Letter view.

Then what happens is that if I tap on Tab 1 or Tab2, nothing changes. I will have to tap twice on Tab 2 to get the Pick view.

If I close the pushed view in deactivate, the Pick view takes over, so I cannot go to another view.

This is messy.

It would be greatly better to actually activate a tab by code.

Jason, you talked about that before, but have you filed a feature request ?

Yes, a month ago: (https://xojo.com/issue/36718)>] . It’s also pretty important for my app which has a Dashboard as the first tab summarising important data in the other four tabs. In our web app you can tap a dashboard widget to go straight to the items needing attention but I can’t do that under iOS as I can’t programmatically select the tab.

Your link is broken. <https://xojo.com/issue/36718>

I had forgotten I participated in the feedback as well. Let us hope it is doable.

My current issue with pushed views is also that there is no way to know if a view is the default one or the pushed one. Currently, I just found out that the default one has a TabTitle, and the pushed one does not. But no way to know how many views are in the pile or their title. As if you had opened several windows in a desktop app and could not know which ones they are.

[quote=151609:@Paul Lefebvre]Seems like this might work:

[code]
// @property(nonatomic) BOOL hidesBottomBarWhenPushed

Dim v As New View3

Declare Sub setHidesBottomBarWhenPushed Lib “UIKit” _
Selector “setHidesBottomBarWhenPushed:” (id As Ptr, value As Boolean)

setHidesBottomBarWhenPushed(v.Handle, True)

Self.PushTo(v)[/code][/quote]

Paul, thank you very much for sorting this out!