gpt4 book ai didi

iphone - 具有自定义标题颜色和图像的 UITabBarItem

转载 作者:行者123 更新时间:2023-12-03 18:41:25 28 4
gpt4 key购买 nike

我正在尝试在 xcode、ios 中自定义我的 TabBar,但是我刚刚发现 ppl 说这是不可自定义的!另外,我确实找到了某种解决方案,但它们都不适合我。

我非常想更改 UITabBarItem 标题(文本)颜色,并更改其中的 2 个图像,普通图像和选定图像!

我尝试在 UITabBar subview 中迭代以查看是否找到某些内容,但是否成功:

for (UIView *view in [self.tabBarController tabBar].subviews) 
{
NSLog(@"Class: %@",[view class]);

}

其输出是:

2011-05-18 18:15:24.031 EventApp[52235:207] Class: UIImageView
2011-05-18 18:15:24.032 EventApp[52235:207] Class: UITabBarButton
2011-05-18 18:15:24.032 EventApp[52235:207] Class: UITabBarButton
2011-05-18 18:15:24.033 EventApp[52235:207] Class: UITabBarButton
2011-05-18 18:15:24.033 EventApp[52235:207] Class: UITabBarButton
2011-05-18 18:15:24.034 EventApp[52235:207] Class: UITabBarButton

我无法导入 UITabBarButton 对象来使用它!

有什么解决方案吗?!我还发布了一些我看过的链接,但没有用!

Custom UITabBarItem Image/Title on iPhone

changing text color of uitabbaritem

编辑我想做的是如下所示: enter image description here

最佳答案

在 iOS 5.0 及更高版本中,您可以 Customize UITabBar's Appearance通过更改色调颜色、背景图像和选择指示器,使它们看起来像您喜欢的方式。

您还可以通过调用setFinishedSelectedImage:withFinishedUnselectedImage:来自定义各个UITabBarItems。以完成的选定和未选定图像作为参数的方法。

或者,修改 appearance proxy UITabBar 允许您更改其所有实例的外观。

关于iphone - 具有自定义标题颜色和图像的 UITabBarItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6051706/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com