// // YOUPAILCBoardDetailHeadView.m // LiveChat // // Created by 张灿 on 2018/9/26. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCBoardDetailHeadView.h" #import "YOUPAILZUserShowVC.h" @interface YOUPAILCBoardDetailHeadView() @property(nonatomic,assign)NSInteger youpaiptype; @property(nonatomic,strong)NSMutableArray* youpaipheadArray; @property(nonatomic,assign)NSInteger youpaipselectIndex; @property(nonatomic,strong)UIImageView* youpaipbackImgV; @property(nonatomic,strong)NSMutableArray* youpaipheadViewArray; @end @implementation YOUPAILCBoardDetailHeadView - (instancetype)initWithFrame:(CGRect)frame headArray:(NSMutableArray*)headArray selectIndex:(NSInteger)index andType:(NSInteger)type{ if (self = [super initWithFrame:frame]) { self.youpaiptype = type; self.youpaipselectIndex = index; self.youpaipheadArray = headArray; self.youpaipheadViewArray = [NSMutableArray array]; [self youpaifsetupView]; } return self; } - (void)youpaifupdateHeadArray:(NSMutableArray*)headArray selectIndex:(NSInteger)index{ self.youpaipselectIndex = index; self.youpaipheadArray = headArray; [self youpaifupdateView]; } - (void)youpaifsetupView{ UIImageView *topImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,KScreenWidth,35)]; topImgView.image = [UIImage imageNamed:@"vqu_images_top_base"]; [self addSubview:topImgView]; self.youpaipbackImgV = [[UIImageView alloc]initWithFrame:CGRectMake(0,35, KScreenWidth,KScreenWidth*281/375.0)]; self.youpaipbackImgV.contentMode = UIViewContentModeScaleAspectFill; self.youpaipbackImgV.image = [UIImage imageNamed:@"vqu_images_ic_list"]; self.youpaipbackImgV.userInteractionEnabled = YES; [self addSubview:self.youpaipbackImgV]; ZCNavMenuView* menuView = [[ZCNavMenuView alloc]initWithFrame:CGRectMake((KScreenWidth - 250)/2.0, 0, 250, 35) TitleArr:@[@"日榜",@"周榜",@"月榜",@"总榜"] normalFont:LCBoldFont(13) normalColor:HexColorFromRGB(0xffffff) selectFont:LCBoldFont(14) selectColor:HexColorFromRGB(0xffffff) selectLineColor:HexColorFromRGBA(0xffffff,1.0) currentIndex:self.youpaipselectIndex]; menuView.delegate = self; self.youpaipmenuView = menuView; [self addSubview:self.youpaipmenuView]; UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((KScreenWidth - 200)/2.0, 0, 200, 35)]; titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.textColor = HexColorFromRGB(0xffffff); titleLabel.font = LCBoldFont(14); self.youpaiptitleLabel = titleLabel; [self addSubview:self.youpaiptitleLabel]; if (self.youpaiptype == 6) { [LCHttpHelper requestWithURLString:GetRankTab parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 NSString *bole_title = [NSString stringWithFormat:@"%@",[[dict objectForKey:@"data"] objectForKey:@"bole_title"]]; titleLabel.text = bole_title; } } failure:^(NSError *error) {}]; } } - (void)youpaifupdateView{ //self.segment.selectedSegmentIndex = self.selectIndex; [self.youpaipmenuView changeCurrentSelectButton:self.youpaipselectIndex]; for (UIView* view in self.youpaipheadViewArray) { [view removeFromSuperview]; } if (self.youpaipheadArray.count>0) { for (int i =0; i