iOS: Cannot set CurrentPage of TabbedPage: only a view controller in the tab bar controller's list of view controllers can be selected.
See original GitHub issueHi there, am trying to set the current page for tabbedPage in code but not having too much luck:
(BindingContext as LoginPageModel)?.CoreMethods.SwitchOutRootNavigation(NavigationStacks.MainAppStack);
if (Settings.CurrentUser.GetInHouseBooking() == default(CurrentBooking))
{
if (Application.Current.MainPage is FreshTabbedNavigationContainer freshTabbedNavigation)
{
Page contentPage = (Page)freshTabbedNavigation.TabbedPages.ElementAt(2);
freshTabbedNavigation.SelectedItem = contentPage;
freshTabbedNavigation.CurrentPage = contentPage;
}
}
I can confirm that correct page I want is in fact contentPage when I debug but the page is showing when the tabbedpage loads. I want child page of tabbed page at index 2 but I am getting the tab at index 0 showing which would be the default but am trying to override that.
The tabbedpage has not yet displayed at this point.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13
Top Results From Across the Web
UITabBarController setSelectedViewController only a view ...
@Jef If the controller is not already in one of the tabs, then you need to add it to the viewControllers array to...
Read more >Tab bar controller not showing on
The view controller is linked to by a button on the main view controller and when navigated to the the tab bar is...
Read more >UITabBarController | Apple Developer Documentation
If you don't provide a custom tab bar item for your view controller, the view controller creates a default item containing no image...
Read more >Xamarin.Forms Namespace
Controls the relative positioning of, and spacing between, ... Enumerates values that control whether items in a list view can or cannot be...
Read more >Create Tab Bar Controller Programmatically (Swift 5, Xcode 11)
In this video we will learn how to create, configure, and present a tab bar controller fully programmatically through code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
sample_TabbedPage.zip
Please check the sample, that should do the trick for you. Hope that helps.
Closing this issue @LeoJHarris , but feel free to reopen if u have any issues.