嘿,我有一个像这样的导航栏:
要微调UIBarButtonItem
s在右侧的位置,我需要使用图像插入。我有一个方便的init方法来初始化按钮:
convenience init(type: ButtonType, target: Any?, selector: Selector) {
let image: UIImage = type.image.withRenderingMode(.alwaysTemplate)
self.init(image: image, style: .plain, target: target, action: selector)
imageInsets = type.imageInsets
}
这很好用,但对于iOS10,按钮看起来像这样:
为什么会这样?我该怎么办才能修复它?
任何建议都会很棒,谢谢!
我认为你只使用了正确的插图。
您可以尝试:右边插入= 10,左边插入= -10。