iOS11 UIBarButtonItem 间距问题

在自定义的 button 上写上如下代码 参考的 csdn 上的大佬的代码
https://blog.csdn.net/qq_30963589/article/details/80984659

        let offset:CGFloat = CGFloat(8)
        switch type {
        case .left:
            button.contentEdgeInsets = UIEdgeInsets(top: 0, left: -offset, bottom: 0, right: offset)
        case .right:
            button.contentEdgeInsets = UIEdgeInsets(top: 0, left: offset, bottom: 0, right: -offset)

        }
        button.translatesAutoresizingMaskIntoConstraints = false

你可能感兴趣的:(iOS11 UIBarButtonItem 间距问题)