Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to access “tabBarController: shouldSelectViewController:” on Xamarin.Forms?

LuizNegriniLuizNegrini USMember ✭✭
edited October 2019 in Xamarin.Forms

I need to have control of this method so that I can make a change in my app. But I couldn't make this implementation work, can anyone help?

Here is the Custom Renderer of my TabbedPage:

public class MainTabbedPageRenderer : TabbedRenderer, IUITabBarControllerDelegate
{
     [Export("tabBarController:shouldSelectViewController:")]
     public bool ShouldSelectViewController(UITabBarController tabBarController, UIViewController viewController)
     {
          return false;
     }
}

The breakpoint does not stop there at all.

I have the impression that it does not stop at breakpoint because TabBarController is always null, but the screen loads and performs navigations normally, I also could not make this TabBarController be filled.

You can click on tabbar items using this method:

[Export("tabBar:didSelectItem:")]
public void ItemSelected(UITabBar tabbar, UITabBarItem item)
{
}

Best Answer

Answers

  • LuizNegriniLuizNegrini USMember ✭✭

    Thanks @LandLu !!!!!

Sign In or Register to comment.