我通过创建背景图片创建了自定义标签栏,然后在我的 appDelegate 中使用了这段代码
UITabBar *tabBar = [UITabBar appearance];
tabBar.backgroundImage = [UIImage imageNamed:@"tabbar"];
图片
圆顶周围的颜色都是透明的,但是在应用程序中它会自动将其变为白色,因此在滚动时它在 tableview 中看起来不太好。我可以在 ios 中保持透明吗?
我在上面唯一的标签栏代码如下
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil]
setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor whiteColor],
NSFontAttributeName:[UIFont fontWithName:@"Lato-Regular" size:18]
}
forState:UIControlStateNormal];
最佳答案
您可以通过将标签栏的半透明属性设置为 false 来解决此问题。
您可以使用 Storyboard 中的检查器或通过代码对其进行设置:
tabBarController.tabBar.translucent = NO;
希望对你有帮助。
关于ios - tabbar背景图片透明变成白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25098014/