diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index d8b19fb..5fb3d8e 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2253,11 +2253,19 @@ 88F5EFD81D48D08100CC7CAF /* MMVectorImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF591D48D08100CC7CAF /* MMVectorImage.m */; }; 88F5EFD91D48D08100CC7CAF /* MyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF5C1D48D08100CC7CAF /* MyControl.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 88F740C01ECC28E800876AED /* ShopAddGoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */; }; + C00E7B1D282FBE19000A1E86 /* XuanduoTempratureCorrectView.h in Headers */ = {isa = PBXBuildFile; fileRef = C00E7B1B282FBE19000A1E86 /* XuanduoTempratureCorrectView.h */; }; + C00E7B1E282FBE19000A1E86 /* XuanduoTempratureCorrectView.m in Sources */ = {isa = PBXBuildFile; fileRef = C00E7B1C282FBE19000A1E86 /* XuanduoTempratureCorrectView.m */; }; + C00E7B22282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C00E7B21282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib */; }; + C00E7B262830DB70000A1E86 /* CycleTimerCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C00E7B232830DB70000A1E86 /* CycleTimerCell.h */; }; + C00E7B272830DB70000A1E86 /* CycleTimerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C00E7B242830DB70000A1E86 /* CycleTimerCell.m */; }; + C00E7B282830DB70000A1E86 /* CycleTimerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C00E7B252830DB70000A1E86 /* CycleTimerCell.xib */; }; C017B1E2245ED2D4003151DF /* UIImage+WaterMark.h in Headers */ = {isa = PBXBuildFile; fileRef = C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */; }; C017B1E3245ED2D4003151DF /* UIImage+WaterMark.m in Sources */ = {isa = PBXBuildFile; fileRef = C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */; }; C01B9888282F50E8004FF42D /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = C01B9886282F50E8004FF42D /* UIView+Frame.m */; }; C01B9889282F50E8004FF42D /* UIView+Frame.h in Headers */ = {isa = PBXBuildFile; fileRef = C01B9887282F50E8004FF42D /* UIView+Frame.h */; }; C01B988B282F802E004FF42D /* arrow_right@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C01B988A282F802E004FF42D /* arrow_right@2x.png */; }; + C01B988E282FBC13004FF42D /* XuanduoTempratueCorrectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C01B988C282FBC12004FF42D /* XuanduoTempratueCorrectViewController.m */; }; + C01B988F282FBC13004FF42D /* XuanduoTempratueCorrectViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C01B988D282FBC12004FF42D /* XuanduoTempratueCorrectViewController.h */; }; C024B79E2379668B00509424 /* NSArray+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */; }; C024B79F2379668B00509424 /* AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B78B2379668B00509424 /* AvoidCrash.h */; }; C024B7A02379668B00509424 /* NSString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78C2379668B00509424 /* NSString+AvoidCrash.m */; }; @@ -5753,11 +5761,19 @@ 88F5EF5C1D48D08100CC7CAF /* MyControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyControl.m; sourceTree = ""; }; 88F740BE1ECC28E800876AED /* ShopAddGoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopAddGoodsViewController.h; sourceTree = ""; }; 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopAddGoodsViewController.m; sourceTree = ""; }; + C00E7B1B282FBE19000A1E86 /* XuanduoTempratureCorrectView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XuanduoTempratureCorrectView.h; sourceTree = ""; }; + C00E7B1C282FBE19000A1E86 /* XuanduoTempratureCorrectView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XuanduoTempratureCorrectView.m; sourceTree = ""; }; + C00E7B21282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XuanduoTempratureCorrectView.xib; sourceTree = ""; }; + C00E7B232830DB70000A1E86 /* CycleTimerCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CycleTimerCell.h; sourceTree = ""; }; + C00E7B242830DB70000A1E86 /* CycleTimerCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CycleTimerCell.m; sourceTree = ""; }; + C00E7B252830DB70000A1E86 /* CycleTimerCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CycleTimerCell.xib; sourceTree = ""; }; C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+WaterMark.h"; sourceTree = ""; }; C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WaterMark.m"; sourceTree = ""; }; C01B9886282F50E8004FF42D /* UIView+Frame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = ""; }; C01B9887282F50E8004FF42D /* UIView+Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = ""; }; C01B988A282F802E004FF42D /* arrow_right@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "arrow_right@2x.png"; sourceTree = ""; }; + C01B988C282FBC12004FF42D /* XuanduoTempratueCorrectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XuanduoTempratueCorrectViewController.m; sourceTree = ""; }; + C01B988D282FBC12004FF42D /* XuanduoTempratueCorrectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XuanduoTempratueCorrectViewController.h; sourceTree = ""; }; C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AvoidCrash.m"; sourceTree = ""; }; C024B78B2379668B00509424 /* AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrash.h; sourceTree = ""; }; C024B78C2379668B00509424 /* NSString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AvoidCrash.m"; sourceTree = ""; }; @@ -9719,6 +9735,9 @@ C0F6E1BE243B0A840071ECB9 /* xuanduo3fModel.h */, C0F6E1BF243B0A840071ECB9 /* xuanduo3fModel.m */, FAA732D6227C1DA80062C252 /* Xuanduo2TimerModel.h */, + C00E7B1B282FBE19000A1E86 /* XuanduoTempratureCorrectView.h */, + C00E7B1C282FBE19000A1E86 /* XuanduoTempratureCorrectView.m */, + C00E7B21282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib */, FAA732D7227C1DA80062C252 /* Xuanduo2TimerModel.m */, FA0892EB226C15000084A609 /* Xuanduo2DataUtility.h */, FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */, @@ -9736,6 +9755,8 @@ C0CCEF69280D08C600604601 /* XuanduoSettingController.h */, C0571673282674A3004F113A /* XuanduofishFeedViewController.h */, C0571672282674A3004F113A /* XuanduofishFeedViewController.m */, + C01B988D282FBC12004FF42D /* XuanduoTempratueCorrectViewController.h */, + C01B988C282FBC12004FF42D /* XuanduoTempratueCorrectViewController.m */, C057166E2823D652004F113A /* XuanduoTimerListViewController.h */, C057166F2823D652004F113A /* XuanduoTimerListViewController.m */, C08976B3282119300098B5FA /* XuanduoTimerSettingViewController.h */, @@ -9764,6 +9785,9 @@ FA08930C2275F03F0084A609 /* PlusTableViewCell.m */, FA08930D2275F03F0084A609 /* PlusTableViewCell.xib */, FAFC08202279CB5900B5A07B /* SetTimerCell.h */, + C00E7B232830DB70000A1E86 /* CycleTimerCell.h */, + C00E7B242830DB70000A1E86 /* CycleTimerCell.m */, + C00E7B252830DB70000A1E86 /* CycleTimerCell.xib */, FAFC08212279CB5900B5A07B /* SetTimerCell.m */, FAFC08222279CB5900B5A07B /* SetTimerCell.xib */, ); @@ -13089,9 +13113,11 @@ 3D1C509A221A9EDF0096AE43 /* ConnectFailurePromptView.h in Headers */, CBA6168A228F9AB100ED380D /* ViewController+MASAdditions.h in Headers */, C0EA8A2723AF74F4003DC53B /* SDWebImageManager.h in Headers */, + C00E7B1D282FBE19000A1E86 /* XuanduoTempratureCorrectView.h in Headers */, CBB0244023517947002900D5 /* NSObject+MJCoding.h in Headers */, FA0892ED226C15000084A609 /* Xuanduo2DataUtility.h in Headers */, 3D1C50B7221A9EDF0096AE43 /* YTargetAndAction.h in Headers */, + C00E7B262830DB70000A1E86 /* CycleTimerCell.h in Headers */, 3D1C510A221A9EE00096AE43 /* PlayBaseViewController.h in Headers */, CB484DE222B8C8C80075F050 /* samplefmt.h in Headers */, 2AC8750A26874F7500B6161C /* ESPDatumCode.h in Headers */, @@ -13249,6 +13275,7 @@ CBA61680228F9AB100ED380D /* MASConstraint.h in Headers */, CB484E0622B8C8C80075F050 /* timestamp.h in Headers */, 3D1C512E221A9EE10096AE43 /* CameraBottomHView.h in Headers */, + C01B988F282FBC13004FF42D /* XuanduoTempratueCorrectViewController.h in Headers */, C0EA8A2223AF74F4003DC53B /* UIImage+WebP.h in Headers */, CB484E0E22B8C8C80075F050 /* version.h in Headers */, 3D1C50E4221A9EE00096AE43 /* config.h in Headers */, @@ -13606,6 +13633,7 @@ 881671C51EA5DE2B00BEBF23 /* UMComTableViewCell.xib in Resources */, 8829565B1DBDA3A200E9DDD7 /* certifyView_add.png in Resources */, 882956421DBDA3A200E9DDD7 /* device_upbanner@3x.png in Resources */, + C00E7B282830DB70000A1E86 /* CycleTimerCell.xib in Resources */, 8869B3AC1E6967DF0010F099 /* levelUp_yashark@2x.png in Resources */, 881478111E712A2700BFB79C /* task_choiceLookShops@2x.png in Resources */, 8849EFB81EB883840096CAD7 /* enter_background@3x.png in Resources */, @@ -14472,6 +14500,7 @@ 88696FF71E9CBC2E005D4AFB /* home_iocn_hotsell@2x.png in Resources */, FA08930A2275DD780084A609 /* shajun_big@2x.png in Resources */, 882957021DBDA3A300E9DDD7 /* PFkilLlight_off.png in Resources */, + C00E7B22282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib in Resources */, 886512061E97966400BABDF1 /* task_shareIfishApp@3x.png in Resources */, 8829569E1DBDA3A200E9DDD7 /* YesbtnBc.png in Resources */, 8871FB1F1EBC822B0038E99A /* select_camera@2x.png in Resources */, @@ -14978,6 +15007,7 @@ 881671AE1EA5DE2B00BEBF23 /* UMComUserUpdateDataController.m in Sources */, 885C43B71E89F79D00685A2E /* IfishLiveRecommendListViewController.m in Sources */, 8816721C1EA5DE2B00BEBF23 /* UMComSimplicityFindTableViewCell.m in Sources */, + C00E7B1E282FBE19000A1E86 /* XuanduoTempratureCorrectView.m in Sources */, 88597ABD1E56BAF1003D0E5C /* WBSPopShareView.m in Sources */, 8816720E1EA5DE2B00BEBF23 /* UMComProgressHUD.m in Sources */, 886185C11EF2228000459AD1 /* ThreeControlNameViewController.m in Sources */, @@ -14990,6 +15020,7 @@ 881672251EA5DE2B00BEBF23 /* UMComSelectTopicViewController.m in Sources */, 3D1C5140221A9EE10096AE43 /* BootomViewSoketBackMasgConreol.m in Sources */, 883E78601D48A5E50030E075 /* LeftViewController.m in Sources */, + C01B988E282FBC13004FF42D /* XuanduoTempratueCorrectViewController.m in Sources */, 3D1C511A221A9EE00096AE43 /* ShotScreenImgViewController.m in Sources */, 2AC8751426874F7500B6161C /* ESP_CRC8.m in Sources */, 883E78FA1D48A5E50030E075 /* LogInViewController.m in Sources */, @@ -15716,6 +15747,7 @@ 3D1C512C221A9EE10096AE43 /* IfishRecVideoViewCell.m in Sources */, 881671FD1EA5DE2B00BEBF23 /* UMAssetsCollectionController.m in Sources */, 88F5EFD61D48D08100CC7CAF /* MMProgressHUDWindow.m in Sources */, + C00E7B272830DB70000A1E86 /* CycleTimerCell.m in Sources */, 881671F61EA5DE2B00BEBF23 /* UMComMenuControlView.m in Sources */, 883E78F61D48A5E50030E075 /* SetViewController.m in Sources */, 8876A5881BB83447007A4B54 /* main.m in Sources */, diff --git a/Ifish/Utinitys/dataUnity/dataContorl.m b/Ifish/Utinitys/dataUnity/dataContorl.m index b1b86dd..e5b4b5b 100644 --- a/Ifish/Utinitys/dataUnity/dataContorl.m +++ b/Ifish/Utinitys/dataUnity/dataContorl.m @@ -185,22 +185,33 @@ NSLog(@"------字符串=======%@",unicodeString); return unicodeString; } -//时间转四位十六进制 如01:15——> 010f +//时间转四位或6位十六进制 如01:15——> 010f +(NSString*)dateStringToHexString:(NSString *)dateString{ //NSString*hour=[dateString substringWithRange:NSMakeRange(0, 2)];// 0~23 小时 + NSArray*array=[dateString componentsSeparatedByString:@":"]; + NSRange range=[dateString rangeOfString:@":"]; - NSString*hour=[dateString substringToIndex:range.location]; + NSString*hour=@""; + if (array.count) + { + hour=array[0]; + } // NSString*minite=[dateString substringWithRange:NSMakeRange(3, 2)];// 0~59 分钟 - NSString*minite=[dateString substringFromIndex:range.location+1]; + NSString*minite=@""; + if (array.count>1) + { + minite=array[1]; + } + NSString*second=@""; + if (array.count>2) + { + second=array[2]; + } NSString*hexHour=@"";// NSString*hexMinite=@""; -// if ([hour hasPrefix:@"0"]) { -// hexHour=[NSString stringWithFormat:@"0%@",[[NSString alloc] initWithFormat:@"%1x",[hour intValue]]]; -// // NSLog(@"hex0带 %@",hexHour); -// -// -// }else{ + NSString*hexSecond=@""; + hexHour=[NSString stringWithFormat:@"%@",[[NSString alloc] initWithFormat:@"%1x",[hour intValue]]]; // NSLog(@"hex %@",hexHour); // } @@ -211,6 +222,15 @@ hexMinite=[NSString stringWithFormat:@"%@",[[NSString alloc] initWithFormat:@"%1x",[minite intValue]]];; } + if (second.length) + { + if ([hexSecond hasPrefix:@"0"]) { + hexSecond=[NSString stringWithFormat:@"0%@",[[NSString alloc] initWithFormat:@"%1x",[second intValue]]]; + }else{ + hexSecond=[NSString stringWithFormat:@"%@",[[NSString alloc] initWithFormat:@"%1x",[second intValue]]];; + } + } + if (hexHour.length==1) { hexHour=[NSString stringWithFormat:@"0%@",hexHour]; @@ -218,8 +238,15 @@ if (hexMinite.length==1) { hexMinite=[NSString stringWithFormat:@"0%@",hexMinite]; } + if (second.length) + { + if (hexSecond.length==1) { + hexSecond=[NSString stringWithFormat:@"0%@",hexSecond]; + } + } + - NSString*fomatString=[NSString stringWithFormat:@"%@%@",hexHour,hexMinite]; + NSString*fomatString=[NSString stringWithFormat:@"%@%@%@",hexHour,hexMinite,hexSecond]; return fomatString; @@ -254,11 +281,12 @@ } return siWeihexString; } -//四位 十六进制转时间 如 010f——> 01:15 +//四位或6位 十六进制转时间 如 010f——> 01:15 +(NSString*)hexStringToDateString:(NSString*)hexString{ NSString*shiString=@""; NSString*fenString=@""; + NSString*miaoString=@""; UInt64 shi =strtoul([[hexString substringWithRange:NSMakeRange(0, 2)] UTF8String], 0, 16); if(shi>23) { @@ -300,8 +328,31 @@ ]; // NSLog(@"str4 %@",fenString); } + if (hexString.length>=6) + { + UInt64 sec =strtoul([[hexString substringWithRange:NSMakeRange(4, 2)] UTF8String], 0, 16); + if(sec>59) + { + sec=59; + } + + if (sec<=9) { + miaoString=[NSString stringWithFormat:@"0%llu",fen + ]; + // NSLog(@"str3 %@",fenString); + }else{ + miaoString=[NSString stringWithFormat:@"%llu",fen + ]; + // NSLog(@"str4 %@",fenString); + } + } + + NSString*formatString=[NSString stringWithFormat:@"%@:%@",shiString,fenString]; + if (miaoString.length) { + [formatString stringByAppendingFormat:@":%@",miaoString]; + } //NSLog(@"str5 %@",formatString); diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.h new file mode 100644 index 0000000..f98d93b --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.h @@ -0,0 +1,19 @@ +// +// CycleTimerCell.h +// Ifish +// +// Created by 祝发冬 on 2022/5/15. +// Copyright © 2022 lianlian. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CycleTimerCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UILabel *openTilmeLabel; +@property (weak, nonatomic) IBOutlet UILabel *closeTimeLabel; +@property (nonatomic,weak) id model; +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.m new file mode 100644 index 0000000..8696eae --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.m @@ -0,0 +1,24 @@ +// +// CycleTimerCell.m +// Ifish +// +// Created by 祝发冬 on 2022/5/15. +// Copyright © 2022 lianlian. All rights reserved. +// + +#import "CycleTimerCell.h" + +@implementation CycleTimerCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.xib new file mode 100644 index 0000000..d84a644 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/CycleTimerCell.xib @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m index 3ed49c1..aeea411 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m @@ -245,11 +245,20 @@ { xuanduocycleModel.lightNumber = [dataStr substringWithRange:NSMakeRange(30, 2)]; - xuanduocycleModel.lastTime = [dataStr substringWithRange:NSMakeRange(32, 4)]; - xuanduocycleModel.gapTime = [dataStr substringWithRange:NSMakeRange(36, 4)]; - xuanduocycleModel.status = [dataStr substringWithRange:NSMakeRange(40, 2)]; + if([type isEqualToString:DECICE_TYPE_XUANDUO5F]||[type isEqualToString:DECICE_TYPE_XUANDUO4F]) + { + //时分秒打开关闭 各6字节 + xuanduocycleModel.openTime = [dataStr substringWithRange:NSMakeRange(32, 6)]; + xuanduocycleModel.closeTime = [dataStr substringWithRange:NSMakeRange(38, 6)]; + + } + else + { + xuanduocycleModel.lastTime = [dataStr substringWithRange:NSMakeRange(32, 4)]; + xuanduocycleModel.gapTime = [dataStr substringWithRange:NSMakeRange(36, 4)]; + xuanduocycleModel.status = [dataStr substringWithRange:NSMakeRange(40, 2)]; - + } } @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m index 99f523c..84612d5 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m @@ -768,7 +768,7 @@ static NSString *setTimerflag = @"SetTimerCell"; - (void)addTimer:(UIButton *)btn { _mydatepicView=[[MydatePickerView alloc]init]; - _mydatepicView.isNewXuanduo = YES; + _mydatepicView.pickerType = @"xuanduo";; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h index ae5fc22..cf30bd5 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h @@ -52,6 +52,13 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSString *lastTime; @property (nonatomic, strong) NSString *gapTime; @property (nonatomic, strong) NSString *status; +//设备类型新增 +@property (nonatomic, strong) NSString *deviceType; +//打开持续时间 时分秒 6字节 +@property (nonatomic, strong) NSString *openTime; +//关闭持续时间 时分秒 6字节 +@property (nonatomic, strong) NSString *closeTime; + @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoSettingController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoSettingController.m index 7850864..3f07eb8 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoSettingController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoSettingController.m @@ -29,6 +29,7 @@ #import "NSString+Add.h" #import "XuToControlName.h" #import "UserExtendataArchaver.h" +#import "XuanduoTempratueCorrectViewController.h" #import "XuanduoTimerListViewController.h" #define kBtnTag 500 @@ -540,6 +541,20 @@ static NSString *setTimerflag = @"SetTimerCell"; _settingVC.dataModel = self.dataModel; [self.navigationController pushViewController:_settingVC animated:YES]; } + else if (current==2) + { + XuanduoTempratueCorrectViewController *_settingVC = [[XuanduoTempratueCorrectViewController alloc] init]; + _settingVC.currentdevice = self.currentdevice; + _settingVC.dataModel = self.dataModel; + [self.navigationController pushViewController:_settingVC animated:YES]; + } + else if (current==3) + { + XuanduofishFeedViewController *_settingVC = [[XuanduofishFeedViewController alloc] init]; + _settingVC.currentdevice = self.currentdevice; + _settingVC.dataModel = self.dataModel; + [self.navigationController pushViewController:_settingVC animated:YES]; + } } @@ -672,7 +687,7 @@ static NSString *setTimerflag = @"SetTimerCell"; - (void)addTimer:(UIButton *)btn { _mydatepicView=[[MydatePickerView alloc]init]; - _mydatepicView.isNewXuanduo = YES; + _mydatepicView.pickerType = @"xuanduo"; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.h new file mode 100644 index 0000000..b6c3d1d --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.h @@ -0,0 +1,28 @@ +// +// Xuanduo2SettingController.h +// Ifish +// +// Created by Alex on 2019/4/28. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import "FatherController.h" +#import "IfishDeviceInfo.h" +#import "xuanduo3fModel.h" +#import "ReadTimerModel.h" +#import "XuanduoTimerSettingViewController.h" +NS_ASSUME_NONNULL_BEGIN + +@class Xuanduo2Model; + +@interface XuanduoTempratueCorrectViewController : FatherController + +@property (nonatomic,strong) UIActivityIndicatorView*indicatorView; +@property (nonatomic ,strong) id dataModel; +@property(nonatomic,strong) DeviceModel* currentdevice; +@property (nonatomic, strong) ReadTimerModel *readMode; +- (void)refreshWithData:(id)model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m new file mode 100644 index 0000000..197dee2 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratueCorrectViewController.m @@ -0,0 +1,1626 @@ +// +// Xuanduo2SettingController.m +// Ifish +// +// Created by Alex on 2019/4/28. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import "XuanduoTempratueCorrectViewController.h" +#import "UINavigationBar+Background.h" +#import "TemperatureSetCell.h" +#import "ChangeWaterCell.h" +#import "Xuanduo2Model.h" +#import "TemperatureSetModel.h" +#import "setWaringTpModel.h" +#import "remindCyclePic.h" +#import "MyPickerView.h" +#import "PlusTableViewCell.h" +#import "SetTimerCell.h" +#import "XuanduoSectionHeaderView.h" +#import "XuanduoSelectHeader.h" +#import "MydatePickerView.h" +#import "SetTimerModel.h" +#import "ReadTimerModel.h" +#import "Xuanduo2DataUtility.h" +#import "Xuanduo2TimerModel.h" +#import "IfishDeviceInfo.h" +#import "NSString+Add.h" +#import "XuToControlName.h" +#import "UserExtendataArchaver.h" +#import "TimerTypeTableViewCell.h" + +#define kBtnTag 500 +#define kSwitchBtnTag 600 +static NSString *temperatureCellid = @"TemperatureSetCell"; +static NSString *changeWaterCellid = @"ChangeWaterCell"; +static NSString *addCellid = @"PlusTableViewCell"; +static NSString *plusflag = @"plusCell"; +static NSString *setTimerflag = @"SetTimerCell"; +static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; + + + +@interface XuanduoTempratueCorrectViewController () +@property(nonatomic,strong) setRemindWaterModel *waterInfmodel; +@property(nonatomic,strong) Xuanduo2TimerModel *timerModel; +@property(nonatomic,strong) XuanduoCycleModel *cycleModel; + +@property (nonatomic,strong) NSMutableDictionary *timeDic; +@property(nonatomic,copy) NSString *nextChangeDateLabel; +@property(nonatomic,strong) MyHud *XuTohud; + +@end + +@implementation XuanduoTempratueCorrectViewController +{ + NSString *_wenduString; + NSIndexPath *_indexPath; + MyPickerView *_mypicView; + NSArray *_titieArr; + NSArray *_imgArr; + remindCyclePic*_remindPic; + BOOL _huanShuiSwitchIsOn; + NSInteger _selectSection; + MydatePickerView*_mydatepicView; + +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + if (_currentdevice) { + [IFISHHTTPTOOL getRemindWaterInfWith:_currentdevice.deviceId huishuiInfo:^(setRemindWaterModel *remindModel) { + + self.waterInfmodel=remindModel; + + NSUserDefaults*defuat=[NSUserDefaults standardUserDefaults]; + + [defuat setInteger:self.waterInfmodel.remindcycle forKey:@"xuto2picResult"]; + [defuat synchronize]; + self.nextChangeDateLabel=self.waterInfmodel.remindDate; + + [self.tableView reloadData]; + }]; + } + [Socketsingleton sharedInstance].communiteDelegate = self; + //关闭打开的section + _selectSection = -1; + [self.tableView reloadData]; + + + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setup]; + [self connect]; +} + +- (void)viewWillDisappear:(BOOL)animated{ + [_indicatorView stopAnimating]; +} + +- (void)setup { + [self.navigationController.navigationBar resetBackgroundImage]; + + NSString*title=@"温度校准"; + + [self addTitleViewWithTitle:title]; + [self refreshWithData:self.dataModel]; + [self setupTable]; + [self creatIndicatorView]; + [Socketsingleton sharedInstance].communiteDelegate = self; +} + +- (void)refreshWithData:(Xuanduo3fModel*)model { + + NSString*low = model.miniTemp; + NSString*heigh = model.maxTemp; + UInt64 lowten = [dataContorl hexToTen:low]; + UInt64 heighten = [dataContorl hexToTen:heigh]; + float formatlow = lowten/10; + float formatheigh = heighten/10; + _wenduString = [NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh]; +} + +- (void)setupTable { + + XuToControlName *name = [UserExtendataArchaver currentNewXuToControlName:self.currentdevice.macAddress]; + if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + name=[UserExtendataArchaver currentPetsXuToControlName:self.currentdevice.macAddress]; + } + // _titieArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯"]; + _titieArr = @[name.xunhuanPump,name.zengyangPump,name.light1,name.light2,name.zaolangPump,name.shajunLight]; + + _imgArr = @[@"循环棒",@"增氧泵",@"灯光1",@"灯光2",@"造浪",@"杀菌"]; + + + + if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + _titieArr = @[name.xunhuanPump,name.zaolangPump,name.light1]; + _imgArr = @[@"照明开",@"换气开",@"杀菌开"]; + } + + + + _selectSection = -1; + for (int i = 0; i<_titieArr.count; i++) { + NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0]; + if (![_titieArr[i] isEqualToString:@"杀菌"]) + { + [dataArr addObject:plusflag]; + } + + [self.timeDic setObject:dataArr forKey:_titieArr[i]]; + } + self.tableView.backgroundColor=COLOR_MIAN; + self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone; + [self.tableView registerNib:[UINib nibWithNibName:temperatureCellid bundle:nil] forCellReuseIdentifier:temperatureCellid]; + [self.tableView registerNib:[UINib nibWithNibName:changeWaterCellid bundle:nil] forCellReuseIdentifier:changeWaterCellid]; + [self.tableView registerNib:[UINib nibWithNibName:addCellid bundle:nil] forCellReuseIdentifier:addCellid]; + //[self.tableView registerNib:[UINib nibWithNibName:timerTypeFlag bundle:nil] forCellReuseIdentifier:timerTypeFlag]; + [self.tableView registerNib:[UINib nibWithNibName:setTimerflag bundle:nil] forCellReuseIdentifier:setTimerflag]; +} + +-(void)clickCell:(TimerTypeTableViewCell *)cell button:(UIButton *)button timerType:(NSInteger *)type +{ + XuanduoTimerSettingViewController *_settingVC = [[XuanduoTimerSettingViewController alloc] init]; + _settingVC.currentdevice = self.currentdevice; + _settingVC.dataModel = self.dataModel; + _settingVC.readMode=self.readMode; + _settingVC.timerType=type; + [self.navigationController pushViewController:_settingVC animated:YES]; +} +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.section == 0){ + TemperatureSetCell *cell = [tableView dequeueReusableCellWithIdentifier:temperatureCellid]; + TemperatureSetModel *model=[[TemperatureSetModel alloc]init]; + model.title = @"定时设置"; + cell.titleLabel.text = model.title; + NSLog(@"wendu str = %@",_wenduString); + model.temperatureLabel = _wenduString; + cell.temperaturelabel.text = model.temperatureLabel; + [cell.temPSwitch addTarget:self action:@selector(xuTotempSwitchAction:) forControlEvents:UIControlEventTouchUpInside]; + cell.temperaturelabel.hidden=YES; + cell.temPSwitch.hidden=YES; + cell.icon.hidden=NO; + cell.icon.image=[UIImage imageNamed:@"定时"]; + cell.titileLabelLayout.constant=40; + if (self.dataModel) { + Xuanduo2Model*model=self.dataModel; + if ([model.alarmSwitch 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 == 1 && indexPath.row == 0){ + if (![self.currentdevice.waterRemind isEqual:[NSNull null]]) { + ChangeWaterCell *cell = [tableView dequeueReusableCellWithIdentifier:changeWaterCellid]; + [cell.ChangeWaterSwitch addTarget:self action:@selector(xuTochangeWaterSwitch:) forControlEvents:UIControlEventTouchUpInside]; + + if ([self.waterInfmodel.waterremind isEqualToString:@"1"]) { + [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; + cell.ChangeWaterSwitch.selected = NO; + cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstSetCell"]]; + _huanShuiSwitchIsOn=YES; + }else{ + [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; + cell.ChangeWaterSwitch.selected = YES; + _huanShuiSwitchIsOn=NO; + cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]]; + } + + if (self.waterInfmodel.remindcycle == 0) { + //在未获取换水信息时暂时显示 + cell.huanshuiDaylabel.text=@"换水时间"; + if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + cell.huanshuiDaylabel.text=@"杀菌时间"; + cell.titleLabel.text=@"杀菌提醒"; + } + }else{ + + cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle]; + + } + + + return cell; + + } + }else if (indexPath.section==1 && indexPath.row == 1){ + + static NSString*nextHuanShuiLablecellId=@"labelcell"; + UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:nextHuanShuiLablecellId]; + if (cell==nil) { + cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nextHuanShuiLablecellId]; + } + if (_huanShuiSwitchIsOn) { + + cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.waterInfmodel.remindDate]; + if (!self.waterInfmodel.remindDate) { + cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.nextChangeDateLabel]; + } + + if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.waterInfmodel.remindDate]; + if (!self.waterInfmodel.remindDate) { + cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.nextChangeDateLabel]; + } + + } + + cell.textLabel.font=[UIFont systemFontOfSize:15]; + [cell.textLabel sizeToFit]; + + cell.textLabel.textColor =[UIColor colorWithRed:146.0/256.0 green:146.0/256.0 blue:146.0/256.0 alpha:1]; + cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]]; + + } + else{ + cell.textLabel.text=@""; + } + cell.userInteractionEnabled = NO; + return cell; + + }else if(indexPath.section -2== _titieArr.count && indexPath.row == 0&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + TemperatureSetCell *cell = [tableView dequeueReusableCellWithIdentifier:temperatureCellid]; + TemperatureSetModel *model=[[TemperatureSetModel alloc]init]; + model.title = @"恒温设置"; + cell.titleLabel.text = model.title; + + Xuanduo3fModel*xmodel=(Xuanduo3fModel*)_dataModel; + NSString*heating = xmodel.heatingTemperature; + UInt64 heat = [dataContorl hexToTen:heating]; + + float formatheat = heat/10; + model.temperatureLabel = [NSString stringWithFormat:@"%f",formatheat]; + cell.temPSwitch.hidden=YES; + cell.temperaturelabel.frame=cell.temPSwitch.frame; + + Xuanduo3fModel*model3=self.dataModel; + int mac=[dataContorl hexToTen:model3.heatingTemperature]; + + //float TPlabel=mac/10+(mac%10)*0.1; + float temp = mac/10.0; + NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp]; + cell.temperaturelabel.textAlignment=NSTextAlignmentRight; + [cell.temperaturelabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"℃"]]]; + + + + + return cell; + + } + else { + if (indexPath.section - 2 < _titieArr.count && _selectSection == indexPath.section) { + NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]]; + BOOL havePlus = [dataArr containsObject:plusflag]; + if (havePlus && (indexPath.row == dataArr.count-1)) { + TimerTypeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:timerTypeFlag]; + if (!cell) { + cell=[[TimerTypeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:timerTypeFlag]; + } + cell.delegate=self; + return cell; + }else { + SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; + cell.switchBtn.tag = kSwitchBtnTag + indexPath.row; + [cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside]; + XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row]; + cell.model=group; + if ([group isKindOfClass:[XuanduoTimerGroup class]]) + { + BOOL isOn = NO; + if ([group.status isEqualToString:@"01"]) { + isOn = YES; + } + [cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + else if([group isKindOfClass:[XuanduoCycleModel class]]) + { + XuanduoCycleModel*model=group; + BOOL isOn = NO; + if ([model.status isEqualToString:@"00"]) { + isOn = YES; + } + + + + [cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + return cell; + } + } + } + return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@""]; +} + +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + return 50; + }else if (indexPath.section == 1 && indexPath.row == 0){ + return 0; + }else if (indexPath.section == 1 && indexPath.row == 1){ + if (!_huanShuiSwitchIsOn) { + }else { + return 0; + } + }else if (indexPath.section - 2 <_titieArr.count) { + NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]]; + BOOL havePlus = [dataArr containsObject:plusflag]; + if (_selectSection == indexPath.section) { + if (havePlus && indexPath.row == dataArr.count - 1) { + return 40; + }else{ + return 50; + } + }else { + return 0; + } + } + else if(indexPath.section - 2 ==_titieArr.count&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + return 50; + } + + return 0; +} + +#pragma mark tableView 头视图和脚视图 +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + if (section == 0) { + return 5; + }else if (section == 2){ + return 40; + }else if (section == 3){ + return 40; + }else if (section == 4){ + return 40; + }else if (section == 5){ + + return [self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]?0:40; + }else if (section == 6){ + return 40; + }else if (section == 7){ + return 40; + }else { + return CGFLOAT_MIN; + } + +} + +- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + if (section == 0) { + UIView *oneHeader = [[UIView alloc] init]; + oneHeader.backgroundColor = COLOR_MIAN; + return oneHeader; + }else if(section == 2){ + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + }else if(section == 3){ + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + }else if(section == 4){ + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + }else if(section == 5){ + if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + UIView *oneHeader = [[UIView alloc] init]; + oneHeader.backgroundColor = COLOR_MIAN; + return oneHeader; + } + else + { + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + } + + }else if(section == 6){ + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + }else if(section == 7){ + XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView]; + headerView.controlBtn.tag = kBtnTag + section; + if (_selectSection == section) { + headerView.controlBtn.selected = YES; + } + [headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside]; + [headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]]; + return headerView; + } + + return nil; +} + +#pragma mark tableView 点击事件 + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + _indexPath = indexPath; + if (indexPath.section==0) { +// _mypicView=[[MyPickerView alloc]init]; +// +// _mypicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); +// [self.view.window addSubview:_mypicView]; +// [_mypicView.sureButton addTarget:self action:@selector(mypicViewRemoveByDone) forControlEvents:UIControlEventTouchUpInside]; +// [self temperatureMainQueue]; + + }else if (indexPath.section==1){ + //换水提醒日期选择 + _remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:self.currentdevice.type]; + + _remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + _remindPic.type=self.currentdevice.type; + [self.view.window addSubview:_remindPic]; + [_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside]; + [self huanShuiMainQueue]; + }else if(indexPath.section-2==_titieArr.count){ + //恒温设置 + _remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"temp"]; + _remindPic.type=@"temp"; + + _remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + [self.view.window addSubview:_remindPic]; + [_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside]; + [self huanShuiMainQueue]; + }else { + SetTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath]; + if ([cell isKindOfClass:[PlusTableViewCell class]]) { + return; + } + else if([cell isKindOfClass:[SetTimerCell class]]&&[cell.model isKindOfClass:[XuanduoCycleModel class]]) + { + //恒温设置 + _cycleModel=cell.model; + _remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"cycle"]; + _remindPic.type=@"cycle"; + + _remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + [self.view.window addSubview:_remindPic]; + [_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside]; + [self huanShuiMainQueue]; + } + else + { + [self addTimer:nil]; + + } + } +} + +-(void)temperatureMainQueue{ + NSArray*lowArr=[_mypicView.picArr objectAtIndex:0]; + NSArray*heighArr=[_mypicView.picArr objectAtIndex:2]; + for (NSInteger i=0; i=0 && [readTimer isEqualToString:@"0116"]) { + if (!_timerModel) { + _timerModel = [[Xuanduo2TimerModel alloc] init]; + _timerModel.groupModelArr = [NSMutableArray array]; + }else { + [_timerModel.groupModelArr removeAllObjects]; + } + [Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type]; + NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]]; + [dataArr removeAllObjects]; + [dataArr addObject:plusflag]; + [dataArr addObjectsFromArray:_timerModel.groupModelArr]; + BOOL havePlus = [dataArr containsObject:plusflag]; + if (havePlus && dataArr.count > 10) { + [dataArr removeObjectAtIndex:0]; + }else if (!havePlus && dataArr.count < 10){ + [dataArr insertObject:plusflag atIndex:0]; + } + NSLog(@"dataarr.count = %ld",dataArr.count); + + + } + else if (_selectSection-2<_titieArr.count && _selectSection-2>=0 && [readTimer isEqualToString:@"0119"]) { + + _cycleModel=[[XuanduoCycleModel alloc]init]; + [Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type]; + NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]]; + [dataArr removeAllObjects]; + + [dataArr addObject:_cycleModel]; + + + + } + if ([readTimer isEqualToString:@"0108"] || [readTimer isEqualToString:@"0105"]) { + [Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentdevice.type]; + [self refreshWithData:self.dataModel]; + + } + [self.XuTohud hidmyHud]; + [self.indicatorView stopAnimating]; + [self.tableView reloadData]; +} + +-(void)ifishDeviceLogInFail{ + +} + +-(void)ifishDeviceLogInSuccees{ + +} + +-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{ + +} + + + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.h new file mode 100644 index 0000000..1118c61 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.h @@ -0,0 +1,17 @@ +// +// XuanduoTempratureCorrectView.h +// Ifish +// +// Created by 祝发冬 on 2022/5/14. +// Copyright © 2022 lianlian. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XuanduoTempratureCorrectView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m new file mode 100644 index 0000000..79f45ad --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.m @@ -0,0 +1,21 @@ +// +// XuanduoTempratureCorrectView.m +// Ifish +// +// Created by 祝发冬 on 2022/5/14. +// Copyright © 2022 lianlian. All rights reserved. +// + +#import "XuanduoTempratureCorrectView.h" + +@implementation XuanduoTempratureCorrectView + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib new file mode 100644 index 0000000..b3921d8 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTempratureCorrectView.xib @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerListViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerListViewController.m index a101fc2..8e23542 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerListViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerListViewController.m @@ -806,7 +806,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; - (void)addTimer:(UIButton *)btn { _mydatepicView=[[MydatePickerView alloc]init]; - _mydatepicView.isNewXuanduo = YES; + _mydatepicView.pickerType = @"xuanduo";; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m index 7e03b24..0aa3277 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m @@ -29,6 +29,7 @@ #import "XuToControlName.h" #import "UserExtendataArchaver.h" #import "TimerTypeTableViewCell.h" +#import "CycleTimerCell.h" #define kBtnTag 500 #define kSwitchBtnTag 600 @@ -38,6 +39,7 @@ static NSString *addCellid = @"PlusTableViewCell"; static NSString *plusflag = @"plusCell"; static NSString *setTimerflag = @"SetTimerCell"; static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; +static NSString *cycleTimerflag = @"CycleTimerCell"; @@ -139,7 +141,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; _selectSection = 0; - if (self.timerType==1||self.timerType==3) + if (self.timerType==1||self.timerType==3||self.timerType==2) { for (int i = 0; i<_titieArr.count; i++) { NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0]; @@ -155,11 +157,11 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; [self.tableView registerNib:[UINib nibWithNibName:temperatureCellid bundle:nil] forCellReuseIdentifier:temperatureCellid]; [self.tableView registerNib:[UINib nibWithNibName:changeWaterCellid bundle:nil] forCellReuseIdentifier:changeWaterCellid]; [self.tableView registerNib:[UINib nibWithNibName:addCellid bundle:nil] forCellReuseIdentifier:addCellid]; - //[self.tableView registerNib:[UINib nibWithNibName:timerTypeFlag bundle:nil] forCellReuseIdentifier:timerTypeFlag]; + [self.tableView registerNib:[UINib nibWithNibName:cycleTimerflag bundle:nil] forCellReuseIdentifier:cycleTimerflag]; [self.tableView registerNib:[UINib nibWithNibName:setTimerflag bundle:nil] forCellReuseIdentifier:setTimerflag]; } --(void)clickCell:(TimerTypeTableViewCell *)cell button:(UIButton *)button timerType:(NSInteger *)type +-(void)clickCell:(TimerTypeTableViewCell *)cell button:(UIButton *)button timerType:(NSInteger )type { } @@ -242,41 +244,24 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; else if (self.timerType==2) {//循环开关 NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]]; BOOL havePlus = [dataArr containsObject:plusflag]; - if (havePlus && (indexPath.row == dataArr.count-1)) { - PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath]; - cell.addTimerBtn.tag = kBtnTag + indexPath.section; - [cell.addTimerBtn addTarget:self action:@selector(addTimer:) forControlEvents:UIControlEventTouchUpInside]; - return cell; - - }else { - SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; - cell.switchBtn.tag = kSwitchBtnTag + indexPath.row; - [cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside]; - XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row]; - cell.model=group; - if ([group isKindOfClass:[XuanduoTimerGroup class]]) + { + CycleTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; + + + cell.model=_cycleModel; + if([_cycleModel isKindOfClass:[XuanduoCycleModel class]]) { - BOOL isOn = NO; - if ([group.status isEqualToString:@"01"]) { - isOn = YES; - } - [cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn]; + + cell.openTilmeLabel.text=[dataContorl hexStringToDateString:_cycleModel.openTime]; + cell.closeTimeLabel.text=[dataContorl hexStringToDateString:_cycleModel.closeTime]; + + cell.selectionStyle = UITableViewCellSelectionStyleNone; } - else if([group isKindOfClass:[XuanduoCycleModel class]]) + else { - XuanduoCycleModel*model=group; - BOOL isOn = NO; - if ([model.status isEqualToString:@"00"]) { - isOn = YES; - } - - - [cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - } return cell; } @@ -291,35 +276,19 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; return cell; }else { - SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; - cell.switchBtn.tag = kSwitchBtnTag + indexPath.row; - [cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside]; - XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row]; - cell.model=group; - if ([group isKindOfClass:[XuanduoTimerGroup class]]) + CycleTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:cycleTimerflag forIndexPath:indexPath]; + + + cell.model=_cycleModel; + if (_cycleModel) { - BOOL isOn = NO; - if ([group.status isEqualToString:@"01"]) { - isOn = YES; - } - [cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - } - else if([group isKindOfClass:[XuanduoCycleModel class]]) - { - XuanduoCycleModel*model=group; - BOOL isOn = NO; - if ([model.status isEqualToString:@"00"]) { - isOn = YES; - } - - - - [cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn]; + NSString*hexDateString1=[dataContorl dateStringToHexString:_cycleModel.openTime]; + NSString*hexDateString2=[dataContorl dateStringToHexString:_cycleModel.closeTime]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } + + return cell; } } @@ -410,7 +379,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { _indexPath = indexPath; - { + if(self.timerType==1||self.timerType==3) + { SetTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath]; if ([cell isKindOfClass:[PlusTableViewCell class]]) { return; @@ -433,6 +403,22 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; } } + else if(self.timerType==2) + { + CycleTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath]; + if ([cell isKindOfClass:[PlusTableViewCell class]]) { + return; + } + else if([cell isKindOfClass:[CycleTimerCell class]]&&[cell.model isKindOfClass:[XuanduoCycleModel class]]) + { + [self addCycleTimer:nil]; + } + else + { + + + } + } } -(void)temperatureMainQueue{ @@ -740,7 +726,21 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; - (void)addTimer:(UIButton *)btn { _mydatepicView=[[MydatePickerView alloc]init]; - _mydatepicView.isNewXuanduo = YES; + _mydatepicView.pickerType = @"xuanduo"; + _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); + [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; + [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; + if (!btn) { + _mydatepicView.haveDelected = YES; + [self resetPickerView]; + } + // 设置pickerView 默认选择行 + + [self.view.window addSubview:_mydatepicView]; +} +- (void)addCycleTimer:(UIButton *)btn { + _mydatepicView=[[MydatePickerView alloc]init]; + _mydatepicView.pickerType = @"cycleType"; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; @@ -753,18 +753,29 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; [self.view.window addSubview:_mydatepicView]; } + - (void)resetPickerView { NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]]; BOOL havePlus = [dataArr containsObject:plusflag]; + NSArray *startArr ; + NSArray *endArr; XuanduoTimerGroup *model = nil; - if (havePlus) { - model = dataArr[_indexPath.row + 1]; - }else { - model = dataArr[_indexPath.row]; + if ([_mydatepicView.pickerType isEqualToString:@"cycleType"]) + { + } - NSArray *startArr = [model.startTime componentsSeparatedByString:@":"]; - NSArray *endArr = [model.endTime componentsSeparatedByString:@":"]; - NSLog(@"stat %@ end %@",startArr,endArr); + else + { + if (havePlus) { + model = dataArr[_indexPath.row + 1]; + }else { + model = dataArr[_indexPath.row]; + } + startArr = [model.startTime componentsSeparatedByString:@":"]; + endArr = [model.endTime componentsSeparatedByString:@":"]; + NSLog(@"stat %@ end %@",startArr,endArr); + } + if (startArr.count == 2 && endArr.count == 2) { NSInteger row1 = [[_mydatepicView.dataArr objectAtIndex:0] indexOfObject:startArr[0]]; if (row1==NSNotFound) @@ -800,133 +811,311 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; _mydatepicView.endString1 = endArr[1]; } + else if (startArr.count == 3 && endArr.count == 3) { + NSInteger row1 = [[_mydatepicView.dataArr objectAtIndex:0] indexOfObject:startArr[0]]; + if (row1==NSNotFound) + { + row1=0; + } + [_mydatepicView.picView selectRow:row1 inComponent:0 animated:NO]; + NSInteger row2 = [[_mydatepicView.dataArr objectAtIndex:1] indexOfObject:startArr[1]]; + if (row2==NSNotFound) + { + row2=0; + } + + [_mydatepicView.picView selectRow:row2 inComponent:1 animated:NO]; + NSInteger row3 = [[_mydatepicView.dataArr objectAtIndex:2] indexOfObject:startArr[2]]; + if (row3==NSNotFound) + { + row3=0; + } + + [_mydatepicView.picView selectRow:row3 inComponent:2 animated:NO]; + NSInteger row4 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[0]]; + if (row4==NSNotFound) + { + row4=0; + } + [_mydatepicView.picView selectRow:row4 inComponent:3 animated:NO]; + NSInteger row5 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[1]]; + if (row5==NSNotFound) + { + row5=0; + } + [_mydatepicView.picView selectRow:row5 inComponent:4 animated:NO]; + NSInteger row6 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[2]]; + if (row6==NSNotFound) + { + row6=0; + } + [_mydatepicView.picView selectRow:row6 inComponent:5 animated:NO]; + + + _mydatepicView.startString = startArr[0]; + _mydatepicView.endString = startArr[1]; + _mydatepicView.startSecondString = startArr[2]; + _mydatepicView.startString1 = endArr[0]; + _mydatepicView.endString1 = endArr[1]; + _mydatepicView.endSecondString = endArr[2]; + + } } #pragma mark -- 设置时间段 -- --(void)doneButtonClick{ - NSLog(@"点击了加号"); - // 需要判断之前的时间段是否重叠 - NSString *startTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString,_mydatepicView.endString]; - NSString *endTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString1,_mydatepicView.endString1]; - _mydatepicView.resultString=nil; - if([startTime isEqualToString:endTime]){ - [self showTitle:@"" messsage:@"开始时间不能等于结束时间"]; - return; - }else if (![self isValidTimer:startTime withEndTime:endTime] && !_mydatepicView.haveDelected){ - [self showTitle:@"" messsage:@"添加的时间段与之前的重叠"]; - return; - }else{ - _mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime]; - - NSString*hexDateString1=[dataContorl dateStringToHexString:startTime]; - NSString*hexDateString2=[dataContorl dateStringToHexString:endTime]; - SetTimerModel *timerModel = [[SetTimerModel alloc] init]; - timerModel.sendmacId =self.currentdevice.macAddress; - timerModel.resavemacId = self.currentdevice.macAddress; - timerModel.crc16str=@"0000"; - timerModel.isOn = @"01"; - timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2]; - [_mydatepicView removeFromSuperview]; - - - ReadTimerModel *readModel = [[ReadTimerModel alloc] init]; - readModel.sendmacId =self.currentdevice.macAddress; - readModel.resavemacId = self.currentdevice.macAddress; - readModel.crc16str=@"0000"; - NSInteger index = _selectSection ; - if (index < _titieArr.count) { - NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]]; - NSInteger groupNumber = 1; - for (int i = 0 ; i < dataArr.count; i++) { - if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] && - ((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) { - groupNumber++; - } - } - NSLog(@"indexgroup = %d",groupNumber); - timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber]; - XuanduoTimerGroup *group; - BOOL havePlus = NO; - if (_mydatepicView.haveDelected) { - havePlus = [dataArr containsObject:plusflag]; - group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row]; - timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];; - NSLog(@"realgroup = %ld",group.groupNumber.integerValue); - timerModel.isOn = group.status; - [dataArr removeObject:group]; - if (![self isValidTimer:startTime withEndTime:endTime]) { - [self showTitle:@"" messsage:@"添加的时间段与之前的重叠"]; - [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; - return; - }else { - [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; - } - } - - switch (index) { - case 0: //循环泵 - { - timerModel.selectorNumber = @"04"; - - if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) - { - timerModel.selectorNumber=@"01"; - } - - } - break; - case 1: //增氧 - { - timerModel.selectorNumber = @"01"; - - if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) - { - timerModel.selectorNumber=@"02"; - } - - } - break; - case 2: //灯光1 - { - timerModel.selectorNumber = @"02"; - if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) - { - timerModel.selectorNumber=@"03"; - } - } - break; - case 3: //灯光2 - { - timerModel.selectorNumber = @"03"; - } - break; - case 4: //造浪泵 - { - timerModel.selectorNumber = @"06"; - } - break; - case 5: //杀菌灯 - { - timerModel.selectorNumber = @"05"; - } - break; - - default: - break; - } - NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str]; +-(void)doneButtonClick +{ + if ([_mydatepicView.pickerType isEqualToString:@"xuanduo"]) + { + NSLog(@"点击了加号"); + // 需要判断之前的时间段是否重叠 + NSString *startTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString,_mydatepicView.endString]; + NSString *endTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString1,_mydatepicView.endString1]; + _mydatepicView.resultString=nil; + if([startTime isEqualToString:endTime]){ + [self showTitle:@"" messsage:@"开始时间不能等于结束时间"]; + return; + }else if (![self isValidTimer:startTime withEndTime:endTime] && !_mydatepicView.haveDelected){ + [self showTitle:@"" messsage:@"添加的时间段与之前的重叠"]; + return; + }else{ + _mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime]; - NSData*selctorData=[dataContorl stringToHexData:selectorString]; - [[Socketsingleton sharedInstance] soketWriteData:selctorData]; - [_indicatorView startAnimating]; - NSLog(@"hexString%@",selectorString); - NSLog(@"result%@",_mydatepicView.resultString); + NSString*hexDateString1=[dataContorl dateStringToHexString:startTime]; + NSString*hexDateString2=[dataContorl dateStringToHexString:endTime]; + SetTimerModel *timerModel = [[SetTimerModel alloc] init]; + timerModel.sendmacId =self.currentdevice.macAddress; + timerModel.resavemacId = self.currentdevice.macAddress; + timerModel.crc16str=@"0000"; + timerModel.isOn = @"01"; + timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2]; + [_mydatepicView removeFromSuperview]; - readModel.selectorNumber = timerModel.selectorNumber; - NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str]; - NSData*readData=[dataContorl stringToHexData:readString]; - [[Socketsingleton sharedInstance] soketWriteData:readData]; - [_indicatorView startAnimating]; + + ReadTimerModel *readModel = [[ReadTimerModel alloc] init]; + readModel.sendmacId =self.currentdevice.macAddress; + readModel.resavemacId = self.currentdevice.macAddress; + readModel.crc16str=@"0000"; + NSInteger index = _selectSection ; + if (index < _titieArr.count) { + NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]]; + NSInteger groupNumber = 1; + for (int i = 0 ; i < dataArr.count; i++) { + if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] && + ((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) { + groupNumber++; + } + } + NSLog(@"indexgroup = %d",groupNumber); + timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber]; + XuanduoTimerGroup *group; + BOOL havePlus = NO; + if (_mydatepicView.haveDelected) { + havePlus = [dataArr containsObject:plusflag]; + group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];; + NSLog(@"realgroup = %ld",group.groupNumber.integerValue); + timerModel.isOn = group.status; + [dataArr removeObject:group]; + if (![self isValidTimer:startTime withEndTime:endTime]) { + [self showTitle:@"" messsage:@"添加的时间段与之前的重叠"]; + [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + return; + }else { + [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + } + } + + switch (index) { + case 0: //循环泵 + { + timerModel.selectorNumber = @"04"; + + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"01"; + } + + } + break; + case 1: //增氧 + { + timerModel.selectorNumber = @"01"; + + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"02"; + } + + } + break; + case 2: //灯光1 + { + timerModel.selectorNumber = @"02"; + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"03"; + } + } + break; + case 3: //灯光2 + { + timerModel.selectorNumber = @"03"; + } + break; + case 4: //造浪泵 + { + timerModel.selectorNumber = @"06"; + } + break; + case 5: //杀菌灯 + { + timerModel.selectorNumber = @"05"; + } + break; + + default: + break; + } + NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str]; + + NSData*selctorData=[dataContorl stringToHexData:selectorString]; + [[Socketsingleton sharedInstance] soketWriteData:selctorData]; + [_indicatorView startAnimating]; + NSLog(@"hexString%@",selectorString); + NSLog(@"result%@",_mydatepicView.resultString); + + readModel.selectorNumber = timerModel.selectorNumber; + NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str]; + NSData*readData=[dataContorl stringToHexData:readString]; + [[Socketsingleton sharedInstance] soketWriteData:readData]; + [_indicatorView startAnimating]; + } + } + } + else if ([_mydatepicView.pickerType isEqualToString:@"cyccleType"]) + { + NSLog(@"点击了加号"); + // 需要判断之前的时间段是否重叠 + NSString *startTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString,_mydatepicView.endString,_mydatepicView.startSecondString]; + NSString *endTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString1,_mydatepicView.endString1,_mydatepicView.endSecondString]; + _mydatepicView.resultString=nil; + if([startTime isEqualToString:endTime]){ + [self showTitle:@"" messsage:@"开始时间不能等于结束时间"]; + return; + }else{ + _mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime]; + + NSString*hexDateString1=[dataContorl dateStringToHexString:startTime]; + NSString*hexDateString2=[dataContorl dateStringToHexString:endTime]; + SetTimerModel *timerModel = [[SetTimerModel alloc] init]; + timerModel.sendmacId =self.currentdevice.macAddress; + timerModel.resavemacId = self.currentdevice.macAddress; + timerModel.crc16str=@"0000"; + timerModel.isOn = @"01"; + timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2]; + [_mydatepicView removeFromSuperview]; + + + ReadTimerModel *readModel = [[ReadTimerModel alloc] init]; + readModel.sendmacId =self.currentdevice.macAddress; + readModel.resavemacId = self.currentdevice.macAddress; + readModel.crc16str=@"0000"; + NSInteger index = _selectSection ; + if (index < _titieArr.count) { + NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]]; + NSInteger groupNumber = 1; + for (int i = 0 ; i < dataArr.count; i++) { + if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] && + ((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) { + groupNumber++; + } + } + NSLog(@"indexgroup = %d",groupNumber); + timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber]; + XuanduoTimerGroup *group; + BOOL havePlus = NO; + if (_mydatepicView.haveDelected) { + havePlus = [dataArr containsObject:plusflag]; + group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];; + NSLog(@"realgroup = %ld",group.groupNumber.integerValue); + timerModel.isOn = group.status; + [dataArr removeObject:group]; + if (![self isValidTimer:startTime withEndTime:endTime]) { + [self showTitle:@"" messsage:@"添加的时间段与之前的重叠"]; + [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + return; + }else { + [dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row]; + } + } + + switch (index) { + case 0: //循环泵 + { + timerModel.selectorNumber = @"04"; + + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"01"; + } + + } + break; + case 1: //增氧 + { + timerModel.selectorNumber = @"01"; + + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"02"; + } + + } + break; + case 2: //灯光1 + { + timerModel.selectorNumber = @"02"; + if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + timerModel.selectorNumber=@"03"; + } + } + break; + case 3: //灯光2 + { + timerModel.selectorNumber = @"03"; + } + break; + case 4: //造浪泵 + { + timerModel.selectorNumber = @"06"; + } + break; + case 5: //杀菌灯 + { + timerModel.selectorNumber = @"05"; + } + break; + + default: + break; + } + NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str]; + + NSData*selctorData=[dataContorl stringToHexData:selectorString]; + [[Socketsingleton sharedInstance] soketWriteData:selctorData]; + [_indicatorView startAnimating]; + NSLog(@"hexString%@",selectorString); + NSLog(@"result%@",_mydatepicView.resultString); + + readModel.selectorNumber = timerModel.selectorNumber; + NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str]; + NSData*readData=[dataContorl stringToHexData:readString]; + [[Socketsingleton sharedInstance] soketWriteData:readData]; + [_indicatorView startAnimating]; + } } } } @@ -1561,7 +1750,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; { _cycleModel=[[XuanduoCycleModel alloc]init]; [Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type]; - NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]]; + NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]]; [dataArr removeAllObjects]; [dataArr addObject:_cycleModel]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduofishFeedViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduofishFeedViewController.m index 3101000..19095a3 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduofishFeedViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduofishFeedViewController.m @@ -799,7 +799,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; - (void)addTimer:(UIButton *)btn { _mydatepicView=[[MydatePickerView alloc]init]; - _mydatepicView.isNewXuanduo = YES; + _mydatepicView.pickerType = @"xuanduo"; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m index 3b33254..34555d4 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m @@ -215,7 +215,7 @@ static const CGFloat ToastFade = 0.2; _mydatepicView=[[MydatePickerView alloc]init]; _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); - [_mydatepicView setIsNewXuanduo:YES]; + _mydatepicView.pickerType = @"xuanduo";; [_mydatepicView.picView reloadAllComponents]; [_mydatepicView.cancleButton addTarget:self action:@selector(cancleButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; diff --git a/Ifish/views/mypicView/MydatePickerView.h b/Ifish/views/mypicView/MydatePickerView.h index 5b6bbdb..820615f 100644 --- a/Ifish/views/mypicView/MydatePickerView.h +++ b/Ifish/views/mypicView/MydatePickerView.h @@ -23,10 +23,12 @@ @property(nonatomic,copy)UIButton *sureButton; @property(nonatomic)NSInteger row; @property(nonatomic)NSInteger compennent; -@property(nonatomic,copy)NSString *startString; -@property(nonatomic,copy)NSString *endString; -@property(nonatomic,copy)NSString *startString1; -@property(nonatomic,copy)NSString *endString1; +@property(nonatomic,copy)NSString *startString;//开始时 +@property(nonatomic,copy)NSString *endString;//开始分 +@property(nonatomic,copy)NSString *startString1;//结束时 +@property(nonatomic,copy)NSString *endString1;//结束分 +@property(nonatomic,copy)NSString *startSecondString;//秒 +@property(nonatomic,copy)NSString *endSecondString; @property(nonatomic,copy)NSString *resultString; @property(nonatomic,strong)UIImageView *backgroundImage; @@ -36,8 +38,8 @@ @property(nonatomic,strong)UILabel *endLabel; -@property(nonatomic,assign)BOOL isNewXuanduo; @property(nonatomic,assign)BOOL haveDelected; +@property(nonatomic,strong)NSString* pickerType; diff --git a/Ifish/views/mypicView/MydatePickerView.m b/Ifish/views/mypicView/MydatePickerView.m index 4130916..e25b646 100644 --- a/Ifish/views/mypicView/MydatePickerView.m +++ b/Ifish/views/mypicView/MydatePickerView.m @@ -42,7 +42,7 @@ _endLabel.font=[UIFont systemFontOfSize:15]; _endLabel.textAlignment=NSTextAlignmentCenter; [_backgroundImage addSubview:_endLabel]; - + _startString = _startString1 =_startSecondString= _endString = _endString1 = _endSecondString= @"00"; _picView=[[UIPickerView alloc]initWithFrame:CGRectMake(10,_startLabel.frame.origin.y + 20,imgWid - 20,imHeight -30 - 40- 20)]; _picView.dataSource=self; @@ -104,8 +104,8 @@ return self; } -- (void)setIsNewXuanduo:(BOOL)isNewXuanduo { - _isNewXuanduo = isNewXuanduo; +- (void)setPickerType:(NSString *)pickerType { + _pickerType = pickerType; UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(12,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)]; label1.text=@"小时"; label1.font=[UIFont systemFontOfSize:15]; @@ -151,12 +151,19 @@ } -(void)initData{ - if (_isNewXuanduo) { + if ([self.pickerType isEqualToString:@"xuanduo"]) { _startString = _startString1 = _endString = _endString1 = @"00"; _dataArr = @[@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14" ,@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"]]; - }else { + }else if ([self.pickerType isEqualToString:@"cycleType"]) + { + _startString = _startString1 = _endString = _endString1 = @"00"; + _dataArr = @[@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14" + ,@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"],@[@"00",@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59"]]; + + } + else { _dataArr=@[@[@"0:00",@"0:30",@"1:00",@"1:30",@"2:00",@"2:30",@"3:00",@"3:30",@"4:00",@"4:30",@"5:00",@"5:30",@"6:00",@"6:30",@"7:00",@"7:30",@"8:00",@"8:30",@"9:00",@"9:30",@"10:00",@"10:30",@"11:00",@"11:30",@"12:00",@"12:30",@"13:00",@"13:30",@"14:00",@"14:30",@"15:00",@"15:30",@"16:00",@"16:30",@"17:00",@"17:30",@"18:00",@"18:30",@"19:00",@"19:30",@"20:00",@"20:30",@"21:00",@"21:30",@"22:00",@"22:30",@"23:00",@"23:30"],@[@"0:29",@"0:59",@"1:29",@"1:59",@"2:29",@"2:59",@"3:29",@"3:59",@"4:29",@"4:59",@"5:29",@"5:59",@"6:29",@"6:59",@"7:29",@"7:59",@"8:29",@"8:59",@"9:29",@"9:59",@"10:29",@"10:59",@"11:29",@"11:59",@"12:29",@"12:59",@"13:29",@"13:59",@"14:29",@"14:59",@"15:29",@"15:59",@"16:29",@"16:59",@"17:29",@"17:59",@"18:29",@"18:59",@"19:29",@"19:59",@"20:29",@"20:59",@"21:29",@"21:59",@"22:29",@"22:59",@"23:29",@"23:59",]]; } } @@ -167,7 +174,7 @@ return rowArray.count; } -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ - return _isNewXuanduo?4:2; + return _dataArr.count; } -(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ @@ -179,18 +186,46 @@ -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{ _row=row; _compennent=component; - if (component==0) { - _startString=_dataArr[0][_row]; + if ([self.pickerType isEqualToString:@"cycleType"]) + { + if (component==0) { + _startString=_dataArr[0][_row]; + + }else if(component==1) { + + _endString=_dataArr[1][_row]; + + } + else if (component==2){ + _startSecondString=_dataArr[2][_row]; + }else if (component==3){ + _startString1=_dataArr[3][_row]; + } + else if (component==4){ + _endString1=_dataArr[4][_row]; + } + else if (component==5){ + _endSecondString=_dataArr[5][_row]; + } + - }else if(component==1) { - - _endString=_dataArr[1][_row]; - - }else if (component==2){ - _startString1=_dataArr[2][_row]; - }else if (component==3){ - _endString1=_dataArr[3][_row]; } + else + { + if (component==0) { + _startString=_dataArr[0][_row]; + + }else if(component==1) { + + _endString=_dataArr[1][_row]; + + }else if (component==2){ + _startString1=_dataArr[2][_row]; + }else if (component==3){ + _endString1=_dataArr[3][_row]; + } + } + // [_picView selectRow:row inComponent:component animated:YES]; @@ -204,7 +239,7 @@ } -(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{ - return pickerView.frame.size.width/(_isNewXuanduo?4:2); + return pickerView.frame.size.width/_dataArr.count; }