如何在iOS 7中更改中央选项卡栏按钮的颜色?
我希望我的如何在iOS 7中更改中央选项卡栏按钮的颜色?,ios,objective-c,ios7,uibutton,uinavigationitem,Ios,Objective C,Ios7,Uibutton,Uinavigationitem,我希望我的uitabarcontroller中的中间按钮具有与其他按钮不同的颜色,例如Instagram。有人有什么建议吗?您应该为每个tabBarItem图像设置不同的颜色(如果您希望它像instagram一样) 这里有一个例子: UITabBarItem *tabBarItem = [yourTabBarController.tabBar.items objectAtIndex:2]; //set objectAtIndex you want (For Instagram its 2) U
uitabarcontroller
中的中间按钮具有与其他按钮不同的颜色,例如Instagram。有人有什么建议吗?您应该为每个tabBarItem
图像设置不同的颜色(如果您希望它像instagram一样)
这里有一个例子:
UITabBarItem *tabBarItem = [yourTabBarController.tabBar.items objectAtIndex:2]; //set objectAtIndex you want (For Instagram its 2)
UIImage *unselectedImage = [UIImage imageNamed:@"unselected-imagename"]; //set unselected image
UIImage *selectedImage = [UIImage imageNamed:@"selected-imagename"]; //set selected image
[tabBarItem setImage: [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem setSelectedImage: selectedImage];
希望这有帮助:)
干杯这只会更改按钮的图片,我希望里面有图片的矩形按钮具有不同的颜色。我希望矩形按钮,然后创建一个矩形图像。。。