BBAPanelGroupedGridView.h 1.5 KB
//
//  BBAPanelGroupedGridView.h
//  BBAUIKit
//
//  Created by Guo,Zhaozhuo on 2020/3/30.
//  Copyright © 2020 Baidu. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BBAPanelCommon.h"
#import "BBAPanelItem.h"
#import "BBAPanelGridGroupModel.h"
#import "BBAPanelGridView.h"
#import "BBAPanelConfigModel.h"

@protocol BBAGridPanelViewDelegate <NSObject>

- (void)gridViewWillDisplayItemView:(UIView *)itemView
                        itemInGroup:(NSInteger)groupIndex
                    itemAtIndexPath:(NSIndexPath *)indexPath;

- (void)gridViewDidEndDisplayItemView:(UIView *)itemView
                          itemInGroup:(NSInteger)groupIndex
                      itemAtIndexPath:(NSIndexPath *)indexPath;

@end

@interface BBAPanelGroupedGridView : UIView

@property (nonatomic, copy) BBAPanelGridItemDidSelectCallBack itemDidSelected;

/// 网格布局面板的代理
@property (nonatomic, weak) id<BBAGridPanelViewDelegate> gridViewDelagate;

- (instancetype)initWithFrame:(CGRect)frame
                  groupModels:(NSArray <BBAPanelGridGroupModel *> *) groupModels
                       config:(BBAPanelConfigModel *)config;

/// 更新所有数据
- (void)reloadData;

/// 更新传入部分数据
- (void)reloadItems:(NSArray *)items;

/// 主动获取指定item视图
/// @return 返回指定位置的item的内容区域视图
/// @param groupIndex item所在的groupIndex
/// @param indexPath item的indexPath
- (UIView *)gridItemViewAtGroup:(NSInteger)groupIndex indexPath:(NSIndexPath *)indexPath;

@end