UITabBarItem 删除背景颜色灰色/蓝色
我想知道是否可以删除 UITabBar 所选项目的背景颜色
我想删除 UITabBar 按钮的灰色背景。是否可以 ??
我将所选图像和普通图像放在委托方法上:
- (void)tabBar:(UITabBar *)theTabBar didSelectItem:(UITabBarItem *)item{
NSUInteger indexOfTab = [[theTabBar items] indexOfObject:item];
[item setFinishedSelectedImage:[UIImage imageNamed:
[NSString stringWithFormat:@"%u_btnH.png",indexOfTab]]
withFinishedUnselectedImage:[UIImage imageNamed:
[NSString stringWithFormat:@"%u_btn.png",indexOfTab]]
];
}
我的自定义 TabBarItem 图像为 0_btn.png(普通图像)和 0_btnH.png(所选/悬停图像)
I wonder if is possible to remove background color on selected Item of a UITabBar
I want to remove gray background of UITabBar button. Is it possible ??
I put selected and normal image on delegate method:
- (void)tabBar:(UITabBar *)theTabBar didSelectItem:(UITabBarItem *)item{
NSUInteger indexOfTab = [[theTabBar items] indexOfObject:item];
[item setFinishedSelectedImage:[UIImage imageNamed:
[NSString stringWithFormat:@"%u_btnH.png",indexOfTab]]
withFinishedUnselectedImage:[UIImage imageNamed:
[NSString stringWithFormat:@"%u_btn.png",indexOfTab]]
];
}
My custom TabBarItem image are 0_btn.png for normal and 0_btnH.png for selected/hover image
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将 SelectionIndicatorImage 设置为空图像即可:
[[UITabBar外观] setSelectionIndicatorImage:[UIImage alloc]];
Just set the selectionIndicatorImage to an empty image:
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage alloc]];