Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios5 在UITabBar中定制更多的uibarbuttonite_Ios5_Customization_Uitabbar_Uitabbaritem - Fatal编程技术网

Ios5 在UITabBar中定制更多的uibarbuttonite

Ios5 在UITabBar中定制更多的uibarbuttonite,ios5,customization,uitabbar,uitabbaritem,Ios5,Customization,Uitabbar,Uitabbaritem,由于iOS 5,苹果提供了一个API来定制UITabBar对象中的uitabaritems。我具体指的是以下选择器: setFinishedSelectedImage:withFinishedSelectedImage: 这一切都适用于常规按钮,但我似乎无法定制“更多”按钮以匹配其他按钮的样式。这就是我正在做的: tabBarController.viewControllers = tabBarControllerArray; tabBarController.moreNavigatio

由于iOS 5,苹果提供了一个API来定制
UITabBar
对象中的
uitabaritems
。我具体指的是以下选择器:

setFinishedSelectedImage:withFinishedSelectedImage:

这一切都适用于常规按钮,但我似乎无法定制“更多”按钮以匹配其他按钮的样式。这就是我正在做的:

tabBarController.viewControllers = tabBarControllerArray;
    tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor blackColor];
    UITabBarItem *more = tabBarController.moreNavigationController.tabBarItem;
     if ([more respondsToSelector:@selector(setFinishedSelectedImage:withFinishedUnselectedImage:)]){
        [more setFinishedSelectedImage:[UIImage imageNamed:@"BarIcon-More.png"]
           withFinishedUnselectedImage:[UIImage imageNamed:@"BarIcon-More.png"]
         ];
    } else {
        more.image = [UIImage imageNamed:@"BarIcon-More.png"];
    }
结果如下,它不会拾取我的自定义更多图像


我见过很多黑客用“更多”按钮来替换“更多”按钮,但肯定有更好的方法来解决这个问题。

这个解决方案很愚蠢

我假设
moreNavigationController
中的
uitabaritems
是只读的,而不是。因此,只需执行以下操作:

tabBarController.moreNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"More" image:[UIImage imageNamed:@"BarIcon-More.png"] tag:0];

与上述相同的自定义代码也可以工作。

解决方案很愚蠢

我假设
moreNavigationController
中的
uitabaritems
是只读的,而不是。因此,只需执行以下操作:

tabBarController.moreNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"More" image:[UIImage imageNamed:@"BarIcon-More.png"] tag:0];

与上述相同的自定义代码也可以使用。

这似乎在iOS 6上不起作用。在更多控制器上设置
tabBarItem
属性没有任何作用。我可以在调试器检查前后跨过赋值行,但它不会改变。还有其他解决方案吗?这在iOS 6上似乎不起作用。在更多控制器上设置
tabBarItem
属性没有任何作用。我可以在调试器检查前后跨过赋值行,但它不会改变。还有其他解决办法吗?