详解iOS应用中自定义UIBarButtonItem导航按钮的创建方法
iOS系统导航栏中有leftBarButtonItem和rightBarButtonItem,我们可以根据自己的需求来自定义这两个UIBarButtonItem。
四种创建方法
系统提供了四种创建的方法:
-(instancetype)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItemtarget:(id)targetaction:(SEL)action;
-(instancetype)initWithImage:(UIImage*)imagestyle:(UIBarButtonItemStyle)styletarget:(id)targetaction:(SEL)action;
-(instancetype)initWithTitle:(NSString*)titlestyle:(UIBarButtonItemStyle)styletarget:(id)targetaction:(SEL)action;
-(instancetype)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItemtarget:(id)targetaction:(SEL)action;
-(instancetype)initWithCustomView:(UIView*)customView;