【发布时间】:2020-07-05 16:12:19
【问题描述】:
我正在为UITabBarItem 图像使用 XCode 系统图像(SF 符号)。我想删除我已经完成的UITabBarItem Title。但也将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
}()
有解决办法吗?
【问题讨论】:
标签: swift xcode uitabbaritem uiedgeinsets sf-symbols