美文网首页
iOS11 UIBarButtonItem 间距问题

iOS11 UIBarButtonItem 间距问题

作者: 茗记西岭雪 | 来源:发表于2020-11-09 22:18 被阅读0次

    在自定义的 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 间距问题

          本文链接:https://www.haomeiwen.com/subject/wfnrbktx.html