【发布时间】:2012-01-22 18:38:40
【问题描述】:
根据苹果docs
我正在尝试在 UITabBarItem 上设置自定义完成的选定和未选定图像,如下所示:
...
DetailViewController *vc1 = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:nil];
UITabBarItem *vc1i = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemTopRated tag:100];
[vc1i setFinishedSelectedImage:[UIImage imageNamed:@"tab_bar_item_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"tab_bar_item_normal.png"]];
[vc1 setTabBarItem:vc1i];
...
基本上发生的事情是 TabBar 加载得很好,它只是完全忽略了标签栏项目的自定义。
我的目标是 iOS5+
图像是 30x30 透明 PNG,并且存在于项目中。无法弄清楚我在这里俯瞰什么,但一定是什么!
这是在 tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 方法中调用的,也就是 Ray Wenderlich 的 tutorial
有人有什么想法吗?
谢谢!
【问题讨论】:
-
注意:setFinishedSelectedImage:withFinishedUnselectedImage: 需要 iOS 5。
标签: iphone ios ios5 uitabbar uitabbaritem