.net maui shell tabbar - how do i make it invisible? - maui

It looks like you can set a tabbar inside of a shell if the tabs are defined within the shell. https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/tabs
According to the documentation, I can set the visibility of the tabbar by referencing the shell.CurrentItem which is a static object. Ok. Danged if I can figure out how to reference the TabBarVisibility property or find anything that looks like that property. Any thoughts are appreciated.
Wally

No, it has nothing to do with Shell.Current.CurrentItem.
That is part of the previous section in doc, not part of hiding tabbar.
Look at the next code snippet. The first one in section TabBar and Tab Visibility:
...
<ShellContent Shell.TabBarIsVisible="false" ...
Shell.TabBarIsVisible is an Attached Property.
To set programmatically in c# code behind:
Shell.SetTabBarIsVisible(someView, false);
where someView is the x:Name of a "shell content" (a page shown when corresponding tab is selected) that when it is showing, tabbar should be hidden.

Related

UITabBarController functionality with UITabBar

I'm making an app with interface builder using storyboarding.
I want to have a tab bar where no item is selected. This can be accomplished by setting
TabBar.SelectedItem = null;
But if you try to do that, you get the following error:
'Directly modifying a tab bar managed by a tab bar controller is not allowed.'
So I can't use the standard UITabBarController. I've created a custom UIViewController, and added a UITabBar. Switching between tabs is working fine, and having no selection is also working as it should.
But I have no idea how to show my other view controllers from my custom view controller with the tab bar. Remember that I'm using interfacebuilder, so I can't just create my view controllers in code as new objects and add them to the view. (as suggested in UITabBar funcionality without UITabBarController)
So how do I show my own views without using the UITabBarViewController?
Edit: Still haven't found a solution, but I did a hacky fix. Simple create an other tab bar and place it on top of the original tab bar. Listen to those events and use SelectedIndex to change the view displayed. Then add some function that will select / deselect the items on your own tab bar.
In fact, even if you design your others UIViewControllers from IB, you can instantiate them from code. You'll probably have to play a bit with frame and autoresizing properties to make them fit the part of your main view you want them to display inside, but it's possible.
So, knowing that, a simple solution is to create a simple UIView (we'll call it 'tabFrame') in your main UIViewController, which fill the screen from the top of your UITabBar to the top of the screen; instantiate the UIViewController corresponding to your tabs and add their view as subview of tabFrame. Now you just have to catch item selection from tabbar to hide or show the desired subviews.
Hope I'm clear enough, else don't hesitate to question!
EDIT: pointed out this morning that in storyboarding context, you can effectively instantiate viewControllers / scene from code, but for not loosing designer settings it must NOT be done through directly calling their constructors, but through StoryBoard.InstantiateViewController("vc_identifier") calls, after having set identifiers to VCs in storyboard editor.
See http://docs.xamarin.com/ios/recipes/General/Storyboard/Storyboard_a_TableView for example

How to make a tabbar such that the first tab of the tabbar should not remain selected

I have created a Windows application.in my appdelegate I have called a controller class named analogcontroller and added this class to my window so that when I run my application the page that should come first is this page that contains an analog clock with five tabbaritems in it each calling different class.
So in the analog controller class xib I have added a tabbar with 5 tabbaritems in it. But when I run my application the page that gets opened is the page of the firsttabbaritem instead of analogcontroller. I want that when I run my application my xib of analog controller should be called with 5 tabbar items below it and when I click on particular tabbaritem then only its corresponding page should be opened, otherwise not. How is this possible?
you can set tabbar selected index to your desired tab index it starts from 0
you can write something like tabbarcontroller.tabbar.selectedindex =1;
Forgive syntax errors... you should try this. xCode is rich editor.
If you have a visible tabBarController, then something will necessarily be selected. No way around this.
However, if you would like to hide the tabBar, then you can certainly do that, either by setting its hidden property to YES or by presenting a modal view on top of the selected tab (e.g. the first viewController).
similar question here

How to handle sub-content in tabGroups in Titanium Mobile

What is the designated way to handle alternating content in the active tab of a tabGroup?
In my case I have a tableview with a toolbar on top, and when a row is clicked, I'd like to switch the content in that tab to a new content with a different (edit) toolbar.
In the KitchenSink demo app the window is just replaced as far as I can see. Is this the way to go? How are transitions handled?
Thank you for your answers,
Chris
You can open the new window on the current tab:
tab.open(newWindow);
This will use the standard iOS navigation transition animation.
Also, you can configure a window's navigation bar (top bar) without needing to create and add a toolbar using Window properties like title, leftNavButton, rightNavButton. For example, create an edit button and then do:
newWindow.rightNavButton = editButton;
Also, you can create a standard edit button by setting the systemButton property to Ti.UI.iPhone.SystemButton.EDIT.
Finally, to create a system button with any title, set title property and also set the style property to Ti.UI.iPhone.SystemButtonStyle.BORDERED.

In XCode 4, how do you change the number of tabs in a UiTabBarViewController?

I've been looking at this new interface for a while now and I can't figure out how to add or remove tabs from the tab bar.
Any help would be appreciated.
There are two possibilities:
1 - Open your xib-file inside Xcode. Show the right sidebar (Navigator | Utility). At the bottom of this bar should be all Interface Builder objects (i.e. UITabBarItem, UILabel, ...). Now drag a UITabBarItem to your View.
If you don't see these objects: At the bottom is a small cube. press it and you'll see it.
2 - Right-click on your file and open in external editor. This opens Interface Builder. If it won't work you can open your file directly with the Interface Builder.
You ask this question in the Apple Developer Forums where you can talk about confidential information (read: NDA software). Xcode4 is not yet available for public consumption, therefore it's still under NDA.
I also work around on find out how to set the tabitem in Xcode4, I found you just drag the controller to the tabitems, the select the uiview of this tab item and set it's class. Xcode on longer support set tab item at the inspect panel.
Assuming that your Tab Bar was created in XCode (which it should be if you created a Tab Bar project) click on your Main Window.xib to view it.
Click the disclosure indicator to see the hierarchy of objects (if it isn't that way already).
It should look something like this:
The number of view controllers that you have underneath it is the number of tabs you have.
In this case the view controller is a Navigation Controller, and the View Controllers are children of it.
If u r using Story board .........
Just do this ...
and i am telling for Xcode 4.3
just add view controller from the libirary you can add as much as you like..
then link those views with your main view controller...
as you will link with it ....
it will automatically pop up relationship with main controller and thus a tap will be added automatically in your main controller...
you can visit this link ....
"http://www.youtube.com/watch?v=qvvJzkJcsew"

iPhone Objective-C: Programmatically change title of tab bar item in tab bar created using IB?

Right now, I am setting the title in the viewDidLoad of the root view of the tab, which only changes when I click on the tab. I want this to be set before I select the tab. I tried something like:
[[self.parentViewController.tabBarController.tabBar.items objectAtIndex:2] title] = #"string";
in the first view that loads in another tab, but there is clearly something wrong since I get a left operand error.
What is the correct way to achieve what I am trying to do?
[[self.parentViewController.tabBarController.tabBar.items objectAtIndex:2] title] = #"string";
The syntax is slightly off here. You probably wanted something like:
[[self.parentViewController.tabBarController.tabBar.items objectAtIndex:2].title = #"string";
However, that won't work, since there is no title property to set. In fact, there's no way I can see to change a UITabBarItem's title once it's been initialized. You'll have to use UITabBar's setItems:animated: method to set the entire group of items at once. But it won't be fun.
I bet this would be an Apple HIG violation, which is why there's no easy way to do it with the current API. Rethink your design and ask yourself why you want to change the names of the tabs, which will confuse your users.
Try setting the title in awakeFromNib instead of viewDidLoad. The view for a view controller is not actually loaded until you need the view, and the tab bar controller by default doesn't access the view of a view controller until you actually select it (which is why you saw the title change when you selected the tab).
Since the nib is creating the view controller to start with (assuming you have built your tab bar controller in IB) awakeFromNib will be called as soon as the view controller has been built, before the tab bar controller can ask what the title is.