From 68d441eb0d5397d72be39a5f12f40f1eb61e769c Mon Sep 17 00:00:00 2001 From: xuemh Date: Mon, 23 Apr 2018 01:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AE=BE=E5=A4=87=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish.xcodeproj/project.pbxproj | 6 + .../RuiMei/RuiMeiInputViewController.h | 13 ++ .../RuiMei/RuiMeiInputViewController.m | 157 ++++++++++++++++++ .../RuiMei/RuiMeiViewController.m | 9 +- 4 files changed, 179 insertions(+), 6 deletions(-) create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.m diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 70909c8..522d27e 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2458,6 +2458,7 @@ E51D7D51208CDB5B001FF053 /* RuiMeiSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D50208CDB5B001FF053 /* RuiMeiSetViewController.m */; }; E51D7D55208CE08D001FF053 /* CustomModeSetCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D53208CE08D001FF053 /* CustomModeSetCell.m */; }; E51D7D58208CE121001FF053 /* CustomModeSetCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E51D7D57208CE120001FF053 /* CustomModeSetCell.xib */; }; + E51D7D5B208CF4E7001FF053 /* RuiMeiInputViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D5A208CF4E7001FF053 /* RuiMeiInputViewController.m */; }; E547870B20728F390060C2C2 /* back_btn@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E547870A20728F380060C2C2 /* back_btn@2x.png */; }; E547870F2073192E0060C2C2 /* introlImage_iphonex_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */; }; E54787102073192E0060C2C2 /* introlImage_iphonex_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */; }; @@ -6234,6 +6235,8 @@ E51D7D52208CE08D001FF053 /* CustomModeSetCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomModeSetCell.h; sourceTree = ""; }; E51D7D53208CE08D001FF053 /* CustomModeSetCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomModeSetCell.m; sourceTree = ""; }; E51D7D57208CE120001FF053 /* CustomModeSetCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomModeSetCell.xib; sourceTree = ""; }; + E51D7D59208CF4E7001FF053 /* RuiMeiInputViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiInputViewController.h; sourceTree = ""; }; + E51D7D5A208CF4E7001FF053 /* RuiMeiInputViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiInputViewController.m; sourceTree = ""; }; E547870A20728F380060C2C2 /* back_btn@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_btn@2x.png"; sourceTree = ""; }; E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_1.jpg; sourceTree = ""; }; E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_2.jpg; sourceTree = ""; }; @@ -13775,6 +13778,8 @@ E51D7D4D208CD5C8001FF053 /* RuiMeiCHControl.m */, E51D7D4F208CDB5B001FF053 /* RuiMeiSetViewController.h */, E51D7D50208CDB5B001FF053 /* RuiMeiSetViewController.m */, + E51D7D59208CF4E7001FF053 /* RuiMeiInputViewController.h */, + E51D7D5A208CF4E7001FF053 /* RuiMeiInputViewController.m */, ); path = RuiMei; sourceTree = ""; @@ -16282,6 +16287,7 @@ 88602FB11E124AF900F3DB5D /* NTESSessionCustomContentConfig.m in Sources */, 881F0F4F1D73DF4E0091507E /* BaoGaoViewFirstCell.m in Sources */, 88F5EFBC1D48D08100CC7CAF /* AsyncSocket.m in Sources */, + E51D7D5B208CF4E7001FF053 /* RuiMeiInputViewController.m in Sources */, 881672241EA5DE2B00BEBF23 /* UMComSelectTopicCell.m in Sources */, 883E78BC1D48A5E50030E075 /* FListManager.m in Sources */, 88602A1B1E10BC3400F3DB5D /* NIMContactDataCell.m in Sources */, diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.h new file mode 100644 index 0000000..28a46a1 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.h @@ -0,0 +1,13 @@ +// +// RuiMeiInputViewController.h +// Ifish +// +// Created by Minghao Xue on 2018/4/23. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "IfishDeviceControlNameBaseController.h" + +@interface RuiMeiInputViewController : IfishDeviceControlNameBaseController + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.m new file mode 100644 index 0000000..c5eb32f --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiInputViewController.m @@ -0,0 +1,157 @@ +// +// RuiMeiInputViewController.m +// Ifish +// +// Created by Minghao Xue on 2018/4/23. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "RuiMeiInputViewController.h" +#import "RuSunChangeNameTextViewCell.h" +#define RUSUNCHCELL_CH1 20000 +#define RUSUNCHCELL_CH2 20001 +#define RUSUNCHCELL_CH3 20002 +#define RUSUNCHCELL_CH4 20003 +#define RUSUNCHCELL_JIARE 20004 +#import "RuiMeiCHNameCustom.h" +#import "RuiMeiCHControl.h" +#import "UserExtendataArchaver.h" + +@interface RuiMeiInputViewController () + +@end + +@implementation RuiMeiInputViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.dataSource =self; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + + if (section==0) { + + return 1; + + }else{ + + return 5; + } +} + +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + + return 2; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + + if (indexPath.section==0) { + + return [super baseViewLoadDeviceNameCell:indexPath intable:tableView]; + } + + RuSunChangeNameTextViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"RuSunChangeNameTextViewCell"]; + if (cell==nil) { + cell= [[[NSBundle mainBundle]loadNibNamed:@"RuSunChangeNameTextViewCell" owner:self options:nil]lastObject]; + + } + + //控制原名 + if (indexPath.row==4&&indexPath.section==1) { + cell.lineImgView.image = [UIImage imageNamed:@"redact_line_last"]; + + } + NSArray *titles= @[@"S1",@"S2",@"UV/杀菌",@"冲浪/氧泵",@"加热棒"]; + if (indexPath.section==1) { + cell.chTitle.text = titles[indexPath.row]; + } + + //自定义名字 + RuiMeiCHControl * ruSunch = [RuiMeiCHNameCustom currentdevice:self.device.macAddress]; + if (indexPath.section==1&&indexPath.row==0) { + cell.chName.text = ruSunch.ch1name; + + }else if (indexPath.section==1&&indexPath.row==1){ + cell.chName.text = ruSunch.ch2name; + }else if (indexPath.section==1&&indexPath.row==2){ + cell.chName.text = ruSunch.ch3name; + }else if (indexPath.section==1&&indexPath.row==3){ + cell.chName.text = ruSunch.ch4name; + }else if (indexPath.section==1&&indexPath.row==4){ + cell.chName.text = ruSunch.jiaRe; + } + + cell.chName.delegate = self; + cell.tag = 20000 + indexPath.row; + return cell; +} + +-(void)sureAction +{ + //RuiMeiCHNameCustom 本地处理 保存按钮名称 不与服务器交互 + RuiMeiCHControl *ruSunch = [[RuiMeiCHControl alloc] init]; + RuSunChangeNameTextViewCell*cell1 = [self.view viewWithTag:RUSUNCHCELL_CH1]; + if (cell1.chName.text.length>3) { + [self.view makeToast:@"S1不能超过3个字"]; + return; + } + if (cell1.chName.text.length==0) { + [self.view makeToast:@"S1不能为空"]; + return; + } + + ruSunch.ch1name = cell1.chName.text; + RuSunChangeNameTextViewCell*cell2 = [self.view viewWithTag:RUSUNCHCELL_CH2]; + if (cell2.chName.text.length>3) { + [self.view makeToast:@"S2不能超过3个字"]; + return; + } + if (cell2.chName.text.length==0) { + [self.view makeToast:@"S2不能为空"]; + return; + } + + ruSunch.ch2name = cell2.chName.text; + RuSunChangeNameTextViewCell*cell3 = [self.view viewWithTag:RUSUNCHCELL_CH3]; + if (cell3.chName.text.length>3) { + [self.view makeToast:@"UV/杀菌不能超过3个字"]; + return; + } + if (cell3.chName.text.length==0) { + [self.view makeToast:@"UV/杀菌不能为空"]; + return; + } + + ruSunch.ch3name = cell3.chName.text; + RuSunChangeNameTextViewCell*cell4 = [self.view viewWithTag:RUSUNCHCELL_CH4]; + if (cell4.chName.text.length>3) { + [self.view makeToast:@"冲浪/氧泵不能超过3个字"]; + return; + } + if (cell4.chName.text.length==0) { + [self.view makeToast:@"冲浪/氧泵不能为空"]; + return; + } + ruSunch.ch4name = cell4.chName.text; + + RuSunChangeNameTextViewCell*cell5 = [self.view viewWithTag:RUSUNCHCELL_JIARE]; + if (cell5.chName.text.length>3) { + [self.view makeToast:@"加热棒名不能超过3个字"]; + return; + } + if (cell5.chName.text.length==0) { + [self.view makeToast:@"加热棒名不能为空"]; + return; + } + ruSunch.jiaRe = cell5.chName.text; + + ruSunch.macAd = self.device.macAddress; + + [RuiMeiCHNameCustom saveCHname:ruSunch]; + + [self upLoadDeviceName]; + +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.m index efa4123..06844f2 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.m @@ -21,11 +21,10 @@ #import "XuToWenDuPicview.h" #import "RuSunLightOrder.h" #import "RuSunGuiDeng.h" -#import "RunSun84CHSetViewController.h" #import "RuiMeiSetViewController.h" #import "RuiMeiCHControl.h" #import "RuiMeiCHNameCustom.h" -#import "RuSunInpdViewController.h" +#import "RuiMeiInputViewController.h" #import "HaveHotCoolWenDuPicview.h" @interface RuiMeiViewController () @@ -36,7 +35,7 @@ @property(nonatomic,strong) HaveHotCoolWenDuPicview *wenduPicview; @property(nonatomic,strong) RuiMeiSetViewController *setVC; //@property(nonatomic,strong) RunSunChangeNameViewController *changenameVC; -@property(nonatomic,strong) RuSunInpdViewController *changenameVC; +@property(nonatomic,strong) RuiMeiInputViewController *changenameVC; @end @@ -559,9 +558,7 @@ -(void)shezhiMingCheng { - //_changenameVC = [[RunSunChangeNameViewController alloc] init]; - - _changenameVC = [[RuSunInpdViewController alloc] init]; + _changenameVC = [[RuiMeiInputViewController alloc] init]; _changenameVC.name = self.name.text; _changenameVC.device = self.currentDevice; __weak typeof (self)wself = self;