仿淘寶、京東熱門Banner

仿淘寶、京東、美團(tuán)等主流App等主流菜單輪播圖、Banner

一、封裝熱門滾動(dòng)菜單,已經(jīng)支持pod下載 ,請(qǐng)更新pod版本庫

  • 最新版本:0.0.6
  • OC版本:
    - pod搜索:pod search CGXHotBrandViewOC
    - 如果搜不到去請(qǐng)搜索:pod search CGXHotBrandViewOC --simple
  • 詳情 CGXHotBrandViewOC庫

二、效果圖

hotBrand1.gif

hotBrand2.gif

hotBrand3.gif

hotBrand4.gif

hotBrand5.gif

hotBrand6.gif

hotBrand7.gif

hotBrand8.gif

hotBrand9.gif

hotBrand10.gif

三、使用說明

  • 1、初始化CGXHotBrandView
        CGXHotBrandView *hotBrandView = [[CGXHotBrandView alloc] init];
        hotBrandView.delegate = self;
        hotBrandView.dataSource =self;
        hotBrandView.minimumLineSpacing = 5;
        hotBrandView.minimumInteritemSpacing = 5;
        hotBrandView.edgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
        hotBrandView.itemSectionCount = 2;
        hotBrandView.itemRowCount = 5;
        if (i==0) {
            hotBrandView.pagingEnabled = YES;
            hotBrandView.itemSectionCount = 2;
            hotBrandView.itemRowCount = 5;
        } else if(i==1){
            hotBrandView.pagingEnabled = YES;
            hotBrandView.itemSectionCount = 2;
            hotBrandView.itemRowCount = 6;
        }else{
            hotBrandView.pagingEnabled = NO;
        }
        hotBrandView.bounces = YES;
        //        hotBrandView.isHavePage = NO;
        CGFloat height = (ScreenHeight-kTabBarHeight-kTopHeight-40)/3.0;
        hotBrandView.frame = CGRectMake(0, 10*(i+1) + i*height,ScreenWidth,height);
        hotBrandView.backgroundColor = [UIColor colorWithWhite:0.93 alpha:1];
        [self.view addSubview:hotBrandView];
        hotBrandView.pageHeight = 10;
        hotBrandView.tag = 10000+i;
        hotBrandView.showType = i+1;
        hotBrandView.isAnimation = i==1 ? NO:YES;
        
  • 2.配置CGXHotBrandView數(shù)據(jù)的屬性
NSMutableArray *dataArray = [NSMutableArray array];
        for (int j = 0; j< 4; j++) {
            NSMutableArray *rowArray = [NSMutableArray array];
            for (int k = 0; k< hotBrandView.itemSectionCount*hotBrandView.itemRowCount; k++) {
                CGXHotBrandModel *model = [[CGXHotBrandModel alloc] init];
                model.titleStr = [NSString stringWithFormat:@"貓咪%d-%d",j,k];
                model.itemColor = [UIColor whiteColor];
                model.hotPicStr = imageArray[arc4random() % (imageArray.count)];
                model.tagStr = (arc4random() % 2 == 0) ? @"秒殺":@"";
                model.tagSpace = 10;
                [rowArray addObject:model];
            }
            [dataArray addObject:rowArray];
        }
        [hotBrandView updateWithDataArray:dataArray];
  • 3.可選實(shí)現(xiàn)CGXHotBrandCustomViewDelegate代理
// ========== 輪播自定義cell ==========
/** 如果你需要自定義cell樣式,請(qǐng)?jiān)趯?shí)現(xiàn)此代理方法返回你的自定義cell的class。 */
- (Class)gx_hotBrandCellClassForBaseView:(CGXHotBrandBaseView *)hotView;
/** 如果你需要自定義cell樣式,請(qǐng)?jiān)趯?shí)現(xiàn)此代理方法返回你的自定義cell的Nib。 */
- (UINib *)gx_hotBrandCellNibForBaseView:(CGXHotBrandBaseView *)hotView;
  • 4.可選實(shí)現(xiàn)CGXHotBrandViewDataSource代理
/* : 輪播自定義cell 如果設(shè)置多個(gè)當(dāng)根據(jù)tag值判斷時(shí), 先設(shè)置tag再設(shè)置delegate */
/** 如果你需要自定義cell樣式,請(qǐng)?jiān)趯?shí)現(xiàn)此代理方法返回你的自定義cell的class。 */
- (Class)gx_hotBrandCellClassForBaseView:(CGXHotBrandBaseView *)hotView;
/** 如果你需要自定義cell樣式,請(qǐng)?jiān)趯?shí)現(xiàn)此代理方法返回你的自定義cell的Nib。 */
- (UINib *)gx_hotBrandCellNibForBaseView:(CGXHotBrandBaseView *)hotView;
/*點(diǎn)擊cell*/
- (void)gx_hotBrandBaseView:(CGXHotBrandBaseView *)hotView
   didSelectItemAtIndexPath:(NSIndexPath *)indexPath
                    AtModel:(CGXHotBrandModel *)hotModel;
/*滾動(dòng)結(jié)束cell CGXHotBrandCycleView、CGXHotBrandView無效  */
- (void)gx_hotBrandBaseView:(CGXHotBrandBaseView *)hotView
      ScrollEndItemAtIndexPath:(NSIndexPath *)indexPath
                    AtModel:(CGXHotBrandModel *)hotModel;
/* cell數(shù)據(jù)交互處理*/
- (void)gx_hotBrandBaseView:(CGXHotBrandBaseView *)hotView
     cellForItemAtIndexPath:(NSIndexPath *)indexPath
                     AtCell:(UICollectionViewCell *)cell
                    AtModel:(CGXHotBrandModel *)hotModel;
/* 正在滾動(dòng) */
- (void)gx_hotBrandBaseView:(CGXHotBrandBaseView *)hotView
              ScrollAtPoint:(UIScrollView *)scrollView;

  • 5.自定義cell實(shí)現(xiàn)CGXHotBrandUpdateCellDelegate代理方法
- (void)updateWithHotBrandCellModel:(CGXHotBrandModel *)cellModel Section:(NSInteger)section Row:(NSInteger)row
  • 6、將不斷更新更多效果 ,敬請(qǐng)期待?。?!
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
禁止轉(zhuǎn)載,如需轉(zhuǎn)載請(qǐng)通過簡(jiǎn)信或評(píng)論聯(lián)系作者。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容