答案 0 :(得分:0)
对于底部文字:
// This will change the text's color when the item is unselected
var attributes = new UITextAttributes();
attributes.TextColor = UIColor.Red;
TabBarItem.SetTitleTextAttributes(attributes, UIControlState.Normal);
var selectedAttributes = new UITextAttributes();
selectedAttributes.TextColor = UIColor.White;
TabBarItem.SetTitleTextAttributes(selectedAttributes, UIControlState.Selected);
对于图标:
// This will let the icon show the image's original color(instead of the gray) when the item is unselected
TabBarItem.Image = UIImage.FromBundle("imageName").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
选择项目时,您也可以使用相同的方法设置图像:
TabBarItem.SelectedImage = UIImage.FromBundle("imageName").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
或者只使用TabBar.TintColor = UIColor.White;
。