标签:get goback orm system 重写 targe uibutton 自定义 ram
// 重写导航栏返回按钮方法
func configBackBtn() -> Void {
// 返回按钮
let backButton = UIButton(type: .custom)
// 给按钮设置返回箭头图片
backButton.setImage(UIImage(named: "NavigationBar_goBack_icon"), for: .normal)
// 设置frame
backButton.frame = CGRect(x: 200, y: 13, width: 18, height: 18)
backButton.addTarget(self, action: #selector(back), for: .touchUpInside)
// 自定义导航栏的UIBarButtonItem类型的按钮
let backView = UIBarButtonItem(customView: backButton)
// 重要方法,用来调整自定义返回view距离左边的距离
let barButtonItem = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
barButtonItem.width = -5
// 返回按钮设置成功
navigationItem.leftBarButtonItems = [barButtonItem, backView]
}
标签:get goback orm system 重写 targe uibutton 自定义 ram
原文地址:http://www.cnblogs.com/crazygeek/p/7356466.html