UIBarButtonItem+Extension.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // UIBarButtonItem+Extension.h
  3. // JWlive
  4. //
  5. // Created by pican zhang on 16/3/18.
  6. // Copyright © 2016年 pican zhang. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @interface BackView:UIView
  10. @property(nonatomic,strong)UIButton *btn;
  11. @end
  12. @interface UIBarButtonItem (createBtnItem)
  13. //+ (instancetype)itemWithImage:(NSString *)image highImage:(NSString *)highImage target:(id)target action:(SEL)action;
  14. //+ (instancetype)itemWithImage:(NSString *)image
  15. // title:(NSString *)title highImage:(NSString *)highImage contentEdge:(UIEdgeInsets)contentEdge target:(id)target action:(SEL)action;
  16. //+ (instancetype)itemWithFrame:(CGRect)frame Title:(NSString*)title titleFont:(UIFont*)font titleColor:(UIColor*)titleColor bkgColor:(UIColor*)bkgColor contentEdge:(UIEdgeInsets)contentEdge hasBorder:(BOOL)hasBorder borderBkgColor:(UIColor*)borderBkgColor target:(id)target action:(SEL)action;
  17. //+ (instancetype)itemWithFrame:(CGRect)frame Title:(NSString*)title titleFont:(UIFont*)font titleColor:(UIColor*)titleColor target:(id)target action:(SEL)action;
  18. //+(UIBarButtonItem *) text:(NSString *)text contentEdge:(UIEdgeInsets)contentEdge selector:(SEL)selecor target:(id)target;
  19. ////+(UIBarButtonItem *) text:(NSString *)text selector:(SEL)selecor target:(id)target;
  20. //+(UIBarButtonItem *) icon:(NSString *)icon selector:(SEL)selecor target:(id)target;
  21. //+(UIBarButtonItem *) back:(NSString *)title selector:(SEL)selecor target:(id)target;
  22. //
  23. //+(UIBarButtonItem*)itemWithImage:(NSString *)image title:(NSString *)title target:(id)target action:(SEL)action;
  24. @end
  25. //利用runtime给UIBarButtonItem动态添加属性
  26. @interface UIBarButtonItem (Badge)
  27. @property (strong, nonatomic) UIView *badge;
  28. @property (assign, nonatomic) UIColor *badgeColor;
  29. @property (assign, nonatomic) CGFloat badgeOriginX;
  30. @property (assign, nonatomic) CGFloat badgeOriginY;
  31. @property (assign, nonatomic) CGFloat badgeSize; // badge width and height
  32. @property BOOL hasBadge;
  33. @end