BBAPanelItem.h 1.89 KB
//
//  BBAPanelItem.h
//  BBAUIKit
//
//  Created by Guo,Zhaozhuo on 2020/3/16.
//  Copyright © 2020 Baidu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BBAPanelCommon.h"
/*!
 @brief    点击action事件回调
 */
typedef void (^BBAPanelActionHandler) (void);

@interface BBAPanelItem : NSObject

/// 唯一标示,只读,业务方可用来更新对应item
@property (nonatomic, readonly) NSString *identifier;
/// 名字
@property (nonatomic, strong)   NSString *displayName;
/// 文字颜色,如需要适配darkmode,请使用 textColor
@property (nonatomic, copy)     NSString *textColorHex;
/// 文字颜色
@property (nonatomic, strong)   UIColor *textColor;
/// 显示图片,与iconURL属性同时设置时,会作为iconURL加载的占位图
@property (nonatomic, strong)   UIImage  *icon;
/// 图片URL,资源加载的占位图为icon属性,icon属性为nil,则无占位图
@property (nonatomic, strong)   NSURL    *iconURL;
/// 红点飘新
@property (nonatomic, assign)   BOOL      hasBadge;
/// 数字/文字飘新
@property (nonatomic, copy)     NSString *badgeValue;
/// 12.1新增,面板内cell飘数字的精度类型
@property (nonatomic, assign) BBAPanelBadgeValuePrecisionType badgeValuePrecisionType;
/// 点击事件block
@property (nonatomic, copy)     BBAPanelActionHandler actionHandler;
/// 是否禁止点击,默认不禁止YES
@property (nonatomic, assign)   BOOL     enabled;
/// 点击后是否面板消失,默认消失YES
@property (nonatomic, assign)   BOOL     dismissPanel;

/*!
 @method
 @brief 初始化函数,返回一个action 实例对象
 @param displayName 默认名字
 @param icon        图片
 @param handler     点击事件回调block
*/
- (instancetype)initWithDisplayName:(NSString *)displayName
                               icon:(UIImage *)icon
                      actionHandler:(BBAPanelActionHandler)handler;

@end