// // NewFenLeiViewController.m // jitao // // Created by 罗云飞 on 2018/8/31. // Copyright © 2018年 罗云飞. All rights reserved. // #import "NewFenLeiViewController.h" //#import "FLZLCell.h" //#import "FLZLTableViewCell.h" #import "NewFWXMViewController.h" @interface NewFenLeiViewController (){ UITableView *newtableView; UITableView *newtableView1; NSMutableArray *dataArr1; NSMutableArray *dataArr2; NSMutableArray *dataArr3; NSMutableArray *dataArr; NSMutableArray *nameArr; NSMutableArray *nameArr1; NSMutableArray *isOpenArr; NSMutableArray *SelectArr; } @end @implementation NewFenLeiViewController - (void)viewDidLoad { [super viewDidLoad]; [self setNavTitle:@"科技项目分类"]; [self loaddata]; [self networkRequest]; [self loadUI]; // Do any additional setup after loading the view. } - (void)loaddata{ dataArr1 = NewMutableArrayInit; dataArr2 = NewMutableArrayInit; dataArr3 = NewMutableArrayInit; isOpenArr = NewMutableArrayInit; SelectArr = NewMutableArrayInit; dataArr = NewMutableArrayInit; nameArr = NewMutableArrayInit; nameArr1 = NewMutableArrayInit; } - (void)networkRequest { NSMutableDictionary *parameters = NewMutableDictionaryInit; [NetworkRequestManager requestGetWithInterfacePrefix:JT_NewcategoryList parameters:parameters onSuccess:^(id requestData) { if ([requestData[@"error"] count] !=0) { for (NSDictionary *dic in requestData[@"error"]) { [MBProgressHUD showError:dic[@"message"] toView:self.view]; } }else{ [dataArr3 removeAllObjects]; NSMutableArray *arr = [NSMutableArray arrayWithArray:requestData[@"data"]]; dataArr3 = [NSMutableArray arrayWithArray:requestData[@"data"]]; for (int i = 0; i0) { title.text = nameArr1[section]; } title.font = NewFont(14); title.textColor = NewButtonColor; [title setSingleLineAutoResizeWithMaxWidth:0]; [view addSubview:title]; title.sd_layout .leftSpaceToView(view, 20) .heightIs(55) .topEqualToView(view); UIImageView* stateImage=[[UIImageView alloc] init]; if (isOpenArr.count>0) { if ([[isOpenArr objectAtIndex:section] isEqualToString:@"open"]) { [stateImage setImage:[UIImage imageNamed:@"sectionOpen"]]; } else if ([[isOpenArr objectAtIndex:section] isEqualToString:@"close"]) { [stateImage setImage:[UIImage imageNamed:@"sectionClose"]]; } }else{ [stateImage setImage:[UIImage imageNamed:@"sectionClose"]]; } [view addSubview:stateImage]; stateImage.sd_layout .rightSpaceToView(view, 15) .heightIs(7) .widthIs(13) .centerYEqualToView(view); UIButton *button = [UIButton new]; NewTouchUpInside(button, buttonclick:); button.tag = 100+section; [view addSubview:button]; button.sd_layout .leftEqualToView(view) .rightEqualToView(view) .topEqualToView(view) .bottomEqualToView(view); UILabel *line = [UILabel new]; line.backgroundColor = NewLineGrayColor; [view addSubview:line]; line.sd_layout .leftEqualToView(view) .rightEqualToView(view) .heightIs(1) .bottomEqualToView(view); return view; } } - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { return [[UIView alloc] init]; } - (void)buttonclick:(UIButton *)sender { NSString* state=[isOpenArr objectAtIndex:sender.tag-100]; if ([state isEqualToString:@"open"]) { state=@"close"; }else { state=@"open"; } isOpenArr[sender.tag-100]=state; NSIndexSet *indexSet = [[NSIndexSet alloc] initWithIndex:sender.tag-100]; [newtableView1 reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end