I was wondering how I would go about changing the "more" menu on a tabbar on iOS to be a bottom pop up rather than a full page.
I was wondering how I would go about changing the "more" menu on a tabbar on iOS to be a bottom pop up rather than a full page.
Hello,
Welcome to Microsoft Q&A!
If I understand correctly , do you want to show a pop up rather than a full page when clicking on the more button on tabbar ?
If so , you can achieve it with custom renderer in iOS project .
[assembly: ExportRenderer(typeof(TabbedPage), typeof(MyTabRenderer))]
namespace FormsA.iOS
{
public class MyTabRenderer : TabbedRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.ViewControllerSelected += MyTabRenderer_ViewControllerSelected;
}
UIViewController lastViewController;
private void MyTabRenderer_ViewControllerSelected(object sender, UITabBarSelectionEventArgs e)
{
var index = this.ViewControllers.ToList().IndexOf(e.ViewController);
if(index == -1)
{
//handle stuffs
this.SelectedViewController = (lastViewController!=null)? lastViewController: this.ViewControllers[0];
}
lastViewController = e.ViewController;
}
}
}
If you're using shell project ,check the code below
[assembly: ExportRenderer(typeof(Xaminals.AppShell), typeof(Xaminals.iOS.MyShellRenderer))]
namespace Xaminals.iOS
{
public class MyShellRenderer : ShellRenderer
{
protected override IShellTabBarAppearanceTracker CreateTabBarAppearanceTracker()
{
return new TabBarAppearance();
}
}
public class TabBarAppearance : IShellTabBarAppearanceTracker
{
public void Dispose()
{
}
public void ResetAppearance(UITabBarController controller)
{
}
bool isFirst = true;
UIViewController lastViewController;
public void SetAppearance(UITabBarController controller, ShellAppearance appearance)
{
if(isFirst)
{
controller.ViewControllerSelected += (sender, e) =>
{
var index = controller.ViewControllers.ToList().IndexOf(e.ViewController);
if (index == -1)
{
//handle stuffs
controller.SelectedViewController = (lastViewController != null) ? lastViewController : controller.ViewControllers[0];
}
else
{
lastViewController = e.ViewController;
}
};
isFirst = false;
}
}
public void UpdateLayout(UITabBarController controller)
{
}
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Thanks! I'm sorry, I'm still really new to Xamarin Forms. So currently I'm implementing the Tabbar via <Shell><TabBar><ShellContent> this doesn't seem to be overriding the tabbar on iOS (v14.4). I noticed you inherited from TabbedRenderer, will this need to be a new page that i implement into shell tabbar??
Am I missing something? I integrated this into the iOS project but the more button now does nothing.
it , it does nothing , place you own logic into
if (index == -1)
{
//handle stuffs
controller.SelectedViewController = (lastViewController != null) ? lastViewController : controller.ViewControllers[0];
}
7 people are following this question.