ifish/Ifish/controllers/HotBar/IfishHotBarVc.m

128 lines
3.6 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// IfishHotBarVc.m
// Ifish
//
// Created by 罗艺 on 2018/8/22.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "IfishHotBarVc.h"
#import "IFishHotBarCell.h"
#import "IfishHotBarVo.h"
#import "IFishWaterChangeView.h"
#import "UIView+GetView.h"
#import "IfishHistoryView.h"
#define HOTBARCELL @"hotBarCell"
@interface IfishHotBarVc ()<UITableViewDelegate,UITableViewDataSource,ChangeWaterDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic,strong)NSMutableArray*datas;
@property(nonatomic,strong)IFishWaterChangeView*changeWaterView;
@property(nonatomic,strong)IfishHistoryView*historyView;
@end
@implementation IfishHotBarVc
-(IfishHistoryView *)historyView{
if (_historyView==nil) {
_historyView=[IfishHistoryView getView];
_historyView.frame=self.view.bounds;
[self.view addSubview:_historyView];
}
_historyView.hidden=NO;
return _historyView;
}
-(IFishWaterChangeView *)changeWaterView{
if(_changeWaterView==nil){
_changeWaterView=[IFishWaterChangeView getView];
_changeWaterView.frame=self.view.bounds;
[self.view addSubview:_changeWaterView];
// [_changeWaterView.picker reloadAllComponents];
_changeWaterView.myDelegate=self;
}
_changeWaterView.hidden=NO;
return _changeWaterView;
}
-(void)didSelectRow1:(NSString *)v andRow2:(NSString *)v2{
NSString*str=[NSString stringWithFormat:@"换水周期 %@ 天 %@",v,v2];
IfishHotBarVo*vo=self.datas[4];
vo.title=str;
[self.tableView reloadData];
}
-(NSMutableArray *)datas{
if (_datas==nil) {
_datas=[NSMutableArray array];
IfishHotBarVo*vo=[[IfishHotBarVo alloc]init];
vo.title=@"设置水温";
vo.iconUrl=@"温度图标";
vo.isShowArrow=YES;
vo.subTitle=@"";
[_datas addObject:vo];
IfishHotBarVo*vo1=[[IfishHotBarVo alloc]init];
vo1.title=@"鱼缸容量 1000L";
vo1.iconUrl=@"容积图标";
vo1.isShowArrow=YES;
vo1.subTitle=@"";
[_datas addObject:vo1];
IfishHotBarVo*vo2=[[IfishHotBarVo alloc]init];
vo2.title=@"水泵流量";
vo2.iconUrl=@"流量标";
vo2.isShowArrow=NO;
vo2.subTitle=@"流量:合适";
[_datas addObject:vo2];
IfishHotBarVo*vo3=[[IfishHotBarVo alloc]init];
vo3.title=@"历史趋势";
vo3.iconUrl=@"趋势图标";
vo3.isShowArrow=YES;
vo3.subTitle=@"";
[_datas addObject:vo3];
IfishHotBarVo*vo4=[[IfishHotBarVo alloc]init];
vo4.title=@"换水周期 5 天 700";
vo4.iconUrl=@"换水图标";
vo4.isShowArrow=YES;
vo4.subTitle=@"";
[_datas addObject:vo4];
}
return _datas;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self.tableView registerNib:[UINib nibWithNibName:@"IFishHotBarCell" bundle:nil] forCellReuseIdentifier:HOTBARCELL];
self.tableView.rowHeight=70;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.datas.count;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
IFishHotBarCell*cell=[tableView dequeueReusableCellWithIdentifier:HOTBARCELL];
cell.vo=self.datas[indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row==3) {
self.historyView.hidden=NO;
}else{
[self changeWaterView];
self.changeWaterView.viewType=indexPath.row;
}
}
@end