CGXHotBrandViewOC 0.0.8

CGXHotBrandViewOC 0.0.8

974794055 维护。



  • 作者:
  • 974794055

CGXHotBrandView-OC

platform languages cocoapods support

热门菜单

功能:

  • 模拟淘宝、京东等主流应用程序热门菜单切换的滚动视图

优点:

  • 1、提供更全面、更丰富的效果,支持高度自定义;
  • 2、使用子类化管理 cell 样式,逻辑更清晰,扩展更简单;
  • 3、高度封装列表容器,使用便捷,完美支持列表的生命周期调用;
  • 4、角标提醒;

效果预览

效果预览图

说明 动画
热门菜单
Appstore滚动

要求

  • iOS 8.0+
  • Xcode 9+
  • Objective-C

安装

手动

  • 克隆代码,将CGXHotBrandViewOC文件夹拖入项目中,#import "CGXHotBrandViewOC.h"即可使用;

CocoaPods

target '<Your Target Name>' do
    pod 'CGXHotBrandViewOC'
end
  • 首先执行pod repo update,然后执行pod install
  • 导入头文件 #import <CGXHotBrandViewOC/CGXHotBrandViewOC.h> 即可使用;

结构图

使用

CGXHotBrandView使用示例

  • 1. 初始化CGXHotBrandView
CGXHotBrandView *hotBrandView = [[CGXHotBrandView alloc] init];
hotBrandView.delegate = self;
hotBrandView.minimumLineSpacing = 5;
hotBrandView.minimumInteritemSpacing = 5;
hotBrandView.edgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
hotBrandView.itemSectionCount = 2;
hotBrandView.itemRowCount = 5;
hotBrandView.pagingEnabled = YES;
hotBrandView.itemSectionCount = 2;
hotBrandView.itemRowCount = 5;
hotBrandView.pageHeight = 10;
hotBrandView.bounces = YES;
CGFloat height = (ScreenHeight-kTabBarHeight-kTopHeight-40)/3.0;
hotBrandView.frame = CGRectMake(0, 10,ScreenWidth,height);
hotBrandView.backgroundColor = [UIColor colorWithWhite:0.93 alpha:1];
[self.view addSubview:hotBrandView];
hotBrandView.hotBrand_loadImageCallback = ^(UIImageView * _Nonnull hotImageView, NSURL * _Nonnull hotImageURL) {
    [hotImageView sd_setImageWithURL:hotImageURL];
};
  • 2. 配置CGXHotBrandView数据的属性
hotBrandView.tag = 10000+i;
NSMutableArray *dataArray = [NSMutableArray array];
for (int i = 0; i< 4; i++) {
    NSMutableArray *rowArray = [NSMutableArray array];
    for (int j = 0; j< hotBrandView.itemSectionCount*hotBrandView.itemRowCount; j++) {
        CGXHotBrandModel *model = [[CGXHotBrandModel alloc] init];
        model.titleStr = [NSString stringWithFormat:@"猫咪%d-%d",i,j];
        model.itemColor = [UIColor whiteColor];
        model.hotPicStr = @"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3547703274,3363083080&fm=11&gp=0.jpg";
        [rowArray addObject:model];
    }
    [dataArray addObject:rowArray];
}
[hotBrandView updateWithDataArray:dataArray];
  • 3. 可选实现CGXHotBrandBaseViewDelegate代理
/*点击cell*/
- (void)gx_hotBrandBaseView:(CGXHotBrandBaseView *)hotView DidSelectItemAtModel:(CGXHotBrandModel *)hotModel;
// ========== 轮播自定义cell ==========
/** 如果你需要自定义cell样式,请在实现此代理方法返回你的自定义cell的class。 */
- (Class)gx_hotBrandCellClassForBaseView:(CGXHotBrandBaseView *)hotView;
/** 如果你需要自定义cell样式,请在实现此代理方法返回你的自定义cell的Nib。 */
- (UINib *)gx_hotBrandCellNibForBaseView:(CGXHotBrandBaseView *)hotView;
  • 4. 自定义cell实现CGXHotBrandUpdateCellDelegate代理方法

无论列表是UIView还是UIViewController都可以,提高使用灵活性,更方便现有的业务接入。

- (void)updateWithHotBrandCellModel:(CGXHotBrandModel *)cellModel Section:(NSInteger)section Row:(NSInteger)row

补充

如果刚开始使用CGXHotBrandViewOC,当开发过程中需要支持某种特性时,请务必先搜索使用文档或源代码。确认是否已经实现支持了所需的特性。

该仓库保持随时更新,对于主流新的分类选择效果会第一时间支持。使用过程中,如有任何建议或问题,可以通过以下方式联系我:
邮箱:[email protected]
QQ群:

喜欢就star❤️支持一下吧

许可协议

CGXHotBrandViewOC 以 MIT 许可协议发布。