UI和灯号调整

This commit is contained in:
祝发冬
2022-07-20 18:42:07 +08:00
parent 7801e35aae
commit e2faf52575
9 changed files with 41 additions and 58 deletions
@@ -11,6 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface PlusTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *backImageView;
@property (weak, nonatomic) IBOutlet UIButton *addTimerBtn;
@end
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<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="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<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>
@@ -16,11 +14,11 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="80"/>
<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="79.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ifishSetCell_back.png" translatesAutoresizingMaskIntoConstraints="NO" id="Hc6-I7-yDU">
<rect key="frame" x="0.0" y="0.0" width="320" height="79.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="80"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6h6-2g-eDK">
<rect key="frame" x="137" y="17" width="46" height="46"/>
@@ -44,12 +42,13 @@
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="addTimerBtn" destination="6h6-2g-eDK" id="Jsg-om-i4G"/>
<outlet property="backImageView" destination="Hc6-I7-yDU" id="yB6-1d-Rrx"/>
</connections>
<point key="canvasLocation" x="52.799999999999997" y="149.32533733133434"/>
</tableViewCell>
</objects>
<resources>
<image name="add.png" width="46" height="46"/>
<image name="add.png" width="46.5" height="46.5"/>
<image name="ifishSetCell_back.png" width="1080" height="140"/>
</resources>
</document>
@@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SetTimerCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *backImageView;
@property (weak, nonatomic) IBOutlet UIButton *switchBtn;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *timerLabel;
@@ -20,6 +20,13 @@
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ifishSetCell_back.png" translatesAutoresizingMaskIntoConstraints="NO" id="P3o-KY-LIT">
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AW2-Ki-aud" userLabel="lineView">
<rect key="frame" x="0.0" y="49.5" width="320" height="0.5"/>
<color key="backgroundColor" red="0.25490196078431371" green="0.25490196078431371" blue="0.25490196078431371" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="Kkl-9d-H0c"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="时段1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yY6-WX-OcS">
<rect key="frame" x="28" y="17" width="33" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
@@ -47,19 +54,24 @@
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="P3o-KY-LIT" secondAttribute="trailing" id="2yN-ro-gmU"/>
<constraint firstItem="AW2-Ki-aud" firstAttribute="width" secondItem="P3o-KY-LIT" secondAttribute="width" id="7Df-NX-Hzi"/>
<constraint firstAttribute="trailing" secondItem="SDK-gA-raP" secondAttribute="trailing" constant="28" id="7Ux-nN-8iv"/>
<constraint firstAttribute="bottom" secondItem="P3o-KY-LIT" secondAttribute="bottom" id="8Bd-g4-FLv"/>
<constraint firstItem="AW2-Ki-aud" firstAttribute="leading" secondItem="P3o-KY-LIT" secondAttribute="leading" id="KEg-pL-yYb"/>
<constraint firstItem="P3o-KY-LIT" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="LcH-qx-fyJ"/>
<constraint firstItem="P3o-KY-LIT" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="N6V-Tp-Fcx"/>
<constraint firstItem="hQu-ZP-ugr" firstAttribute="centerY" secondItem="yY6-WX-OcS" secondAttribute="centerY" id="ZaA-96-fkI"/>
<constraint firstItem="hQu-ZP-ugr" firstAttribute="leading" secondItem="yY6-WX-OcS" secondAttribute="trailing" constant="55" id="c5H-Ak-EAF"/>
<constraint firstItem="yY6-WX-OcS" firstAttribute="centerY" secondItem="P3o-KY-LIT" secondAttribute="centerY" id="eLH-LS-Vwj"/>
<constraint firstItem="yY6-WX-OcS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="28" id="fi0-nJ-8jg"/>
<constraint firstItem="AW2-Ki-aud" firstAttribute="trailing" secondItem="P3o-KY-LIT" secondAttribute="trailing" id="hxt-iT-Vua"/>
<constraint firstItem="AW2-Ki-aud" firstAttribute="bottom" secondItem="P3o-KY-LIT" secondAttribute="bottom" id="sWC-ae-JdY"/>
<constraint firstItem="SDK-gA-raP" firstAttribute="centerY" secondItem="hQu-ZP-ugr" secondAttribute="centerY" id="seY-SG-N35"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="backImageView" destination="P3o-KY-LIT" id="ySC-6s-HgO"/>
<outlet property="switchBtn" destination="SDK-gA-raP" id="EzJ-PP-FfH"/>
<outlet property="timerLabel" destination="hQu-ZP-ugr" id="vDu-mo-su7"/>
<outlet property="titleLabel" destination="yY6-WX-OcS" id="KDa-OR-dyK"/>
@@ -235,12 +235,14 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
BOOL havePlus = [dataArr containsObject:plusflag];
if (havePlus && (indexPath.row == dataArr.count-1)) {
PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath];
cell.backImageView.image = [UIImage imageNamed:@"bottomRound"];
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.backImageView.image = [UIImage imageNamed:@"centerrect"];
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];
@@ -312,12 +314,14 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
BOOL havePlus = [dataArr containsObject:plusflag];
if (havePlus && (indexPath.row == dataArr.count-1)) {
PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath];
cell.backImageView.image = [UIImage imageNamed:@"bottomRound"];
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.backImageView.image = [UIImage imageNamed:@"centerrect"];
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];
@@ -384,7 +388,7 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
height=section==0?50:40;
UIImageView*imageView=[[UIImageView alloc]init];
imageView.frame=CGRectMake(0, 0, self.tableView.frame.size.width, height);
imageView.image=[UIImage imageNamed:@"set_cellBack"];
imageView.image=[UIImage imageNamed:@"topround"];
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.tableView.frame.size.width-20, height)];
label.text=_titieArr[section];
label.textColor=[UIColor blackColor];
@@ -1066,53 +1070,7 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
BOOL havePlus = [dataArr containsObject:plusflag];
XuanduoTimerGroup *group = [dataArr objectAtIndex:(havePlus?_indexPath.row+1:_indexPath.row)];
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];
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;
}
timerModel.selectorNumber=self.lightNumber;
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
NSData*selctorData=[dataContorl stringToHexData:selectorString];