更改选项卡栏图标和文本在“中的颜色”;“更多”;xamarin表单ios中的选项卡部分

更改选项卡栏图标和文本在“中的颜色”;“更多”;xamarin表单ios中的选项卡部分,xamarin,xamarin.forms,xamarin.ios,tabbar,tabbedpage,Xamarin,Xamarin.forms,Xamarin.ios,Tabbar,Tabbedpage,我正在做一个Xamarin表单项目 我有一个有9个标签的标签页。4个选项卡将显示在选项卡栏中的描述和图标,并添加了额外的选项卡“更多”,其中包含其他选项卡的列表 在Appdelegate.cs文件中,我设置了 UITabbar.appearance.SelectedImageTintColor = UIColor.green; 这也是我的自定义选项卡渲染器: public class CustomTabRenderer : TabbedRenderer { protected ove

我正在做一个Xamarin表单项目

我有一个有9个标签的标签页。4个选项卡将显示在选项卡栏中的描述和图标,并添加了额外的选项卡“更多”,其中包含其他选项卡的列表

在Appdelegate.cs文件中,我设置了

UITabbar.appearance.SelectedImageTintColor = UIColor.green;
这也是我的自定义选项卡渲染器:

 public class CustomTabRenderer : TabbedRenderer
{
    protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);
        TabBar.TintColor = new UIColor(red: 0.55f, green: 0.76f, blue: 0.29f, alpha: 1.0f);
    }

    public override void ViewDidAppear(bool animated)
    {
        base.ViewDidAppear(animated);
        if (TabBar.Items == null) return;
        TabBar.SelectedImageTintColor = new UIColor(red: 0.55f, green: 0.76f, blue: 0.29f, alpha: 1.0f);
        foreach (var uiTabBarItem in TabBar.Items)
        {
            var fontSize = new UITextAttributes(){ Font = UIFont.SystemFontOfSize(13)};
            uiTabBarItem.SetTitleTextAttributes(fontSize, UIControlState.Normal);

        } 
    }

    public override void ItemSelected(UITabBar tabbar, UITabBarItem item)
    {
        tabbar.SelectedImageTintColor = new UIColor(red: 0.55f, green: 0.76f, blue: 0.29f, alpha: 1.0f);
    }
因此,条形图上的所有4个选项卡都是绿色,但“更多”部分中的选项卡始终是蓝色


有什么解决办法吗?我们还可以将彩色图像放入选项卡栏吗?

首先,在iOS中,选项卡栏最多只能显示5项。如果要更改项目“更多”的颜色,请使用代码

    UITabBarController  tabViewController = (UITabBarController)this.Window.RootViewController;
    tabViewController.MoreNavigationController.TabBarController.TabBar.TintColor =new UIColor(red: 0.55f, green: 0.76f, blue: 0.29f, alpha: 1.0f);

设置选项卡栏后

UIColor(红色:0.55f,绿色:0.76f,蓝色:0.29f,阿尔法:1.0f);这是绿色的基于进一步的调查,我看到了TabBar。Items只有5个项目(包括“更多”),上面的类是自定义渲染器。我有一个扩展标签页的页面。在本页的OnAppearing()中;我将页面设置为Tab Tab=new Tab{Title=“test”,Icon=“test.png”}。在何处设置上述行。无法在选项卡式页面和customRenderer中访问上述方法@X.乔