我正在使用XCode系统图片(SF Symbols)作为UITabBarItem
图像。我想要移除已经完成的UITabBarItem
标题,同时也希望将UITabBarItem
图像下移一点。
过去,在不使用系统图像时,使用UIEdgeInsets
可以很好地完成此操作。但是,在系统图像上似乎没有任何效果。
代码:
let imageConfiguration = UIImage.SymbolConfiguration(weight: .regular)
let imageInsets = UIEdgeInsets(top: 8, left: 0, bottom: -8, right: 0)
lazy var activityTabBarItem: UITabBarItem = {
let image = UIImage(systemName: "stopwatch")?.applyingSymbolConfiguration(imageConfiguration)
let tabBarItem = UITabBarItem(title: nil,
image: image,
selectedImage: image)
tabBarItem.imageInsets = imageInsets
return tabBarItem
}()
有没有解决这个问题的方法?