BBAToolBarItem.h
5.34 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// BBAToolBarItem.h
// BBAPods
//
// Created by liuboyang01 on 16/8/17.
// Copyright © 2016年 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BBABadgeValueView.h"
/*
自带样式button,间距通过BBAToolBarSystemItemIDFlexibleSpace和BBAToolBarSystemItemIDFixedSpace调节
*/
/*
***有需要插入的类型,以后请直接插入到BBAToolBarSystemItemIDMAX之前即可,不可改动之前的顺序,因为第三方APS插件会按照定义好的传
*/
typedef enum
{
BBAToolBarSystemItemIDUpvote = 998, // 已点赞
BBAToolBarSystemItemIDUnUpvote = 999, // 未点赞
BBAToolBarSystemItemIDBack = 1000, // 返回
BBAToolBarSystemItemIDHome = 1001, // home
BBAToolBarSystemItemIDUnFavored = 1002, // 未收藏
BBAToolBarSystemItemIDComment = 1003, // 评论
BBAToolBarSystemItemIDFavored = 1004, // 已收藏
BBAToolBarSystemItemIDShare = 1005, // 分享
BBAToolBarSystemItemIDRefresh = 1006, // 刷新
BBAToolBarSystemItemIDMore = 1007, // menu
// BBAToolBarSystemItemIDTTS = 1008, // tts
BBAToolBarSystemItemIDStopRefresh = 1009, // stop refresh
BBAToolBarSystemItemIDForward = 1010, // forward
BBAToolBarSystemItemIDFlexibleSpace = 1011, // 自动调节左右item间距,参照UIBarButtonSystemItemFlexibleSpace
BBAToolBarSystemItemIDFixedSpace = 1012, // 左右item间距是固定的,通过fixedSpaceWidth设置,参照UIBarButtonSystemItemFixedSpace
//下面两个尺寸是根据屏占比计算的,由于手百左右按钮距离两边距离是固定的,避免每次配置时先设置BBAToolBarSystemItemIDFixedSpace,然后设置fixedSpaceWidth
BBAToolBarSystemItemIDLeftToScreenEdgeSpace = 1013, //底bar最左边的按钮距离屏幕左边间距尺寸
BBAToolBarSystemItemIDRightToScreenEdgeSpace = 1014, //底bar最右边的按钮距离屏幕右边间距
BBAToolBarSystemItemIDUGCForward = 1016, // ugc转发 1015被占用
BBAToolBarSystemItemIDMultipleWindow= 1017, // 多窗口
BBAToolBarSystemItemIDMenu = 1018, // 菜单
BBAToolBarSystemItemIDClose = 1019, // 关闭按钮(关闭当前页面)
BBAToolBarSystemItemIDMenuPrivate = 1020, // 隐私菜单
BBAToolBarSystemItemIDRecommend = 1021, // 未推荐
BBAToolBarSystemItemIDRecommended = 1022, // 已推荐
BBAToolBarSystemItemIDMAX
}BBAToolBarSystemItemID;
/// 飘新动画类型,只支持评论飘新
typedef NS_ENUM(NSUInteger, BBAToolBarBadgeAnimationType) {
///无动画
BBAToolBarBadgeAnimationTypeNone = 0,
///爆炸
BBAToolBarBadgeAnimationTypeExplosion,
};
@interface BBAToolBarItem : NSObject
/*
barItemWithSystemID:函数只支持BBAToolBarSystemItemIDBack~BBAToolBarSystemItemIDFixedSpace,
如果自定义的itemID需要通过[[BBAToolBarItem alloc] init]初始化
*/
+ (nullable BBAToolBarItem *)barItemWithSystemID:(BBAToolBarSystemItemID)itemID
actionTarget:(id _Nullable)target
selector:(SEL _Nullable)action;
@property (nonatomic,retain,nullable) UIView *userCustomView; // 自定义组件
@property (nonatomic,assign) CGFloat fixedSpaceWidth; // 只有在itemID为BBAToolBarSystemItemIDFixedSpace起作用
@property (nonatomic,assign) NSUInteger itemID; // 每个BBAToolBarItem都应该有一个ID,自定义的ID不要和BBAToolBarSystemItemID相同,建议小于BBAToolBarSystemItemIDBack
// 切换过度动画相关
@property (nonatomic,strong,nullable) CAAnimation *appearAnimation; // item显示时候的动画
@property (nonatomic,strong,nullable) CAAnimation *disappearAnimation; // item消失时候的动画
@property (nonatomic,strong,nullable) UIView *animationView; // 指定做动画的view(userCustomView本身或者userCustomView的子view,如果空,默认userCustomView)
@property (nonatomic, copy, nullable) void(^beginAnimationBlock)(CAAnimation *_Nullable anim); // 动画开始回调
@property (nonatomic, strong, nullable) UIImageView *strongImageView;
@property (nonatomic, assign) BOOL disable;
@property (nonatomic, strong, readonly) UIView * _Nullable itemView;
@property (nonatomic, assign) BOOL showNewDot; // 是否展示飘新红点(没有文字), 优先级低于badgeValue
@property (nonatomic, copy, nullable) NSString *badgeValue; // 飘新的字符串,只支持系统自带的(BBAToolBarSystemItemIDBack ~ BBAToolBarSystemItemIDMore),如果是自定义控件飘新需要自己实现
@property (nonatomic, strong, nullable) BBABadgeValueView *badgeView; // 飘新
@property (nonatomic, assign) BBAToolBarBadgeAnimationType badgeAnimationType;
- (void)startBadgeAnimation;
- (BOOL)removeBubbleView;
- (void)changeBgStyle:(int)toolBarBackgroundStyle;
- (void)changeItemIcon:(nullable UIImage *)image;
//改变自己,变成另一个item(ICON和itemID),无动画,推荐用于自动同步数据状态
- (void)changeMySelfTo:(BBAToolBarSystemItemID)itemID;
//改变自己,变成另一个item(ICON和itemID),bigger :YES,正向动画(比如从未收藏变成收藏,等等),NO,负向动画(比如从收藏变成未收藏,等等),推荐用于用户用户点击操作变更状态
- (void)changeMySelfTo:(BBAToolBarSystemItemID)itemID isAnimateBigger:(BOOL)bigger;
@end