[英]IOS - tab bar item image modifications
从苹果我们知道
默认情况下,实际的未选择和选择的图像是根据源图像中的alpha值自动创建的。 为防止系统变色,请为图像提供UIImageRenderingModeAlwaysOriginal。
在这里看看。
更改标签栏项目图像和文本颜色iOS
我可以使用以下方法更改突出显示和不突出显示的图像以及位置:
let profileNavController = UINavigationController(rootViewController: profileController)
let profileTabBarItem = UITabBarItem(title: nil, image: UIImage(named: "icon_tab_user")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal), selectedImage: UIImage(named: "icon_tab_user_highlighted"))
profileTabBarItem.imageInsets = UIEdgeInsetsMake(5.5, 0, -5.5, 0)
profileNavController.tabBarItem = profileTabBarItem
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.