// // UIBarButtonItem+Extensions.swift // WeiBo // // Created by Handy_Cao on 2018/4/8. // Copyright © 2018年 Handy_Cao. All rights reserved. // import UIKit extension UIBarButtonItem { /// 便利构造方法,自定义 UIBarButtonItem /// /// - Parameters: /// - title: 标题 /// - fontSize: 标题大小 /// - normalColor: 正常状态颜色 /// - highlightedColor: 点击状态颜色 /// - target: 目标控制器 /// - action: 点击实现的方法 convenience init(title: String, fontSize: CGFloat = 16,normalColor: UIColor = UIColor.white, highlightedColor: UIColor = UIColor.white,target: AnyObject?,action: Selector){ let btn:UIButton = UIButton(title: title, fontSize: fontSize, normalColor: normalColor, highlightedColor: highlightedColor) btn.addTarget(target, action: action, for: .touchUpInside) self.init(customView: btn) } }