BBAMultiTabBarButtonItem.h
3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// BBAMultiTabBarButtonItem.h
// BBAUIKit
//
// Created by liyongrui on 2018/12/14.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <BBAUIKit/BBABadgeValueView.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, BBAMultiTabBarButtonItemStyle) {
BBAMultiTabBarButtonItemStyleText,
BBAMultiTabBarButtonItemStyleImage,
BBAMultiTabBarButtonItemStyleSwitch,
BBAMultiTabBarButtonItemStyleCustom,
};
@class BBAMultiTabBarButtonItem;
@protocol BBAMultiTabBarButtonItemDelegate<NSObject>
- (void)multiTabBarButtonItemDidClick:(BBAMultiTabBarButtonItem *)item;
@end
/**********************************************************************
* BBAMultiTabBarButtonItem
**********************************************************************/
@interface BBAMultiTabBarButtonItem: NSObject
@property (nonatomic, assign, getter=isSelected) BOOL selected;
@property (nonatomic, assign) CGPoint offset;
@property (nonatomic, assign) CGPoint badgeOffset;
@property (nonatomic, assign) CGFloat badgeAlpha;
@property (nonatomic, strong) UIView *customView;
@property (nonatomic, assign) CGSize customSize;
@property (nonatomic, assign) BOOL separatorLineHidden;//右边button是否要隐藏分割线
/// 按钮点击热区的位置大小,是相对于BBAMultiTabBar(仅在添加至Bar上之后有效)
@property (nonatomic, assign, readonly) CGRect hitRect;
@property (nonatomic, weak) id<BBAMultiTabBarButtonItemDelegate> delegate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) UIImage *normalImage;
@property (nonatomic, strong) UIImage *selectedImage;
@property (nonatomic, strong) UIImage *backgroundImage;
@property (nonatomic, assign) BBAMultiTabBarButtonItemStyle style;
@property (nonatomic, strong) UIButton *view;
@property (nonatomic, strong) BBABadgeValueView *badgeView;
@property (nonatomic, weak) id target;
@property (nonatomic, assign) SEL action;
@property (nonatomic, assign) CGRect viewFrame;
- (instancetype)initWithTitle:(NSString *)title;
- (instancetype)initWithTitle:(NSString *)title target:(id)target action:(SEL)action;
- (instancetype)initWithImage:(UIImage *)image;
- (instancetype)initWithImage:(UIImage *)image target:(id)target action:(SEL)action;
- (instancetype)initWithBackgroundImage:(UIImage *)backgroundImage normalImage:(UIImage *)normalImage selectedImage:(UIImage *)selectedImage;
- (void)setImage:(UIImage *)image forState:(UIControlState)state;
- (instancetype)initWithCustomView:(UIView *)customView;
- (instancetype)initWithCustomView:(UIView *)customView target:(id)target action:(SEL)action;
- (void)showBadge;
- (void)showBadgeText:(NSString *)text;
- (void)clearBadge;
#ifdef DEBUG
- (void)setAccessibility;
#endif
- (void)updateBadgePosition;
- (void)setBackgroundImage:(UIImage *)dstImage srcImage:(UIImage *)srcImage progress:(CGFloat)progress;
- (void)setNormalImage:(UIImage *)dstImage srcImage:(UIImage *)srcImage progress:(CGFloat)progress;
- (void)setSelectedImage:(UIImage *)dstImage srcImage:(UIImage *)srcImage progress:(CGFloat)progress;
@end
NS_ASSUME_NONNULL_END