【发布时间】:2014-01-28 07:33:54
【问题描述】:
我使用 Ray Wenderlich 和 iOS 博客中的方法自定义了一个标签栏,但是因为我使用浅色作为背景,所以文本标签看起来很糟糕,我想更改它们以匹配我的风格。有可能吗?如何实现?
如果不可能或太复杂,我想问一下如何将图标图像向下移动以使其位于标签栏的中心?这样我可以在 .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];
【问题讨论】:
标签: iphone objective-c ios ios5 uitabbar