健康测评

#import "multimoveViewController.h"

#import "bubbleonecell.h"

#import "bubbletwocell.h"

#import "bubbleModel.h"

#import "bubbleinsideModel.h"

#import "bubblethreecell.h"

#import "bubblepassModel.h"

#import "chatViewController.h"

@interface multimoveViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView *onetableview;

@property(nonatomic,strong)bubbleModel *outmodel;

@property(nonatomic,strong)bubbleinsideModel *insidemodel;

//@property(nonatomic,strong)NSMutableArray<fayuceping*>*fayucepingModels;

@property(nonatomic,strong)NSMutableArray<bubbleModel *>*bubbleModels;

@property(nonatomic,strong)NSMutableArray<bubbleinsideModel*>*bubbleinsideModels;

@property(nonatomic,strong)NSMutableArray<bubblepassModel*>*bubblepassmodels;

@property(nonatomic,strong)NSIndexPath* indexrow;

@property(nonatomic,strong)NSMutableArray *modelarray;

@property(nonatomic,strong)NSArray *butTitles;

@property(nonatomic,strong)UIScrollView *scroller;

@property(assign,nonatomic)CGFloat butwidth;

@property(nonatomic,strong)bubblepassModel *passModel;

//@property(nonatomic,assign)NSInteger i;

@end


static int i=0;

@implementation multimoveViewController

-(NSMutableArray<bubblepassModel*>*)bubblepassmodels{

 if (_bubblepassmodels==nil) {

  _bubblepassmodels = [NSMutableArray array];

 }

 return _bubblepassmodels;

}

-(NSMutableArray<bubbleModel*>*)bubbleModels{

 if (_bubbleModels==nil) {

  _bubbleModels = [NSMutableArray array];

 }

 return _bubbleModels;

}

-(NSMutableArray<bubbleinsideModel*>*)bubbleinsideModels{

 if (_bubbleinsideModels==nil) {

  _bubbleinsideModels = [NSMutableArray array];

 }

 return _bubbleinsideModels;

}

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view.

 self.navigationController.navigationBar.hidden = NO;

 self.automaticallyAdjustsScrollViewInsets = NO;

 //self.navigationItem.title = @"多动症测试";

 self.navigationItem.title = _titlestr;

 self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColor colorWithRed:51.0/255 green:51.0/255 blue:51.0/255 alpha:1]};

 //去掉导航栏下边的线

 self.navigationController.navigationBar.tintColor = [UIColor grayColor];

 [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -36)

                                                      forBarMetrics:UIBarMetricsDefault];

 

 _butTitles = @[@"A",@"B",@"C",@"D"];

 _onetableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-60) style:UITableViewStylePlain];

 _onetableview.delegate = self;

 _onetableview.dataSource = self;

 _onetableview.separatorStyle = UITableViewCellSelectionStyleNone;

 _onetableview.backgroundColor = [UIColor colorWithRed:242.0/255 green:242.0/255 blue:242.0/255 alpha:1];

 [self.view addSubview:_onetableview];

 _onetableview.tableFooterView = [[UIView alloc]init];

 _startBtn = [[UIButton alloc]init];

 _startBtn.backgroundColor = [UIColor colorWithRed:250.0/255 green:140.0/255 blue:122.0/255 alpha:1];

 [_startBtn setTitle:@"开始" forState:UIControlStateNormal];

 [_startBtn addTarget:self action:@selector(clickstart) forControlEvents:UIControlEventTouchUpInside];

 _startBtn.tag = 0;

 [self.view addSubview:_startBtn];

 [_startBtn mas_makeConstraints:^(MASConstraintMaker *make) {

  make.left.mas_equalTo(5 *screenRation);

  make.bottom.mas_equalTo(-5 *screenRation);

  make.right.mas_equalTo(-5 *screenRation);

  make.height.mas_equalTo(80 *screenRation);

 }];

 _redview = [[UIView alloc]init];

 //redview.backgroundColor = [UIColor redColor];

 _redview.backgroundColor = [UIColor colorWithRed:242.0/255 green:242.0/255 blue:242.0/255 alpha:1];

 _redview.hidden = YES;

 [self.view addSubview:_redview];

 [_redview mas_makeConstraints:^(MASConstraintMaker *make) {

  make.left.mas_equalTo(0);

  make.bottom.mas_equalTo(0);

  make.right.mas_equalTo(0);

  make.height.mas_equalTo(50);

 }];

 CGFloat btnwidth = ([UIScreen mainScreen].bounds.size.width-100)/4;

 for (int i = 0; i < 4; i++) {

  _bottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];

  [_bottomBtn setTitle:_butTitles[i] forState:UIControlStateNormal];

  [_bottomBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

  _bottomBtn.backgroundColor = [UIColor colorWithRed:250.0/255 green:140.0/255 blue:122.0/255 alpha:1];

  _bottomBtn.tag = i;

  [_bottomBtn addTarget:self action:@selector(clickbottomBtn:) forControlEvents:UIControlEventTouchUpInside];

  _bottomBtn.frame = CGRectMake(20 +i *(btnwidth+20), 10, btnwidth, 30);

  [_redview addSubview:_bottomBtn];

 }

 NSString *urlstring = @"http://yf.xnetyy.com/PhoneApi/ZtApi/get_test_list";

 NSMutableDictionary *parmas = [NSMutableDictionary dictionary];

 parmas[@"type"]=_id;

 NSLog(@"输出typeid的值:%@",_id);

 [NSObject POST:urlstring parameters:parmas progress:^(NSProgress *downloadProgress) {


 } completionHandler:^(id responseObj, NSError *error) {

  //NSLog(@"判断输出响应的值:%@",responseObj);

  NSArray *array = responseObj[@"data"];

  NSMutableArray *modelarray = [NSMutableArray array];

  for (NSDictionary *dic in array) {

   bubbleModel *bModel = [bubbleModel mj_objectWithKeyValues:dic];

   NSLog(@"输出bModel.fengmian:%@",bModel.fengmian);

   NSArray *array = dic[@"check_answer"];

   bModel.bubblearray = [NSMutableArray array];

   for (NSDictionary *dit in array) {

    bubbleinsideModel *insidemode = [bubbleinsideModel mj_objectWithKeyValues:dit];

    [bModel.bubblearray addObject:insidemode.check];

   }

   [modelarray addObject:bModel];

  }

  self.bubbleModels = modelarray;

  [self.onetableview reloadData ];

 }];

#pragma mark点击继续测试

 

 _goonBtn = [[UIButton alloc]init];

 _goonBtn.backgroundColor = [UIColor colorWithRed:250.0/255 green:140.0/255 blue:122.0/255 alpha:1];

 [_goonBtn setTitle:@"继续测试" forState:UIControlStateNormal];

 [_goonBtn addTarget:self action:@selector(goontest:) forControlEvents:UIControlEventTouchUpInside];

 _goonBtn.tag = 0;

 _goonBtn.hidden = YES;

 [self.view addSubview:_goonBtn];

 [_goonBtn mas_makeConstraints:^(MASConstraintMaker *make) {

  make.left.mas_equalTo(5 *screenRation);

  make.bottom.mas_equalTo(-5 *screenRation);

  make.right.mas_equalTo(-5 *screenRation);

  make.height.mas_equalTo(80 *screenRation);

 }];

 self.onetableview.mj_header= [MJRefreshNormalHeader headerWithRefreshingBlock:^{

  [self updateDate];

 }];

}

-(void)updateDate{

 _bubblepassmodels = nil;

 [self.onetableview reloadData];

 [self.onetableview.mj_footer endRefreshing];

}

-(void)goontest:(UIButton *)sender{

 self.bubblepassmodels = nil;

 [self.onetableview reloadData];

 self.goonBtn.hidden = YES;

}


//四个按钮

-(void)clickbottomBtn:(UIButton *)sender{

 if (sender.tag==0) {

  _abcdstr = @"A";

 }else if (sender.tag==1){

  _abcdstr = @"B";

 }else if (sender.tag==2){

  _abcdstr = @"C";

 }else if (sender.tag==3){

  _abcdstr = @"D";

 }

 //NSLog(@"输出abcdstr的值:%@",_abcdstr);

 NSInteger b = self.bubbleModels.count;

 NSInteger a =i++;

 if (a < b) {

  bubbleModel *bModel = self.bubbleModels[a];

 // NSLog(@"输出bModel.passarray:%@",bModel.bubblearray);

  bubblepassModel *passmodel = [[bubblepassModel alloc]init];

  passmodel.title = bModel.title;

  passmodel.abcdstr = _abcdstr;

  passmodel.passarray = bModel.bubblearray;

  [self.bubblepassmodels addObject:passmodel];

  [self.onetableview reloadData];

  //[self.onetableview setContentOffset:CGPointMake(0, 0) animated:NO];

  if (self.bubblepassmodels.count !=0) {

   [self.onetableview scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.bubblepassmodels.count+1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

  }

  

 }else{

  bubblepassModel *passModel = [[bubblepassModel alloc]init];

  passModel.title = @"正在为你分析测试结果";

  [self.bubblepassmodels addObject:passModel];

  [self.onetableview reloadData];

  self.goonBtn.hidden = NO;

 }

}

//点击开始按钮

-(void)clickstart{

 //NSLog(@"点击开始");

 _startBtn.hidden = YES;

 _redview.hidden = NO;

 bubbleModel *bubblemodel =self.bubbleModels[0];

 bubblepassModel *passmodel = [[bubblepassModel alloc]init];

 passmodel.title = bubblemodel.title;

 [self.bubblepassmodels addObject:passmodel];

 [self.onetableview reloadData];


}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

 return 1;

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

// NSLog(@"看一下self.bubbleModels.count的值:%lu",(unsigned long)self.bubbleModels.count);

 return 2 +self.bubblepassmodels.count;

}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

 if (indexPath.section==0&&indexPath.row==0) {

  bubbleonecell *onecell = [bubbleonecell cellWithTableView:tableView];

  return onecell;

 }else if (indexPath.section==0&&indexPath.row==1){

  bubbletwocell *twocell = [bubbletwocell cellWithTableView:tableView];

  return twocell;

 }

 bubblethreecell *threecell = [bubblethreecell cellWithTableView:tableView];

 threecell.selectionStyle = UITableViewCellSelectionStyleNone;

 bubblepassModel *passModel = self.bubblepassmodels[indexPath.row-2];

 [threecell setBubblepassModel:passModel];

 threecell.zixunpress = ^(UITapGestureRecognizer *sender) {

  chatViewController *chatview = [[chatViewController alloc]init];

  chatview.title = @"123";

  chatview.conversationType = ConversationType_PRIVATE;

  chatview.targetId = @"10086";

  chatview.navigationController.navigationBar.tintColor = [UIColor whiteColor];

  [chatview.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"sk2"] forBarMetrics:UIBarMetricsDefault];

  [self.navigationController pushViewController:chatview animated:YES];

 };

 return threecell;

 

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

 if (indexPath.row==0) {

  bubbleonecell *onecell = [bubbleonecell cellWithTableView:tableView];

  return onecell.cellheight;

 }else if (indexPath.row==1){

  bubbletwocell *twocell = [bubbletwocell cellWithTableView:tableView];

  return twocell.cellheight;

 }

 return 350;

}


@end


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值