の選択されていないアイコンの色をTabbedページから変更しようとしています。私が選択した項目のテキストの色と非選択項目のテキストの色ではなく、アイコンの色を変更するために管理しているXamarinフォームのタブ付きページタブ非選択色
public class CustomTabbedPage : TabbedRenderer
{
public override void ViewWillAppear(bool animated)
{
if (TabBar == null) return;
if (TabBar.Items == null) return;
var tabs = Element as TabbedPage;
if (tabs != null)
{
for (int i = 0; i < TabBar.Items.Length; i++)
{
UpdateItem(TabBar.Items[i], tabs.Children[i].Icon);
}
}
base.ViewWillAppear(animated);
}
private void UpdateItem(UITabBarItem item, string icon)
{
if (item == null)
return;
try
{
icon = icon.Replace(".png", " Filled.png");
if (item == null) return;
if (item.SelectedImage == null) return;
if (item.SelectedImage.AccessibilityIdentifier == icon) return;
item.SelectedImage = UIImage.FromBundle(icon);
item.SelectedImage.AccessibilityIdentifier = icon;
}
catch (Exception ex)
{
Console.WriteLine("Unable to set selected icon: " + ex);
}
}
}
:
は、私は、カスタムTabbedRendererを持っています。
ありがとうございました!
http://stackoverflow.com/questions/24526851/how-to-change-tabbar- icon-color-in-ios –
有用ではありません。ありがとう! –