循环定时器

This commit is contained in:
kai60
2022-05-16 10:41:03 +08:00
parent 146e89a310
commit 0ab0c4fa08
20 changed files with 2390 additions and 231 deletions
+32
View File
@@ -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 = "<group>"; };
88F740BE1ECC28E800876AED /* ShopAddGoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopAddGoodsViewController.h; sourceTree = "<group>"; };
88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopAddGoodsViewController.m; sourceTree = "<group>"; };
C00E7B1B282FBE19000A1E86 /* XuanduoTempratureCorrectView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XuanduoTempratureCorrectView.h; sourceTree = "<group>"; };
C00E7B1C282FBE19000A1E86 /* XuanduoTempratureCorrectView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XuanduoTempratureCorrectView.m; sourceTree = "<group>"; };
C00E7B21282FBE99000A1E86 /* XuanduoTempratureCorrectView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XuanduoTempratureCorrectView.xib; sourceTree = "<group>"; };
C00E7B232830DB70000A1E86 /* CycleTimerCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CycleTimerCell.h; sourceTree = "<group>"; };
C00E7B242830DB70000A1E86 /* CycleTimerCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CycleTimerCell.m; sourceTree = "<group>"; };
C00E7B252830DB70000A1E86 /* CycleTimerCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CycleTimerCell.xib; sourceTree = "<group>"; };
C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+WaterMark.h"; sourceTree = "<group>"; };
C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WaterMark.m"; sourceTree = "<group>"; };
C01B9886282F50E8004FF42D /* UIView+Frame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = "<group>"; };
C01B9887282F50E8004FF42D /* UIView+Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = "<group>"; };
C01B988A282F802E004FF42D /* arrow_right@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "arrow_right@2x.png"; sourceTree = "<group>"; };
C01B988C282FBC12004FF42D /* XuanduoTempratueCorrectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XuanduoTempratueCorrectViewController.m; sourceTree = "<group>"; };
C01B988D282FBC12004FF42D /* XuanduoTempratueCorrectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XuanduoTempratueCorrectViewController.h; sourceTree = "<group>"; };
C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AvoidCrash.m"; sourceTree = "<group>"; };
C024B78B2379668B00509424 /* AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrash.h; sourceTree = "<group>"; };
C024B78C2379668B00509424 /* NSString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AvoidCrash.m"; sourceTree = "<group>"; };
@@ -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 */,
+62 -11
View File
@@ -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);
@@ -0,0 +1,19 @@
//
// CycleTimerCell.h
// Ifish
//
// Created by 祝发冬 on 2022/5/15.
// Copyright © 2022 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
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
@@ -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
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="CycleTimerCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="开启00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V4x-oE-ip3">
<rect key="frame" x="5" y="12" width="120" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="GHD-eN-JDA"/>
<constraint firstAttribute="width" constant="120" id="ej1-m4-KJE"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.34901960780000002" green="0.34901960780000002" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="关闭00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xa5-yA-Py3">
<rect key="frame" x="195" y="12" width="120" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="baf-Mm-MPz"/>
<constraint firstAttribute="height" constant="20" id="jHz-du-9rA"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.34901960780000002" green="0.34901960780000002" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="V4x-oE-ip3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="1Qt-gz-Pid"/>
<constraint firstItem="V4x-oE-ip3" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="5" id="b8c-bF-gws"/>
<constraint firstAttribute="trailing" secondItem="xa5-yA-Py3" secondAttribute="trailing" constant="5" id="hSU-AU-WOF"/>
<constraint firstItem="xa5-yA-Py3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="uTU-0b-0nR"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="closeTimeLabel" destination="xa5-yA-Py3" id="ZmC-St-v4q"/>
<outlet property="openTilmeLabel" destination="V4x-oE-ip3" id="Lul-LQ-8N8"/>
</connections>
<point key="canvasLocation" x="139" y="64"/>
</tableViewCell>
</objects>
</document>
@@ -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
@@ -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];
@@ -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
@@ -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];
@@ -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
@@ -0,0 +1,17 @@
//
// XuanduoTempratureCorrectView.h
// Ifish
//
// Created by 祝发冬 on 2022/5/14.
// Copyright © 2022 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XuanduoTempratureCorrectView : UIView
@end
NS_ASSUME_NONNULL_END
@@ -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
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="2c8-dl-t76" customClass="XuanduoTempratureCorrectView">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<viewLayoutGuide key="safeArea" id="DJa-9i-S0t"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="-1291" y="-88"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
@@ -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];
@@ -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];
@@ -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];
@@ -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];
+7 -5
View File
@@ -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;
+52 -17
View File
@@ -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;
}