我已经使用Ray Wenderlich和iOS Blog中的方法自定义了选项卡栏,但是因为我使用的是浅色作为背景,所以文本标签看起来很糟糕,我想将它们更改为与我的样式相匹配。这是可能的和如何?如何自定义UITabBar文本标签?
如果它不可能或如果它太复杂我想问如何将图标图像向下移动,以便它在标签栏中居中?这样我可以在.png文件上“写”标签。
我打算为iOS5 +开发这个应用程序,所以不用担心它与iOS4兼容(尽管如果任何人发现这样做的简单方法,我会非常感激)。
这里的what I got到目前为止,这里的what I want。
的代码为我tabBarBackground:
UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selection-tab.png"]];
而对于图标:
//Custom TabBar Items
UIImage *selectedImage = [UIImage imageNamed:@"home-icon-selected.png"];
UIImage *unselectedImage = [UIImage imageNamed:@"home-icon.png"];
UITabBar *tabBar = rootTabBarController.tabBar;
//Icons for the 1st Tab
UITabBarItem *item1 = [tabBar.items objectAtIndex:0];
[item1 setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage];
该链接已损坏 – mikeyq6