作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
按照Apple 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];
...
tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
方法中调用
最佳答案
选项卡栏项目使用initWithTabBarSystemItem:tag:
方法初始化。但是,正如文档所述:
此方法返回系统提供的选项卡栏项。返回的项目的标题和图像属性以后不能更改。
您应该使用initWithTitle:image:tag:
初始化选项卡栏项目。
UITabBarItem *vc1i = [[UITabBarItem alloc] initWithTitle:@"Top Rated" image:nil tag:100];
[vc1i setFinishedSelectedImage:[UIImage imageNamed:@"tab_bar_item_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"tab_bar_item_normal.png"]];
关于iphone - iOS 5:UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:不起作用/被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8547669/
我的界面完全由 Storyboard 布局(包括 UITabBarController 和所有相应的 View )。 现在是自定义标签栏的时候了。因为我有已经设置为正确颜色的图标,所以我不能使用 [[
setFinishedSelectedImage:withFinishedUnselectedImage: 在 iOS7 中被弃用。苹果recommends将 image 和 selectedImag
按照Apple docs 我正在尝试像这样在UITabBarItem上设置自定义完成的选定和未选定图像: ... DetailViewController *vc1 = [[DetailViewCon
我是一名优秀的程序员,十分优秀!