// // JXtopShowVIew.m // shiku_im // // Created by 123 on 2020/5/21. // Copyright © 2020 Reese. All rights reserved. // #import "JXtopShowVIew.h" #import "JXLabelObject.h" @interface JXtopShowVIew() @property (weak, nonatomic) IBOutlet UIView *topRightView; /** 期数*/ @property (weak, nonatomic) IBOutlet UILabel *qishuL; /**球的IMG*/ @property (weak, nonatomic) UIView *qiuIMG; @property (nonatomic,weak) UIView *saiziView; @property (weak, nonatomic) IBOutlet UILabel *hezhiLL; @property (nonatomic,copy) NSString *indexSubType; @property (nonatomic,copy) NSString *indexCarSubType; @property (nonatomic,strong) UIImageView *shaiziIMG; @property (nonatomic,weak) UIScrollView *topScorllView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *hezhiConstraitH; /**底部View*/ @property (weak, nonatomic) IBOutlet UIView *bottomView; @property (weak, nonatomic) IBOutlet UIButton *kaijjieguoBtn; @property (nonatomic,weak) UIButton *titBtn; @property (nonatomic,strong) NSMutableArray *dataArr2; @end @implementation JXtopShowVIew +(instancetype)xibJXtopShowVIew{ return [[NSBundle mainBundle]loadNibNamed:@"JXtopShowVIew" owner:self options:nil].firstObject; } -(void)awakeFromNib{ [super awakeFromNib]; _dataArr2=[NSMutableArray array]; _caizongBtn.layer.cornerRadius=8; _caizongBtn.layer.masksToBounds=YES; _tebieBtn.layer.cornerRadius=8; _tebieBtn.layer.masksToBounds=YES; _topRightView.layer.cornerRadius=8; _topRightView.layer.masksToBounds=YES; _kaijjieguoBtn.layer.cornerRadius=8; _kaijjieguoBtn.layer.masksToBounds=YES; //[g_notify addObserver:self selector:@selector(act_UserRoomAttention:) name:@"act_UserRoomAttention" object:nil]; } -(void)setSelectItemModel:(JLSelectItemModel *)selectItemModel{ _selectItemModel=selectItemModel; [_qiuIMG removeFromSuperview]; UIView *qiuIMG = [[UIView alloc]init]; qiuIMG.hidden=YES; [_topRightView addSubview:qiuIMG]; self.qiuIMG=qiuIMG; [qiuIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(_topRightView.mas_centerY); make.left.mas_equalTo(_qishuL.mas_right).mas_offset(8); make.right.mas_equalTo(_hezhiLL.mas_left).mas_offset(-5); make.height.mas_equalTo(20); }]; [_saiziView removeFromSuperview]; UIView *saiziView = [[UIView alloc]init]; saiziView.hidden=YES; [_topRightView addSubview:saiziView]; self.saiziView=saiziView; [saiziView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(_topRightView.mas_centerY); make.left.mas_equalTo(_qishuL.mas_right).mas_offset(8); make.right.mas_equalTo(_hezhiLL.mas_left).mas_offset(-5); make.height.mas_equalTo(20); }]; NSLog(@"选择 %@",selectItemModel.subType); if ([selectItemModel.subType intValue]==2) { _indexCarSubType=@""; _indexSubType=selectItemModel.content; NSArray *imagesArr=[_indexSubType componentsSeparatedByString:@":"]; _qishuL.text = [imagesArr firstObject]; _hezhiLL.text=[imagesArr lastObject]; }else if ([selectItemModel.subType intValue]==3) { //赛车 _indexSubType=@""; _indexCarSubType=selectItemModel.content; NSArray *imagesArr=[_indexCarSubType componentsSeparatedByString:@":"]; _qishuL.text = [imagesArr firstObject]; _hezhiLL.text=[imagesArr lastObject]; }else if ([selectItemModel.subType intValue]==4) { //标黄色 _indexCarSubType=@""; _indexSubType=@""; NSArray *titleContent= [selectItemModel.content componentsSeparatedByString:@":"]; NSMutableAttributedString *hintString1=[[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@%@%@",[titleContent firstObject],titleContent[1] ,[titleContent lastObject]]]; NSRange range2=[[hintString1 string]rangeOfString:titleContent[1]]; [hintString1 addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:range2]; _qishuL.attributedText = hintString1; _hezhiLL.text=[titleContent lastObject]; self.hezhiConstraitH.constant=140+40; _saiziView.hidden=YES; _qiuIMG.hidden=YES; }else{ _qishuL.text = selectItemModel.content; _saiziView.hidden=YES; _qiuIMG.hidden=YES; self.hezhiConstraitH.constant=140+40; } //CGFloat qishuSize=[self titleBtnWight:_qishuL.text and:_qishuL].width; if (_indexCarSubType.length>0) { _saiziView.hidden=NO; _qiuIMG.hidden=YES; NSArray *imagesArr=[_indexCarSubType componentsSeparatedByString:@":"]; NSArray *numberS=[imagesArr[1] componentsSeparatedByString:@","]; self.hezhiConstraitH.constant=45+numberS.count*21+40; for (int i=0; i0) { _saiziView.hidden=YES; _qiuIMG.hidden=NO; NSArray *imagesArr=[_indexSubType componentsSeparatedByString:@":"]; NSArray *numberS=[imagesArr[1] componentsSeparatedByString:@","]; self.hezhiConstraitH.constant=45+numberS.count*21+40; for (int i=0; i