Commit 45b9dc3aa1010d4c3c57938c16fe1a8f74be73eb

Authored by daifengyi
1 parent 84bd9999

feat:sort page UI

HDFwear.xcodeproj/project.pbxproj
... ... @@ -284,8 +284,10 @@
284 284 6CFEEBC42773355700621863 /* SleepReferenceVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFEEBC32773355700621863 /* SleepReferenceVC.swift */; };
285 285 B212F1FD2A14CE0400781D59 /* LaunchSetting.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B212F1FF2A14CE0400781D59 /* LaunchSetting.storyboard */; };
286 286 B212F2052A14D28E00781D59 /* LaunchMyBodySettingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B212F2042A14D28E00781D59 /* LaunchMyBodySettingVC.swift */; };
287   - B23AA1012A1879D100BB3902 /* SortPageSectionHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = B23AA1002A1879D100BB3902 /* SortPageSectionHeader.m */; };
288 287 B23AA1032A1879E200BB3902 /* SortPageSectionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = B23AA1022A1879E200BB3902 /* SortPageSectionHeader.xib */; };
  288 + B23AA1052A18F22600BB3902 /* SortPageSectionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B23AA1042A18F22600BB3902 /* SortPageSectionHeader.swift */; };
  289 + B23AA1082A18F3F100BB3902 /* SortPageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B23AA1062A18F3F100BB3902 /* SortPageCell.swift */; };
  290 + B23AA1092A18F3F100BB3902 /* SortPageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B23AA1072A18F3F100BB3902 /* SortPageCell.xib */; };
289 291 B2AF58822A14C4BE0080B464 /* LaunchMyInfoSettingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2AF58812A14C4BE0080B464 /* LaunchMyInfoSettingVC.swift */; };
290 292 /* End PBXBuildFile section */
291 293  
... ... @@ -657,9 +659,10 @@
657 659 B212F2012A14CE0900781D59 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchSetting.strings"; sourceTree = "<group>"; };
658 660 B212F2032A14CE0A00781D59 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchSetting.strings; sourceTree = "<group>"; };
659 661 B212F2042A14D28E00781D59 /* LaunchMyBodySettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchMyBodySettingVC.swift; sourceTree = "<group>"; };
660   - B23AA0FF2A1879D100BB3902 /* SortPageSectionHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SortPageSectionHeader.h; sourceTree = "<group>"; };
661   - B23AA1002A1879D100BB3902 /* SortPageSectionHeader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SortPageSectionHeader.m; sourceTree = "<group>"; };
662 662 B23AA1022A1879E200BB3902 /* SortPageSectionHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SortPageSectionHeader.xib; sourceTree = "<group>"; };
  663 + B23AA1042A18F22600BB3902 /* SortPageSectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortPageSectionHeader.swift; sourceTree = "<group>"; };
  664 + B23AA1062A18F3F100BB3902 /* SortPageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortPageCell.swift; sourceTree = "<group>"; };
  665 + B23AA1072A18F3F100BB3902 /* SortPageCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SortPageCell.xib; sourceTree = "<group>"; };
663 666 B2AF58812A14C4BE0080B464 /* LaunchMyInfoSettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchMyInfoSettingVC.swift; sourceTree = "<group>"; };
664 667 C621CFD20D2BD60CF4F959C3 /* Pods-HDFwear.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HDFwear.release.xcconfig"; path = "Target Support Files/Pods-HDFwear/Pods-HDFwear.release.xcconfig"; sourceTree = "<group>"; };
665 668 E7F3880C37BC5F6DD15C709D /* Pods-HDFwear.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HDFwear.debug.xcconfig"; path = "Target Support Files/Pods-HDFwear/Pods-HDFwear.debug.xcconfig"; sourceTree = "<group>"; };
... ... @@ -1240,9 +1243,10 @@
1240 1243 6C90AD10276B2E9500555FB8 /* MotionRecordCell.swift */,
1241 1244 6C28F531278FC68000E74EA5 /* MotionRecordCell.xib */,
1242 1245 6CCB7FF7276C6C06009EF617 /* RecordHeaderView.swift */,
1243   - B23AA0FF2A1879D100BB3902 /* SortPageSectionHeader.h */,
1244   - B23AA1002A1879D100BB3902 /* SortPageSectionHeader.m */,
  1246 + B23AA1042A18F22600BB3902 /* SortPageSectionHeader.swift */,
1245 1247 B23AA1022A1879E200BB3902 /* SortPageSectionHeader.xib */,
  1248 + B23AA1062A18F3F100BB3902 /* SortPageCell.swift */,
  1249 + B23AA1072A18F3F100BB3902 /* SortPageCell.xib */,
1246 1250 );
1247 1251 path = Cell;
1248 1252 sourceTree = "<group>";
... ... @@ -1435,6 +1439,7 @@
1435 1439 B23AA1032A1879E200BB3902 /* SortPageSectionHeader.xib in Resources */,
1436 1440 6C85FB74278D5CF2007D309A /* StepCircleView.xib in Resources */,
1437 1441 6C28F56127901D6800E74EA5 /* SleepReportCell.xib in Resources */,
  1442 + B23AA1092A18F3F100BB3902 /* SortPageCell.xib in Resources */,
1438 1443 6C5A978F27CCA03E00221361 /* PressureCell.xib in Resources */,
1439 1444 6C0AE81B279149770064D377 /* ShareView.xib in Resources */,
1440 1445 6C6505D12799154A0043DB7A /* AddPictureCell.xib in Resources */,
... ... @@ -1531,6 +1536,7 @@
1531 1536 files = (
1532 1537 6C80540F27699D950083B295 /* UILabel+Extension.swift in Sources */,
1533 1538 6C5B545A277569BE007F7901 /* UIView+Extension.swift in Sources */,
  1539 + B23AA1052A18F22600BB3902 /* SortPageSectionHeader.swift in Sources */,
1534 1540 6CA862422747710100139069 /* StepViewController.swift in Sources */,
1535 1541 6C8F74E72779B8C700B8A1A7 /* SettingCell5.swift in Sources */,
1536 1542 6C2081F0277F00A600F6D4B9 /* HomePageSortVC.swift in Sources */,
... ... @@ -1653,7 +1659,6 @@
1653 1659 6C6F409027438FBE00F9473C /* Config.swift in Sources */,
1654 1660 6CB5416D27E0694C00BAEBD0 /* DialStyleCell.swift in Sources */,
1655 1661 6C6505C02798FB030043DB7A /* LTAdvancedManager.swift in Sources */,
1656   - B23AA1012A1879D100BB3902 /* SortPageSectionHeader.m in Sources */,
1657 1662 6CFEEBC02773353700621863 /* BOReferenceVC.swift in Sources */,
1658 1663 6CFEEBA42772BAB000621863 /* MBProgressHUD+Extension.swift in Sources */,
1659 1664 6CFEEBAE2772F18400621863 /* SettingCell2.swift in Sources */,
... ... @@ -1667,6 +1672,7 @@
1667 1672 6C6F40752743828700F9473C /* BloodPressureCell.swift in Sources */,
1668 1673 6C5A978E27CCA03E00221361 /* PressureCell.swift in Sources */,
1669 1674 6C6505C42798FB030043DB7A /* LTVCExtension.swift in Sources */,
  1675 + B23AA1082A18F3F100BB3902 /* SortPageCell.swift in Sources */,
1670 1676 6C5B545827756865007F7901 /* DatePickerView.swift in Sources */,
1671 1677 6C5120802797C22F006F8B64 /* CardDetailVC.swift in Sources */,
1672 1678 6C1B7EA427B7976600DB9D1C /* NFCDetailVC.swift in Sources */,
... ...
HDFwear/Home/Base.lproj/Home.storyboard
... ... @@ -231,7 +231,7 @@
231 231 <subviews>
232 232 <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="6Z7-mM-OZ3">
233 233 <rect key="frame" x="0.0" y="48" width="414" height="814"/>
234   - <color key="backgroundColor" systemColor="systemBackgroundColor"/>
  234 + <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
235 235 <connections>
236 236 <outlet property="dataSource" destination="LZY-5e-F4f" id="zjW-kr-4Fc"/>
237 237 <outlet property="delegate" destination="LZY-5e-F4f" id="Yfg-fc-rJ3"/>
... ... @@ -239,7 +239,7 @@
239 239 </tableView>
240 240 </subviews>
241 241 <viewLayoutGuide key="safeArea" id="2FV-p2-Nf3"/>
242   - <color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
  242 + <color key="backgroundColor" red="0.98039215686274506" green="0.98039215686274506" blue="0.98039215686274506" alpha="1" colorSpace="calibratedRGB"/>
243 243 <constraints>
244 244 <constraint firstItem="6Z7-mM-OZ3" firstAttribute="top" secondItem="2FV-p2-Nf3" secondAttribute="top" id="Fdd-eQ-r9S"/>
245 245 <constraint firstItem="2FV-p2-Nf3" firstAttribute="bottom" secondItem="6Z7-mM-OZ3" secondAttribute="bottom" id="LJq-Yy-oCY"/>
... ...
HDFwear/Home/Cell/SortPageCell.swift 0 → 100644
  1 +//
  2 +// SortPageCell.swift
  3 +// HDFwear
  4 +//
  5 +// Created by daifengyi on 2023/5/20.
  6 +//
  7 +
  8 +import UIKit
  9 +
  10 +class SortPageCell: UITableViewCell {
  11 + @IBOutlet weak var iconVIew: UIImageView!
  12 + @IBOutlet weak var nameLabel: UILabel!
  13 +
  14 + override func awakeFromNib() {
  15 + super.awakeFromNib()
  16 + // Initialization code
  17 + }
  18 +
  19 + override func setSelected(_ selected: Bool, animated: Bool) {
  20 + super.setSelected(selected, animated: animated)
  21 +
  22 + // Configure the view for the selected state
  23 + }
  24 +
  25 +}
... ...
HDFwear/Home/Cell/SortPageCell.xib 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
  3 + <device id="retina6_12" orientation="portrait" appearance="light"/>
  4 + <dependencies>
  5 + <deployment identifier="iOS"/>
  6 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
  7 + <capability name="Safe area layout guides" minToolsVersion="9.0"/>
  8 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
  9 + </dependencies>
  10 + <objects>
  11 + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
  12 + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
  13 + <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="SortPageCell" customModule="HDFwear" customModuleProvider="target">
  14 + <rect key="frame" x="0.0" y="0.0" width="320" height="72"/>
  15 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  16 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
  17 + <rect key="frame" x="0.0" y="0.0" width="320" height="72"/>
  18 + <autoresizingMask key="autoresizingMask"/>
  19 + <subviews>
  20 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8zN-lJ-FAh">
  21 + <rect key="frame" x="14" y="6" width="292" height="60"/>
  22 + <subviews>
  23 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="B3X-wx-1YR">
  24 + <rect key="frame" x="50" y="21.666666666666668" width="36" height="17.000000000000004"/>
  25 + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
  26 + <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  27 + <nil key="highlightedColor"/>
  28 + </label>
  29 + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kns-lj-oFF">
  30 + <rect key="frame" x="18" y="18" width="24" height="24"/>
  31 + <constraints>
  32 + <constraint firstAttribute="height" constant="24" id="0UN-O2-H6V"/>
  33 + <constraint firstAttribute="width" constant="24" id="X1G-pS-tJM"/>
  34 + </constraints>
  35 + </imageView>
  36 + </subviews>
  37 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
  38 + <constraints>
  39 + <constraint firstItem="kns-lj-oFF" firstAttribute="centerY" secondItem="8zN-lJ-FAh" secondAttribute="centerY" id="5hk-sT-W8s"/>
  40 + <constraint firstItem="kns-lj-oFF" firstAttribute="leading" secondItem="8zN-lJ-FAh" secondAttribute="leading" constant="18" id="6Jm-qs-TTI"/>
  41 + <constraint firstItem="B3X-wx-1YR" firstAttribute="leading" secondItem="kns-lj-oFF" secondAttribute="trailing" constant="8" id="bP2-AZ-w5s"/>
  42 + <constraint firstItem="B3X-wx-1YR" firstAttribute="centerY" secondItem="8zN-lJ-FAh" secondAttribute="centerY" id="z1m-74-v3v"/>
  43 + </constraints>
  44 + <userDefinedRuntimeAttributes>
  45 + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
  46 + <integer key="value" value="12"/>
  47 + </userDefinedRuntimeAttribute>
  48 + <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
  49 + </userDefinedRuntimeAttributes>
  50 + </view>
  51 + </subviews>
  52 + <constraints>
  53 + <constraint firstItem="8zN-lJ-FAh" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="14" id="cLs-3F-voK"/>
  54 + <constraint firstItem="8zN-lJ-FAh" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="eq5-hG-2IW"/>
  55 + <constraint firstAttribute="bottom" secondItem="8zN-lJ-FAh" secondAttribute="bottom" constant="6" id="nwS-c7-2ka"/>
  56 + <constraint firstAttribute="trailing" secondItem="8zN-lJ-FAh" secondAttribute="trailing" constant="14" id="yC7-e2-PAp"/>
  57 + </constraints>
  58 + </tableViewCellContentView>
  59 + <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
  60 + <connections>
  61 + <outlet property="iconVIew" destination="kns-lj-oFF" id="JWR-eA-iGw"/>
  62 + <outlet property="nameLabel" destination="B3X-wx-1YR" id="gPg-0f-gPM"/>
  63 + </connections>
  64 + <point key="canvasLocation" x="-40" y="19"/>
  65 + </tableViewCell>
  66 + </objects>
  67 +</document>
... ...
HDFwear/Home/Cell/SortPageSectionHeader.h deleted
1   -//
2   -// SortPageSectionHeader.h
3   -// HDFwear
4   -//
5   -// Created by daifengyi on 2023/5/20.
6   -//
7   -
8   -#import <UIKit/UIKit.h>
9   -
10   -NS_ASSUME_NONNULL_BEGIN
11   -
12   -@interface SortPageSectionHeader : UITableViewHeaderFooterView
13   -
14   -@end
15   -
16   -NS_ASSUME_NONNULL_END
HDFwear/Home/Cell/SortPageSectionHeader.m renamed to HDFwear/Home/Cell/SortPageSectionHeader.swift
1 1 //
2   -// SortPageSectionHeader.m
  2 +// SortPageSectionHeader.swift
3 3 // HDFwear
4 4 //
5 5 // Created by daifengyi on 2023/5/20.
6 6 //
7 7  
8   -#import "SortPageSectionHeader.h"
  8 +import UIKit
9 9  
10   -@implementation SortPageSectionHeader
  10 +class SortPageSectionHeader: UITableViewHeaderFooterView {
  11 + @IBOutlet weak var topLabelTopConstraint: NSLayoutConstraint!
  12 + @IBOutlet weak var topLabel: UILabel!
  13 + @IBOutlet weak var bottomLabel: UILabel!
  14 + /*
  15 + // Only override draw() if you perform custom drawing.
  16 + // An empty implementation adversely affects performance during animation.
  17 + override func draw(_ rect: CGRect) {
  18 + // Drawing code
  19 + }
  20 + */
11 21  
12   -/*
13   -// Only override drawRect: if you perform custom drawing.
14   -// An empty implementation adversely affects performance during animation.
15   -- (void)drawRect:(CGRect)rect {
16   - // Drawing code
17 22 }
18   -*/
19   -
20   -@end
... ...
HDFwear/Home/Cell/SortPageSectionHeader.xib
... ... @@ -11,13 +11,38 @@
11 11 <objects>
12 12 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
13 13 <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14   - <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="SortPageSectionHeader">
15   - <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
  14 + <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="SortPageSectionHeader" customModule="HDFwear" customModuleProvider="target">
  15 + <rect key="frame" x="0.0" y="0.0" width="393" height="57"/>
16 16 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  17 + <subviews>
  18 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0K9-uz-b9z">
  19 + <rect key="frame" x="17.999999999999996" y="8" width="40.666666666666657" height="20"/>
  20 + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
  21 + <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  22 + <nil key="highlightedColor"/>
  23 + </label>
  24 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uML-Ve-KX0">
  25 + <rect key="frame" x="18" y="31" width="36" height="17"/>
  26 + <fontDescription key="fontDescription" type="system" pointSize="14"/>
  27 + <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  28 + <nil key="highlightedColor"/>
  29 + </label>
  30 + </subviews>
17 31 <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
18 32 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
  33 + <constraints>
  34 + <constraint firstItem="0K9-uz-b9z" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="8" id="26u-DR-6wy"/>
  35 + <constraint firstItem="uML-Ve-KX0" firstAttribute="leading" secondItem="0K9-uz-b9z" secondAttribute="leading" id="BeY-jA-mXK"/>
  36 + <constraint firstItem="uML-Ve-KX0" firstAttribute="top" secondItem="0K9-uz-b9z" secondAttribute="bottom" constant="3" id="gap-w6-ooD"/>
  37 + <constraint firstItem="0K9-uz-b9z" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="18" id="huY-rK-ksh"/>
  38 + </constraints>
19 39 <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
20   - <point key="canvasLocation" x="47" y="14"/>
  40 + <connections>
  41 + <outlet property="bottomLabel" destination="uML-Ve-KX0" id="TWa-gf-RLK"/>
  42 + <outlet property="topLabel" destination="0K9-uz-b9z" id="UEk-cY-aTS"/>
  43 + <outlet property="topLabelTopConstraint" destination="26u-DR-6wy" id="MeD-ZM-TJa"/>
  44 + </connections>
  45 + <point key="canvasLocation" x="46.564885496183201" y="13.732394366197184"/>
21 46 </view>
22 47 </objects>
23 48 <resources>
... ...
HDFwear/Home/HomePageSortVC.swift
... ... @@ -18,6 +18,7 @@ class HomePageSortVC: UIViewController, UITableViewDelegate, UITableViewDataSour
18 18 var ary2 = [String]()
19 19  
20 20 let dic: [String: String] = ["BloodPressure": "血压", "BloodOxygen": "血氧", "HeartRate": "心率", "Sleep": "睡眠", "Train": "训练", "WomenHealth": "女性健康", "MotionRecord": "运动记录", "Pressure": "压力", "Mett": "梅脱"]
  21 + let iconDic: [String: String] = ["BloodPressure": "home_bp", "BloodOxygen": "home_bo", "HeartRate": "home_hr", "Sleep": "home_sleep", "Train": "home_train", "WomenHealth": "home_women_health", "MotionRecord": "home_motion"]
21 22  
22 23 lazy var footerView: UIView = {
23 24 let view = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 200))
... ... @@ -46,10 +47,13 @@ class HomePageSortVC: UIViewController, UITableViewDelegate, UITableViewDataSour
46 47 title = LocString("编辑健康功能")
47 48 tableView.setEditing(true, animated: false)
48 49 tableView.contentInset = UIEdgeInsets.init(top: 5, left: 0, bottom: 0, right: 0)
  50 + tableView.separatorStyle = .none
  51 + tableView.register(UINib(nibName: "SortPageSectionHeader", bundle: .main), forHeaderFooterViewReuseIdentifier: "SortPageSectionHeader")
  52 + tableView.register(UINib(nibName: "SortPageCell", bundle: .main), forCellReuseIdentifier: "SortPageCell")
49 53  
50 54 ary2 = device.allFunctions
51 55 testDate()
52   - tableView.tableFooterView = footerView
  56 +// tableView.tableFooterView = footerView
53 57  
54 58 for a in ary1 {
55 59 if let i = ary2.firstIndex(of: a) {
... ... @@ -81,17 +85,29 @@ class HomePageSortVC: UIViewController, UITableViewDelegate, UITableViewDataSour
81 85 }
82 86  
83 87 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
84   - var cell = tableView.dequeueReusableCell(withIdentifier: "SortCellId")
85   - if cell == nil {
86   - cell = UITableViewCell.init(style: UITableViewCell.CellStyle.default, reuseIdentifier: "SortCellId")
87   - }
88   - cell?.textLabel?.font = RegularFont(15)
  88 + let cell = tableView.dequeueReusableCell(withIdentifier: "SortPageCell", for: indexPath) as! SortPageCell
89 89 if indexPath.section == 1 {
90   - cell?.textLabel?.text = LocString(dic[ary2[indexPath.row]]!)
  90 + cell.iconVIew.image = UIImage(named: iconDic[ary2[indexPath.row]]!)
  91 + cell.nameLabel.text = LocString(dic[ary2[indexPath.row]]!)
91 92 } else {
92   - cell?.textLabel?.text = LocString(dic[ary1[indexPath.row]]!)
  93 + cell.iconVIew.image = UIImage(named: iconDic[ary1[indexPath.row]]!)
  94 + cell.nameLabel.text = LocString(dic[ary1[indexPath.row]]!)
  95 + }
  96 + return cell
  97 + }
  98 +
  99 + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  100 + let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SortPageSectionHeader") as! SortPageSectionHeader
  101 + if section == 0 {
  102 + header.topLabelTopConstraint.constant = 8
  103 + header.topLabel.text = LocString("显示在首页")
  104 + header.bottomLabel.text = LocString("长按并拖拽可调整排序")
  105 + }else {
  106 + header.topLabelTopConstraint.constant = 15
  107 + header.topLabel.text = LocString("不显示在首页")
  108 + header.bottomLabel.text = ""
93 109 }
94   - return cell!
  110 + return header
95 111 }
96 112  
97 113 func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
... ... @@ -136,13 +152,13 @@ class HomePageSortVC: UIViewController, UITableViewDelegate, UITableViewDataSour
136 152  
137 153  
138 154 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
139   - return 50
  155 + return 72
140 156 }
141 157 func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
142   - return 35
  158 + return 0
143 159 }
144 160 func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
145   - return 0.5
  161 + return 57
146 162 }
147 163 // func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
148 164 // if section == 1 {
... ...