// // FourControlCanChangeImgController.m // Ifish // // Created by imac on 16/4/11. // Copyright © 2016年 imac. All rights reserved. // #import "FourControlCanChangeImgController.h" #import "SetTimeCell.h" #import "SecondSetTimeCell.h" #import "SetTimeModel.h" #import "SetSelectorTime.h" //#import "AsyncSocket.h" #import "setWaringTpModel.h" #import "appLogin.h" #import "workTypeModel.h" #import "SetSelectorTime.h" #define TIME_TAG 300 #import "MyPickerView.h" #import "searchDeviceModel.h" #import "FourControlbackMassge.h" #import "MydatePickerView.h" #define SET_CELL_TAG 2000 #define MYSWITCH_TAG 3000 #import "CenterViewController.h" #import "TimerSateModel.h" #import "TemperatureSetCell.h" #import "TemperatureSetModel.h" #import "AppDelegate.h" #import "BrightnessCell.h" #import "GuidengKaiGuanModel.h" #import "GuiDengViewCell.h" #import "ChangeWaterCell.h" #import "remindCyclePic.h" #import "BrightnessModel.h" #import "LYPhotoShowView.h" #import "LYPhoto.h" #import "Define.h" #import "AFNetworking.h" #import "UIImageView+WebCache.h" #import "DeviceModel.h" #define imageHigh 55 #define SectionHeadHigh 50 #define kplace ([UIScreen mainScreen].bounds.size.width - 4 * imageHigh)/5 #import "CreatErWeiMaController.h" @interface FourControlCanChangeImgController () { MydatePickerView*_mydatepicView; MyPickerView* _mypicView; remindCyclePic*_remindPic; dispatch_queue_t _mainQueue; BOOL _huanShuiSwitchIsOn; } @property(nonatomic,strong)NSIndexPath *indexpath; @property(nonatomic,copy)NSString *statString; @property(nonatomic,copy)NSString *endString; @property(nonatomic,strong)UIView *lodingbackView; @property(nonatomic,copy)NSString *nextChangeDateLabel; @property(nonatomic,strong)setRemindWaterModel *waterInfmodel; @property (nonatomic,strong) LYPhoto * photo; @property (nonatomic,strong) LYPhotoShowView * showView; @property (nonatomic,strong) LYPhotoShowView * showView2; @property (nonatomic,strong) LYPhotoShowView * showView3; @property (nonatomic,strong) LYPhotoShowView * showView4; @property (nonatomic,strong) UIView * headView; @property (nonatomic,strong) UIView * headView2; @property (nonatomic,strong) UIView * headView3; @property (nonatomic,strong) UIView * headView4; @property (nonatomic,assign) CGFloat headHeight; @property (nonatomic,assign) CGFloat headHeight2; @property (nonatomic,assign) CGFloat headHeight3; @property (nonatomic,assign) CGFloat headHeight4; @property (nonatomic,strong) UIButton * btn; @property (nonatomic,strong) UIButton * btn2; @property (nonatomic,strong) UIButton * btn3; @property (nonatomic,strong) UIButton * btn4; @property (nonatomic ,strong) UIImageView * leftTop; @property (nonatomic ,strong) UIImageView * leftTop2; @property (nonatomic ,strong) UIImageView * leftTop3; @property (nonatomic ,strong) UIImageView * leftTop4; @property (nonatomic ,strong) UILabel * leftlabel; @property (nonatomic ,strong) UILabel * leftlabel2; @property (nonatomic ,strong) UILabel * leftlabel3; @property (nonatomic ,strong) UILabel * leftlabel4; @property (nonatomic,assign) NSInteger indexWithImage; @property (nonatomic,assign) NSInteger indexWithImage2; @property (nonatomic,assign) NSInteger indexWithImage3; @property (nonatomic,assign) NSInteger indexWithImage4; @property (nonatomic,strong) UILabel * nameLabel; @property (nonatomic,strong) NSUserDefaults * userDefaultIndex; @property (nonatomic,copy) NSString * picUrl; @property (nonatomic,copy) NSString * picUrl2; @property (nonatomic,copy) NSString * picUrl3; @property (nonatomic,copy) NSString * picUrl4; @end @implementation FourControlCanChangeImgController - (void)viewDidLoad { [super viewDidLoad]; _switchCellArr=[[NSMutableArray alloc]init]; _mySwitchButtonArry=[[NSMutableArray alloc]init]; _indexpatchArr=[[NSMutableArray alloc]init]; _selcterTimerArr=[[NSArray alloc]init]; _selectorSwitchArr=[[NSArray alloc]init]; _waterInfmodel=[[setRemindWaterModel alloc]init]; // Do any additional setup after loading the view. _mainQueue = dispatch_get_main_queue(); self.navigationController.navigationBar.backItem.title=@""; [self addTitleViewWithTitle:@"设置"]; [self initData]; [self creatIndicatorView]; self.tableView.backgroundColor=COLOR_MIAN; [self initSectionViews]; UIBarButtonItem*rightItem=[[UIBarButtonItem alloc]initWithTitle:@"分享设备" style: UIBarButtonItemStyleDone target:self action:@selector(fourItemClick)]; rightItem.tintColor=[UIColor whiteColor]; self.navigationItem.rightBarButtonItem=rightItem; self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone; [self.tableView registerNib:[UINib nibWithNibName:@"SetTimeCell" bundle:nil] forCellReuseIdentifier:@"SetTimeCell"]; // self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,64, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped]; //此设置可以在设置了tableView 的style 为UITableViewStyleGrouped 时让标头避免出现空白 // self.tableView.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, kScreenSize.width, 0.01f)]; } -(void)fourItemClick{ CreatErWeiMaController*vc=[[CreatErWeiMaController alloc]init] ; vc.erdevicemodel=self.currentdevice; [self.navigationController pushViewController:vc animated:YES]; } #pragma mark 头视图UI设置 -(void)initSectionViews{ _headHeight = SectionHeadHigh; if (!_btn) { _btn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 40 -24,SectionHeadHigh/2-20 , 40, 40)]; [_btn setTitle:@"更换" forState:UIControlStateNormal]; _btn.titleLabel.font=[UIFont systemFontOfSize:15]; [_btn setTitleColor: SECTIONVIEW_LABELCOLER forState:UIControlStateNormal]; [_btn addTarget:self action:@selector(fHeaderbtnClick1:) forControlEvents:UIControlEventTouchUpInside]; } _headHeight2 = SectionHeadHigh; if (!_btn2) { _btn2 = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 40 -24,SectionHeadHigh/2-20 , 40, 40)]; [_btn2 setTitle:@"更换" forState:UIControlStateNormal]; _btn2.titleLabel.font=[UIFont systemFontOfSize:15]; [_btn2 setTitleColor: SECTIONVIEW_LABELCOLER forState:UIControlStateNormal]; [_btn2 addTarget:self action:@selector(fHeaderbtnClick2:) forControlEvents:UIControlEventTouchUpInside]; } _headHeight3 = SectionHeadHigh; if (!_btn3) { _btn3 = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 40 -24,SectionHeadHigh/2-20 , 40, 40)]; [_btn3 setTitle:@"更换" forState:UIControlStateNormal]; _btn3.titleLabel.font=[UIFont systemFontOfSize:15]; [_btn3 setTitleColor: SECTIONVIEW_LABELCOLER forState:UIControlStateNormal]; [_btn3 addTarget:self action:@selector(fHeaderbtnClick3: ) forControlEvents:UIControlEventTouchUpInside]; } _headHeight4 = SectionHeadHigh; if (!_btn4) { _btn4 = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 40 -24,SectionHeadHigh/2-20 , 40, 40)]; [_btn4 setTitle:@"更换" forState:UIControlStateNormal]; _btn4.titleLabel.font=[UIFont systemFontOfSize:15]; [_btn4 setTitleColor: SECTIONVIEW_LABELCOLER forState:UIControlStateNormal]; [_btn4 addTarget:self action:@selector(fHeaderbtnClick4:) forControlEvents:UIControlEventTouchUpInside]; } if (!_leftTop) { _leftlabel = [[UILabel alloc] initWithFrame:CGRectMake(65, SectionHeadHigh/2-5, 100, 10)]; _leftlabel.font=[UIFont systemFontOfSize:15]; _leftlabel.textColor = SECTIONVIEW_LABELCOLER; } if (!_leftTop2) { _leftlabel2 = [[UILabel alloc] initWithFrame:CGRectMake(65, SectionHeadHigh/2-5, 100, 10)]; _leftlabel2.font=[UIFont systemFontOfSize:15]; _leftlabel2.textColor = SECTIONVIEW_LABELCOLER; } if (!_leftTop3) { _leftlabel3 = [[UILabel alloc] initWithFrame:CGRectMake(65, SectionHeadHigh/2-5, 100, 10)]; _leftlabel3.font=[UIFont systemFontOfSize:15]; _leftlabel3.textColor = SECTIONVIEW_LABELCOLER; } if (!_leftTop4) { _leftlabel4 = [[UILabel alloc] initWithFrame:CGRectMake(65, SectionHeadHigh/2-5, 100, 10)]; _leftlabel4.font=[UIFont systemFontOfSize:15]; _leftlabel4.textColor = SECTIONVIEW_LABELCOLER; } NSUserDefaults *userdefaultsIndex = [NSUserDefaults standardUserDefaults]; NSString*index1= [userdefaultsIndex valueForKey:@"indexArrVlue1"]; NSString*index2= [userdefaultsIndex valueForKey:@"indexArrVlue2"]; NSString*index3= [userdefaultsIndex valueForKey:@"indexArrVlue3"]; NSString*index4= [userdefaultsIndex valueForKey:@"indexArrVlue4"]; NSArray *imageArrindex=[[NSMutableArray alloc] init]; NSArray *allShowName = [[NSMutableArray alloc] init]; NSArray*alliconnames=[self.currentdevice.allIconName componentsSeparatedByString:@","]; if (![self.currentdevice.customIconName isEqualToString:@""]){ imageArrindex=[self.currentdevice.customIconName componentsSeparatedByString:@","]; }else{ imageArrindex=[self.currentdevice.defaultIconName componentsSeparatedByString:@","]; } if (![self.currentdevice.allShowName isEqualToString:@""]) { allShowName = [self.currentdevice.allShowName componentsSeparatedByString:@","]; }else{ allShowName = [self.currentdevice.defaultShowName componentsSeparatedByString:@","]; } if (index1 == nil) { index1 = imageArrindex[0]; } if (index2 == nil) { index2 = imageArrindex[1]; } if (index3 == nil) { index3 = imageArrindex[2]; } if (index4 == nil) { index4 = imageArrindex[3]; } if (!_leftTop ) { _leftTop = [[UIImageView alloc] initWithFrame:CGRectMake(10,SectionHeadHigh/2-20, 40, 40)]; int firstindex=[index1 intValue]; NSString* imageurl = [NSString stringWithFormat:@"%@%@",self.currentdevice.iconLink,alliconnames[firstindex]]; [_leftTop sd_setImageWithURL:[NSURL URLWithString:imageurl] placeholderImage:[UIImage imageNamed:@"icon1"]]; _leftlabel.text = allShowName[firstindex]; [_headView addSubview:_leftTop]; } if (!_leftTop2) { _leftTop2 = [[UIImageView alloc] initWithFrame:CGRectMake(10,SectionHeadHigh/2-20, 40, 40)]; int secindex=[index2 intValue]; NSString* imageurl = [NSString stringWithFormat:@"%@%@",self.currentdevice.iconLink,alliconnames[secindex]]; [_leftTop2 sd_setImageWithURL:[NSURL URLWithString:imageurl] placeholderImage:[UIImage imageNamed:@"icon1"]]; _leftlabel2.text = allShowName[secindex]; [_headView2 addSubview:_leftTop2]; } if (!_leftTop3) { _leftTop3 = [[UIImageView alloc] initWithFrame:CGRectMake(10,SectionHeadHigh/2-20, 40, 40)]; int thredindex=[index3 intValue]; NSString* imageurl = [NSString stringWithFormat:@"%@%@",self.currentdevice.iconLink,alliconnames[thredindex]]; [_leftTop3 sd_setImageWithURL:[NSURL URLWithString:imageurl] placeholderImage:[UIImage imageNamed:@"icon1"]]; _leftlabel3.text = allShowName[thredindex]; [_headView3 addSubview:_leftTop3]; } if (!_leftTop4) { _leftTop4 = [[UIImageView alloc] initWithFrame:CGRectMake(10,SectionHeadHigh/2-20, 40, 40)]; int forindex=[index4 intValue]; NSString* imageurl = [NSString stringWithFormat:@"%@%@",self.currentdevice.iconLink,alliconnames[forindex]]; [_leftTop4 sd_setImageWithURL:[NSURL URLWithString:imageurl] placeholderImage:[UIImage imageNamed:@"icon1"]]; _leftlabel4.text = allShowName[forindex]; [_headView4 addSubview:_leftTop4]; } } -(void)initData{ self.titleArr=@[@[@"预警设置",@"柜灯开关",@"背光亮度",@"换水提醒",@"定时模式"],@[@"时段1",@"时段2"],@[@"时段1",@"时段2"],@[@"时段1",@"时段2",],@[@"时段1",@"时段2",@""]]; FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; if (backmodel) { NSString *low=backmodel.miniTp; NSString *heigh=backmodel.maxTp; UInt64 lowten=[dataContorl hexToTen:low]; UInt64 heighten=[dataContorl hexToTen:heigh]; float formatlow=lowten/10; float formatheigh=heighten/10; NSString *wenduString=[NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh]; // 十六进制 NSString *startTimeHex1=[backmodel.timer1 substringWithRange:NSMakeRange(4, 4)]; NSString *endTimeHex1=[backmodel.timer1 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString *startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1]; NSString *endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1]; NSString *setTim1=[NSString stringWithFormat:@"%@~%@",startTimeTen1,endTimeTen1]; // 十六进制 NSString *startTimeHex2=[backmodel.timer2 substringWithRange:NSMakeRange(4, 4)]; NSString *endTimeHex2=[backmodel.timer2 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString *startTimeTen2=[dataContorl hexStringToDateString:startTimeHex2]; NSString *endTimeTen2=[dataContorl hexStringToDateString:endTimeHex2]; NSString *setTim2=[NSString stringWithFormat:@"%@~%@",startTimeTen2,endTimeTen2]; // 十六进制 NSString *startTimeHex3=[backmodel.timer3 substringWithRange:NSMakeRange(4, 4)]; NSString *endTimeHex3=[backmodel.timer3 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString *startTimeTen3=[dataContorl hexStringToDateString:startTimeHex3]; NSString *endTimeTen3=[dataContorl hexStringToDateString:endTimeHex3]; NSString *setTim3=[NSString stringWithFormat:@"%@~%@",startTimeTen3,endTimeTen3]; // 十六进制 NSString *startTimeHex4=[backmodel.timer4 substringWithRange:NSMakeRange(4, 4)]; NSString *endTimeHex4=[backmodel.timer4 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString *startTimeTen4=[dataContorl hexStringToDateString:startTimeHex4]; NSString *endTimeTen4=[dataContorl hexStringToDateString:endTimeHex4]; NSString *setTim4=[NSString stringWithFormat:@"%@~%@",startTimeTen4,endTimeTen4]; // 十六进制 NSString*startTimeHex5=[backmodel.timer5 substringWithRange:NSMakeRange(4, 4)]; NSString*endTimeHex5=[backmodel.timer5 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString*startTimeTen5=[dataContorl hexStringToDateString:startTimeHex5]; NSString*endTimeTen5=[dataContorl hexStringToDateString:endTimeHex5]; NSString*setTim5=[NSString stringWithFormat:@"%@~%@",startTimeTen5,endTimeTen5]; // 十六进制 NSString*startTimeHex6=[backmodel.timer6 substringWithRange:NSMakeRange(4, 4)]; NSString*endTimeHex6=[backmodel.timer6 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString*startTimeTen6=[dataContorl hexStringToDateString:startTimeHex6]; NSString*endTimeTen6=[dataContorl hexStringToDateString:endTimeHex6]; NSString*setTim6=[NSString stringWithFormat:@"%@~%@",startTimeTen6,endTimeTen6]; NSString*startTimeHex7=[backmodel.timer7 substringWithRange:NSMakeRange(4, 4)]; NSString*endTimeHex7=[backmodel.timer7 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString*startTimeTen7=[dataContorl hexStringToDateString:startTimeHex7]; NSString*endTimeTen7=[dataContorl hexStringToDateString:endTimeHex7]; NSString*setTim7=[NSString stringWithFormat:@"%@~%@",startTimeTen7,endTimeTen7]; // 十六进制 NSString*startTimeHex8=[backmodel.timer8 substringWithRange:NSMakeRange(4, 4)]; NSString*endTimeHex8=[backmodel.timer8 substringWithRange:NSMakeRange(8, 4)]; // 十进制 NSString*startTimeTen8=[dataContorl hexStringToDateString:startTimeHex8]; NSString*endTimeTen8=[dataContorl hexStringToDateString:endTimeHex8]; NSString*setTim8=[NSString stringWithFormat:@"%@~%@",startTimeTen8,endTimeTen8]; // // 十六进制 // NSString*startTimeHex9=[backmodel.timer9 substringWithRange:NSMakeRange(4, 4)]; // NSString*endTimeHex9=[backmodel.timer9 substringWithRange:NSMakeRange(8, 4)]; // // 十进制 // NSString*startTimeTen9=[dataContorl hexStringToDateString:startTimeHex9]; // NSString*endTimeTen9=[dataContorl hexStringToDateString:endTimeHex9]; // NSString*setTim9=[NSString stringWithFormat:@"%@~%@",startTimeTen9,endTimeTen9]; NSString*switchButton1=[backmodel.timer1 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton2=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton3=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton4=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton5=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton6=[backmodel.timer6 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton7=[backmodel.timer7 substringWithRange:NSMakeRange(2, 2)]; NSString*switchButton8=[backmodel.timer8 substringWithRange:NSMakeRange(2, 2)]; // NSString*switchButton9=[backmodel.timer9 substringWithRange:NSMakeRange(2, 2)]; _selectorSwitchArr=@[switchButton1,switchButton2,switchButton3,switchButton4,switchButton5,switchButton6,switchButton7,switchButton8]; _selcterTimerArr=@[setTim1,setTim2,setTim3,setTim4,setTim5,setTim6,setTim7,setTim8]; self.timeArr=@[@[wenduString,@"设置时段"],@[setTim1,setTim2],@[setTim3,setTim4],@[setTim5,setTim6],@[setTim7,setTim8,@""]]; }else{ [self showTitle:@"" messsage:@"设备已离线"]; self.timeArr=@[@[@"20~30°C",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00",@""]]; _selcterTimerArr=@[@"2:00~5:00",@"2:00~5:00",@"2:00~5:00",@"2:00~5:00",@"2:00~5:00",@"2:00~5:00",@"2:00~5:00",@"2:00~5:00"];//防crash } } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 5; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section==0) { return 5; }else if (section == 4){ return 3; }else{ return 2; } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; static NSString *cellID=@"kongCell"; UITableViewCell *kongCell=[tableView dequeueReusableCellWithIdentifier:cellID]; if (kongCell==nil) { kongCell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID]; } if (indexPath.section==0&&indexPath.row==0){ TemperatureSetCell*cell=[tableView dequeueReusableCellWithIdentifier:@"TemperatureSetCell"]; if (cell==nil) { cell=[[[NSBundle mainBundle]loadNibNamed:@"TemperatureSetCell" owner:self options:nil]lastObject]; } cell.tag=indexPath.row +SET_CELL_TAG+indexPath.section*10; TemperatureSetModel*model=[[TemperatureSetModel alloc]init]; model.title=self.titleArr[indexPath.section][indexPath.row]; cell.titleLabel.text=model.title; model.temperatureLabel=self.timeArr[indexPath.section][indexPath.row]; cell.temperaturelabel.text=model.temperatureLabel; [cell.temPSwitch addTarget:self action:@selector(normalFourtempSwitchAction:) forControlEvents:UIControlEventTouchUpInside]; if ([backmodel.baojingSwitch isEqualToString:@"01"]) { [cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; cell.temPSwitch.selected = NO; }else{ [cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; cell.temPSwitch.selected = YES; } return cell; }else if (indexPath.section==0&&indexPath.row==2){ //背光 BrightnessCell*cell=[tableView dequeueReusableCellWithIdentifier:@"BrightnessCell"]; if (cell==nil) { cell=[[[NSBundle mainBundle]loadNibNamed:@"BrightnessCell" owner:self options:nil]lastObject]; } if (![_currentdevice.isLightness isEqual:[NSNull null]]) { if ([_currentdevice.isLightness isEqualToString:@"1"]) { //有背光 cell.brightTitleLabel.text=_titleArr[indexPath.section][indexPath.row]; // 系统默认YES 这里拖拽结束时再传值需设为NO cell.btightnessSlider.continuous=NO; if (backmodel) { UInt64 lightTen=[dataContorl hexToTen:backmodel.brightness]; [cell.btightnessSlider setValue:lightTen animated:YES]; // int sliderValue=(int)(lightTen+0.5); // int percent=(sliderValue*100)/250; //cell.persentLabel.text=[NSString stringWithFormat:@"%d%",percent]; //cell.persentLabel.textColor=COLOR_LABEL_TITLE; } [cell.btightnessSlider addTarget:self action:@selector(normalFourbtightnessSlider:) forControlEvents:UIControlEventValueChanged]; cell.brightTitleLabel.hidden=NO; cell.btightnessSlider.hidden=NO; cell.persentLabel.hidden=NO; return cell; }else{ //无背光 return kongCell; } }else{ cell.brightTitleLabel.hidden=YES; cell.btightnessSlider.hidden=YES; cell.persentLabel.hidden=YES; return cell; } }else if (indexPath.section==0&&indexPath.row==1){ // 柜灯 GuiDengViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"GuiDengViewCell"]; if (cell==nil) { cell=[[[NSBundle mainBundle]loadNibNamed:@"GuiDengViewCell" owner:self options:nil]lastObject]; } if (![_currentdevice.isSarkLamp isEqual:[NSNull null]]) { if ([_currentdevice.isSarkLamp isEqualToString:@"1"]) { cell.guidengtitle=_titleArr[indexPath.section][indexPath.row]; [cell.guidengSwitch addTarget:self action:@selector(normalFourguidengSwitchAtion:) forControlEvents:UIControlEventTouchUpInside]; if ([backmodel.tankLight isEqualToString:@"01"]) { //[cell.guidengSwitch setOn:YES]; [cell.guidengSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; cell.guidengSwitch.selected = NO; }else{ [cell.guidengSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; cell.guidengSwitch.selected = YES; //[cell.guidengSwitch setOn:NO]; } return cell; }else{ return kongCell; } }else{ return kongCell; } }else if (indexPath.section==0&&indexPath.row==3){ // 换水提醒 if (![self.currentdevice.waterRemind isEqual:[NSNull null]]) { ChangeWaterCell*cell=[tableView dequeueReusableCellWithIdentifier:@"ChangeWaterCell"]; if (cell==nil) { cell=[[[NSBundle mainBundle]loadNibNamed:@"ChangeWaterCell" owner:self options:nil]lastObject]; } [cell.ChangeWaterSwitch addTarget:self action:@selector(normalFourchangeWaterSwitch:) forControlEvents:UIControlEventTouchUpInside]; if ([self.waterInfmodel.waterremind isEqualToString:@"1"]) { // [cell.ChangeWaterSwitch setOn:YES]; cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstSetCell"]]; cell.ChangeWaterSwitch.selected = NO; [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; _huanShuiSwitchIsOn=YES; }else{ //[cell.ChangeWaterSwitch setOn:NO]; _huanShuiSwitchIsOn=NO; cell.ChangeWaterSwitch.selected = YES; [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]]; } if (self.waterInfmodel.remindcycle == 0) { //在未获取换水信息时暂时显示 cell.huanshuiDaylabel.text=@"换水时间"; }else{ cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle]; NSLog(@"ce;;%@",cell.huanshuiDaylabel.text); NSLog(@"222"); } return cell; }else{ kongCell.textLabel.text =@"错误信息 waterRemind null"; return kongCell; } }else if (indexPath.section==0&&indexPath.row==4){ static NSString*nextHuanShuiLablecellId=@"labelcell"; UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:nextHuanShuiLablecellId]; if (cell==nil) { cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nextHuanShuiLablecellId]; } if (_huanShuiSwitchIsOn) { cell.backgroundColor=COLOR_BACK_; cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.waterInfmodel.remindDate]; if (!self.waterInfmodel.remindDate) { cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.nextChangeDateLabel]; } cell.textLabel.font=[UIFont systemFontOfSize:12]; [cell.textLabel sizeToFit]; cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]]; }else{ cell.textLabel.text=@""; } cell.userInteractionEnabled = NO; return cell; }else{ if (indexPath.section==4&&indexPath.row==2) { //最后插入一个cell达到 椭圆底效果 static NSString*cellId=@"lastSectlastcell"; UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:cellId]; if (cell==nil) { cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId]; } cell.backgroundView =[ [UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]]; cell.userInteractionEnabled = NO; return cell; }else{ SetTimeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SetTimeCell"]; if (cell==nil) { //cell=[[[NSBundle mainBundle]loadNibNamed:@"SetTimeCell" owner:self options:nil]lastObject]; cell = [[SetTimeCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"SetTimeCell"]; } SetTimeModel*model=[[SetTimeModel alloc]init]; model.title=self.titleArr[indexPath.section][indexPath.row]; cell.titleLabel.text=model.title; model.timestring=self.timeArr[indexPath.section][indexPath.row]; cell.timeLabel.text=model.timestring; cell.timeLabel.tag=TIME_TAG+indexPath.section*10+indexPath.row; [cell SetEightTimerBackAtIndex:indexPath]; if (indexPath.section!=0 && !(indexPath.section==3&&indexPath.row==2)) { cell.tag=indexPath.row +SET_CELL_TAG+indexPath.section*10; cell.mySwitchButton.tag=indexPath.row +MYSWITCH_TAG+indexPath.section*10; [_indexpatchArr addObject:indexPath]; [_mySwitchButtonArry addObject:cell.mySwitchButton]; [_switchCellArr addObject:cell]; } if (indexPath.section!=0 && !(indexPath.section==4&&indexPath.row==2)) { [cell SetEightTimerSwitchAtIndex:indexPath WithBacmodel:backmodel]; if (indexPath.section ==1 ) { [cell.setHeaderBtn addTarget:self action:@selector(fHeaderbtnClick1:) forControlEvents:UIControlEventTouchUpInside]; } } [cell.mySwitchButton addTarget:self action:@selector(changeImageFourbtnCliCk:) forControlEvents:UIControlEventTouchUpInside]; if ([self.currentdevice.isWorkModel isEqualToString:@"1"]) { //有自动模式 if ([backmodel.yunxingmoshi isEqualToString:@"01"]) {// 自动模式下 cell.mySwitchButton.userInteractionEnabled=YES; }else{ cell.mySwitchButton.userInteractionEnabled=NO; } }else{ //无自动模式 cell.mySwitchButton.userInteractionEnabled=YES; } [cell bringSubviewToFront:cell.mySwitchButton]; return cell; } } } -(void)changeImageFourbtnCliCk:(UIButton*)btn{ TimerSateModel*stateModel=[[TimerSateModel alloc]init]; stateModel.crc16String=@"0000"; FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; NSString*backState=nil; // SetSelectorTime*selectorTimeModel=[[SetSelectorTime alloc]init]; if (btn.tag==3010) { backState=[backmodel.timer1 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:0]; stateModel.timerNumber=@"01"; // stateModel.timerState=[backmodel.timer1 substringWithRange:NSMakeRange(2, 2)]; }else if (btn.tag==3011){ backState=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:1]; stateModel.timerNumber=@"02"; // stateModel.timerState=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; }else if (btn.tag==3020){ backState=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:2]; stateModel.timerNumber=@"03"; // stateModel.timerState=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; }else if (btn.tag==3021){ backState=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:3]; stateModel.timerNumber=@"04"; // stateModel.timerState=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; }else if (btn.tag==3030){ backState=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:4]; stateModel.timerNumber=@"05"; //stateModel.timerState=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; }else if (btn.tag==3031){ backState=[backmodel.timer6 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:5]; stateModel.timerNumber=@"06"; }else if (btn.tag==3040){ backState=[backmodel.timer7 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:5]; stateModel.timerNumber=@"07"; }else if (btn.tag==3041){ backState=[backmodel.timer8 substringWithRange:NSMakeRange(2, 2)]; _indexpath=[_indexpatchArr objectAtIndex:5]; stateModel.timerNumber=@"08"; } if ([backState isEqualToString:@"01"]) { // mySwitchIsOn=YES; // }else{ // mySwitchIsOn=NO; stateModel.timerState=@"00";// 关 NSString*stateString=[NSString stringWithFormat:@"%@%@%@%@",stateModel.description,stateModel.timerNumber,stateModel.timerState,stateModel.crc16String]; NSData*selctorData=[dataContorl stringToHexData:stateString]; [self.clientSocket writeData:selctorData withTimeout:-1 tag:1]; [self.clientSocket readDataWithTimeout:-1 tag:1]; [_indicatorView startAnimating]; [btn setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; }else{ stateModel.timerState=@"01";// 开 NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@",stateModel.description,stateModel.timerNumber,stateModel.timerState,stateModel.crc16String]; NSData*selctorData=[dataContorl stringToHexData:selectorString]; [self.clientSocket writeData:selctorData withTimeout:-1 tag:1]; [self.clientSocket readDataWithTimeout:-1 tag:1]; [_indicatorView startAnimating]; [btn setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; } } #pragma mark 开启关闭报警 -(void)normalFourtempSwitchAction:(UIButton*)temperatureSwitch{ FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; setWaringTpModel*warModel1=[[setWaringTpModel alloc]init]; //BOOL isOn=[temperatureSwitch isOn]; if (temperatureSwitch.selected == YES) { NSLog(@"开"); temperatureSwitch.selected = NO; warModel1.kaiguan=@"01";// 开 warModel1.miniwaterTp=@"0000"; // 0 warModel1.maxwaterTp=@"0000";//0 }else{ temperatureSwitch.selected = YES; warModel1.kaiguan=@"00";// 关 warModel1.miniwaterTp=@"0000"; // 0 warModel1.maxwaterTp=@"0000";//0 NSLog(@"关"); } [self setTmperatureStateWithModel:warModel1 addBackModel:backmodel]; } -(void)setTmperatureStateWithModel:(setWaringTpModel*)waringModel addBackModel:(FourControlbackMassge*)backModel{ NSString*maxminTpString=waringModel.description; waringModel.crc16Ing=@"0000"; NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@",maxminTpString,waringModel.kaiguan,waringModel.miniwaterTp,waringModel.maxwaterTp,waringModel.crc16Ing]; NSData*minwenDuData=[dataContorl stringToHexData:minString]; [self.clientSocket writeData:minwenDuData withTimeout:-1 tag:1]; [self.clientSocket readDataWithTimeout:-1 tag:1]; [_indicatorView startAnimating]; backModel.miniTp=waringModel.miniwaterTp; backModel.maxTp=waringModel.maxwaterTp; } #pragma mark 柜光灯开关Action -(void)normalFourguidengSwitchAtion:(UIButton*)sender{ UIButton *switchButton = (UIButton*)sender; //BOOL isButtonOn=[switchButton isOn]; GuidengKaiGuanModel*guidengModel=[[GuidengKaiGuanModel alloc]init]; guidengModel.crc16Str=@"0000"; if (switchButton.selected == YES) { NSLog(@"开"); guidengModel.onOff=@"01"; switchButton.selected = NO; NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str]; NSData*guidengData=[dataContorl stringToHexData:guidengOrder]; [self.clientSocket writeData:guidengData withTimeout:-1 tag:0]; [self.clientSocket readDataWithTimeout:-1 tag:0]; FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; backmodel.tankLight=@"01"; [_indicatorView startAnimating]; }else{ NSLog(@"关"); switchButton.selected = YES; guidengModel.onOff=@"00"; NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str]; NSData*guidengData=[dataContorl stringToHexData:guidengOrder]; [self.clientSocket writeData:guidengData withTimeout:-1 tag:0]; [self.clientSocket readDataWithTimeout:-1 tag:0]; FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; backmodel.tankLight=@"00"; [_indicatorView startAnimating]; } } #pragma mark 背光灯亮度Action -(void)normalFourbtightnessSlider:(UISlider*)sender{ UISlider*slider=(UISlider*)sender; NSLog(@"%f",slider.value); //这里 只传整数 //1.强转四舍五入 int sliderValue=(int)(slider.value+0.5); NSLog(@"%d",sliderValue); self.percent=(sliderValue*100)/250; NSString*hexString=[dataContorl ToHex:sliderValue]; if (hexString.length<2) { hexString=[NSString stringWithFormat:@"0%@",hexString]; } NSLog(@"%@",hexString); BrightnessModel*brightModel=[[BrightnessModel alloc]init ]; brightModel.liangdu=hexString; brightModel.crc16Code=@"0000"; NSString*changeLightOder=[NSString stringWithFormat:@"%@%@%@",brightModel.description,brightModel.liangdu,brightModel.crc16Code]; NSData*changeLghtData=[dataContorl stringToHexData:changeLightOder]; [self.clientSocket writeData:changeLghtData withTimeout:-1 tag:0]; [self.clientSocket readDataWithTimeout:-1 tag:0]; [_indicatorView startAnimating]; } #pragma mark 换水提醒Action -(void)normalFourchangeWaterSwitch:(UIButton*)sender{ UIButton*huanShuiSwitch=(UIButton*)sender; NSUserDefaults*defuat=[NSUserDefaults standardUserDefaults]; NSString*picResult=[defuat valueForKey:@"normalSikongpicResult"]; int pic = picResult.intValue; if (pic==0) { [self showTitle:@"" messsage:@"请设置提醒天数"]; if (huanShuiSwitch.selected == YES) { huanShuiSwitch.selected =NO; }else{ huanShuiSwitch.selected =YES; } }else{ if (huanShuiSwitch.selected ==YES) { //开 huanShuiSwitch.selected =NO; [IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId waterRemind:@"1" remindCycle:picResult huishuiShiJian:^(setRemindWaterModel *remindModel) { self.nextChangeDateLabel=remindModel.remindDate; }]; //更新选择状态 设置界面 在不断 刷新 self.waterInfmodel.waterremind=@"1"; [self.tableView reloadData]; }else{ //关 huanShuiSwitch.selected =YES; [IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId waterRemind:@"0" remindCycle:picResult huishuiShiJian:^(setRemindWaterModel *remindModel) { self.nextChangeDateLabel=remindModel.remindDate; self.waterInfmodel=remindModel; }]; self.waterInfmodel.waterremind=@"0"; [self.tableView reloadData]; } } } #pragma mark tableView 头视图和脚视图 -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section==0&&indexPath.row==4) { if (_huanShuiSwitchIsOn) { return 50; }else{ return 0; } }else if (indexPath.section==0&&indexPath.row==2){ if (![_currentdevice.isLightness isEqual:[NSNull null]]) { if ([_currentdevice.isLightness isEqualToString:@"1"]) { return 100; }else{ return 0; } }else{ return 0; } }else if (indexPath.section==0&&indexPath.row==1){ // if (![_currentdevice.isSarkLamp isEqual:[NSNull null]]) { if ([_currentdevice.isSarkLamp isEqualToString:@"1"]) { return 50; }else{ return 0; } }else{ return 0; } } else if (indexPath.section==0&&indexPath.row==3){ if (![_currentdevice.waterRemind isEqual:[NSNull null]]) { return 50; }else{ return 0; } }else if (indexPath.section==0&&indexPath.row==0){ //会否有 预警 if (![_currentdevice.isPushWendu isEqual:[NSNull null]]) { if ([_currentdevice.isPushWendu isEqualToString:@"1"]) { return 50; }else{ return 0; } }else{ return 0; } }else{ return 50; } } -(void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section{ } -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{ } -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 0; } #pragma mark 设置tableview头视图 //-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ // // if (section == 1) { // // return _headHeight; // // }else if (section == 2){ // // return _headHeight2; // // }else if (section == 3){ // // return _headHeight3; // // }else if (section == 4){ // // return _headHeight4; // // }else if(section == 0 ){ // // return 0.0001; // } // // return 0; // //} -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 1) { return 50; }else if (section ==0){ return 5; }else { return 0; } } -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ // if (section == 1) { // // if (!_headView) { // _headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _headHeight)]; // _headView.backgroundColor = [UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; // } // [self.view addSubview:_headView]; // [_headView addSubview:_btn]; // // [_headView addSubview:_leftTop]; // [_headView addSubview:_leftlabel]; // // return _headView; // // }else if(section == 2){ // // if (!_headView2) { // _headView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _headHeight2)]; // _headView2.backgroundColor = [UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; // } // // [self.view addSubview:_headView2]; // [_headView2 addSubview:_btn2]; // [_headView2 addSubview:_leftTop2]; // [_headView2 addSubview:_leftlabel2]; // // return _headView2; // // }else if(section ==3){ // // if (!_headView3) { // // _headView3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _headHeight3)]; // // _headView3.backgroundColor =[UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; // } // // [self.view addSubview:_headView3]; // [_headView3 addSubview:_btn3]; // [_headView3 addSubview:_leftTop3]; // [_headView3 addSubview:_leftlabel3]; // // return _headView3; // // // }else if(section == 4){ // // if (!_headView4) { // _headView4 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _headHeight4)]; // _headView4.backgroundColor = [UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; // } // // [self.view addSubview:_headView4]; // [_headView4 addSubview:_btn4]; // [_headView4 addSubview:_leftTop4]; // [_headView4 addSubview:_leftlabel4]; // // return _headView4; // // }else{ // // //零区 // return nil; // } if (section==1) { FourControlbackMassge *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"FourControlMassgeInfo"]; UIImageView*secondSectionHeader=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstSetCell"]]; secondSectionHeader.userInteractionEnabled = YES; UILabel *label=[[UILabel alloc] init]; label.text=@"定时模式"; label.font = [UIFont systemFontOfSize:15]; label.frame=CGRectMake(18, 5, 100, 40); [secondSectionHeader addSubview:label]; //UISwitch *swich=[[UISwitch alloc] init]; UIButton *swBtn=[UIButton buttonWithType:UIButtonTypeCustom]; swBtn.frame=CGRectMake(kScreenSize.width- 24 - 49, 8, 60, 33); [swBtn addTarget:self action:@selector(normalFourControlSwitchClick:) forControlEvents:UIControlEventTouchUpInside]; if ([backmodel.yunxingmoshi isEqualToString:@"01"]) { [swBtn setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; swBtn.selected = NO; }else{ [swBtn setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; swBtn.selected = YES; } if (![_currentdevice.isWorkModel isEqual:[NSNull null]]) { if ([_currentdevice.isWorkModel isEqualToString:@"1"]) { [swBtn setHidden:NO]; }else{ [swBtn setHidden:YES]; } }else{ [swBtn setHidden:YES]; } [secondSectionHeader addSubview:swBtn]; return secondSectionHeader; }else if (section == 0){ UIView*oneHeader=[[UIView alloc] init]; oneHeader.backgroundColor=COLOR_MIAN; return oneHeader; }else{ return nil; } } //-(void)lastIndex{ // //// NSUserDefaults *userSelectLast = [NSUserDefaults standardUserDefaults]; //// NSInteger lastIndex = [[userSelectLast objectForKey:@"indexArrVlue1"] integerValue]; // // _line1.frame = CGRectMake(kplace + lastIndex * (imageHigh + kplace), imageHigh + imageHigh + 3 + 10, imageHigh, 3) ; // //} // #pragma mark 第一个更换按钮 -(void)fHeaderbtnClick1:(UIButton *)sender{ // [_line1 setHidden:YES]; if (sender.selected == NO) { //展开状态 if (!_headView) { _headView = [[UIView alloc] initWithFrame:CGRectMake(0,200, self.view.frame.size.width, 100)]; _headView.backgroundColor = [UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; } [self.tableView addSubview:_headView]; sender.selected = YES; [self showPhoto]; //[self.tableView reloadData]; }else if(sender.selected == YES){ //未展开状态 // [sender setTitle:@"更换" forState:UIControlStateNormal]; // _headHeight = SectionHeadHigh; // _headView.frame = CGRectMake(0, 0, self.view.frame.size.width, _headHeight ) ; // _headView.backgroundColor = [UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1]; sender.selected = NO; //_headView.alpha = 1; [_headView removeFromSuperview]; [_showView dismiss]; //保存自定义图标 //[self loadData]; //[self.tableView reloadData]; } } #pragma mark 展示第一个头视图 -(void)showPhoto { // _line1 = [[UIView alloc] initWithFrame:CGRectMake(kplace + _indexWithImage * (imageHigh + kplace), imageHigh + 3 + 50, imageHigh, 3)]; // // _line1.backgroundColor = [UIColor orangeColor]; NSMutableArray * images= [NSMutableArray array]; NSArray*deviceArr=[[DataCenter defaultDtacenter] valueForKey:@"deviceInfo"]; if (deviceArr==nil) { [self showTitle:@"" messsage:@"请绑定设备"]; [self.navigationController popViewControllerAnimated:YES]; }else{ DeviceModel*devicemodel=self.currentdevice; NSArray *strArr = [devicemodel.allIconName componentsSeparatedByString:@","]; NSArray *nameArr = [devicemodel.allShowName componentsSeparatedByString:@","]; for (int i = 0 ; i