From 413b74eb37fa6b9e7ae38b22e8d777a74bd7a972 Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期三, 21 六月 2023 15:09:03 +0800
Subject: [PATCH] feature 门锁历史记录UI调整
---
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@2x.png | 0
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/Contents.json | 22 +
EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m | 31 +
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/Contents.json | 22 +
EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a | 0
EZSDK/EZSDK.xcodeproj/project.pbxproj | 6
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/Contents.json | 22 +
EZSDK/EZSDK/EZ/Venders/MWPhotoBrowser/MWPhotoBrowser.m | 14
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@3x.png | 0
EZSDK/EZSDK/EZ/Base/HDLEZOPButton.m | 729 ++++++++++++++++++++++++++++++++++++
EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m | 22
EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings | 1
EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDeviceMsgInfoModel.h | 1
EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m | 78 ++-
EZSDK/EZSDK/EZ/Base/HDLEZOPButton.h | 88 ++++
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@2x.png | 0
EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.h | 4
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@3x.png | 0
EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard | 78 +--
EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings | 1
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@3x.png | 0
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@2x.png | 0
EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDeviceMsgListViewController.m | 36 +
23 files changed, 1,062 insertions(+), 93 deletions(-)
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/Contents.json b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/Contents.json
new file mode 100644
index 0000000..ab8935a
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_answer@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_answer@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@2x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@2x.png
new file mode 100644
index 0000000..647a8e1
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@2x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@3x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@3x.png
new file mode 100644
index 0000000..79e3138
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_answer.imageset/hdl_ez_cat_eyes_answer@3x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/Contents.json b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/Contents.json
new file mode 100644
index 0000000..80e74d7
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_hang_up@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_hang_up@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@2x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@2x.png
new file mode 100644
index 0000000..8bf91d6
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@2x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@3x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@3x.png
new file mode 100644
index 0000000..5faf8ca
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_hang_up.imageset/hdl_ez_cat_eyes_hang_up@3x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/Contents.json b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/Contents.json
new file mode 100644
index 0000000..3f7cf1b
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_ignore@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "hdl_ez_cat_eyes_ignore@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@2x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@2x.png
new file mode 100644
index 0000000..2324070
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@2x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@3x.png b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@3x.png
new file mode 100644
index 0000000..9e96beb
--- /dev/null
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_cat_eyes_ignore.imageset/hdl_ez_cat_eyes_ignore@3x.png
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard b/EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard
index 4679ba4..6d0e440 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/EZMain.storyboard
@@ -1293,70 +1293,46 @@
<rect key="frame" x="0.0" y="312" width="375" height="355"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="---" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Fe-E7-C5g">
- <rect key="frame" x="32" y="89" width="311" height="21"/>
+ <rect key="frame" x="32" y="46.5" width="311" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.090196078430000007" green="0.094117647060000004" blue="0.29411764709999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aq5-rn-Dgo">
- <rect key="frame" x="142.5" y="160" width="84.5" height="35"/>
+ <button opaque="NO" contentMode="scaleAspectFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aq5-rn-Dgo" customClass="HDLEZOPButton">
+ <rect key="frame" x="142.5" y="117.5" width="84.5" height="120"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- <state key="normal" title="Button"/>
- <buttonConfiguration key="configuration" style="plain" title="蹇界暐"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
- <integer key="value" value="8"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
- <real key="value" value="0.5"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="color" keyPath="layer. borderColorWithUIColor">
- <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- </userDefinedRuntimeAttribute>
- </userDefinedRuntimeAttributes>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+ <state key="normal" title="蹇界暐" image="hdl_ez_cat_eyes_ignore">
+ <color key="titleColor" red="0.10588235294117647" green="0.1764705882352941" blue="0.30196078431372547" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
<connections>
<action selector="clickCalloutIgnoreAction:" destination="uBF-Yq-Qo0" eventType="touchUpInside" id="fTQ-p0-9jk"/>
</connections>
</button>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2bC-B5-gMZ">
- <rect key="frame" x="259" y="160" width="84" height="35"/>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2bC-B5-gMZ" customClass="HDLEZOPButton">
+ <rect key="frame" x="259" y="117.5" width="84" height="120"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- <state key="normal" title="Button"/>
- <buttonConfiguration key="configuration" style="plain" title="鎺ュ惉"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
- <integer key="value" value="8"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
- <real key="value" value="0.5"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="color" keyPath="layer. borderColorWithUIColor">
- <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- </userDefinedRuntimeAttribute>
- </userDefinedRuntimeAttributes>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+ <state key="normal" title="鎺ュ惉" image="hdl_ez_cat_eyes_answer">
+ <color key="titleColor" red="0.10588235294117647" green="0.1764705882352941" blue="0.30196078431372547" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
<connections>
<action selector="clickCalloutAnswerAction:" destination="uBF-Yq-Qo0" eventType="touchUpInside" id="2tR-65-1sv"/>
</connections>
</button>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jPI-nC-uAq">
- <rect key="frame" x="32" y="160" width="78.5" height="35"/>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jPI-nC-uAq" customClass="HDLEZOPButton">
+ <rect key="frame" x="32" y="117.5" width="78.5" height="120"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- <state key="normal" title="Button"/>
- <buttonConfiguration key="configuration" style="plain" title="鎸傛柇"/>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
- <integer key="value" value="8"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
- <userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
- <real key="value" value="0.5"/>
- </userDefinedRuntimeAttribute>
- <userDefinedRuntimeAttribute type="color" keyPath="layer. borderColorWithUIColor">
- <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
- </userDefinedRuntimeAttribute>
- </userDefinedRuntimeAttributes>
+ <constraints>
+ <constraint firstAttribute="height" constant="120" id="NXb-C0-Nw5"/>
+ </constraints>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+ <state key="normal" title="鎸傛柇" image="hdl_ez_cat_eyes_hang_up">
+ <color key="titleColor" red="0.1058823529" green="0.1764705882" blue="0.30196078430000001" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
<connections>
<action selector="clickCalloutHangupAction:" destination="uBF-Yq-Qo0" eventType="touchUpInside" id="Szo-xH-Mh6"/>
</connections>
@@ -1368,7 +1344,6 @@
<constraint firstAttribute="trailing" secondItem="8Fe-E7-C5g" secondAttribute="trailing" constant="32" id="8NR-Fc-tPc"/>
<constraint firstItem="aq5-rn-Dgo" firstAttribute="leading" secondItem="jPI-nC-uAq" secondAttribute="trailing" constant="32" id="8ht-5u-0y7"/>
<constraint firstItem="2bC-B5-gMZ" firstAttribute="height" secondItem="aq5-rn-Dgo" secondAttribute="height" id="B0O-2O-7OG"/>
- <constraint firstAttribute="height" secondItem="aq5-rn-Dgo" secondAttribute="height" multiplier="10.1429" id="BR6-y6-ljY"/>
<constraint firstItem="jPI-nC-uAq" firstAttribute="centerY" secondItem="sMv-Yh-W5N" secondAttribute="centerY" id="Fa3-MI-9zW"/>
<constraint firstItem="aq5-rn-Dgo" firstAttribute="width" secondItem="jPI-nC-uAq" secondAttribute="width" multiplier="1.07143" id="Jzm-Kq-s1B"/>
<constraint firstItem="aq5-rn-Dgo" firstAttribute="top" secondItem="8Fe-E7-C5g" secondAttribute="bottom" constant="50" id="aM7-YH-wta"/>
@@ -2602,6 +2577,9 @@
<image name="chuanshujilu--2" width="24" height="24"/>
<image name="cloud" width="32" height="32"/>
<image name="duijiangji" width="39" height="39"/>
+ <image name="hdl_ez_cat_eyes_answer" width="68" height="68"/>
+ <image name="hdl_ez_cat_eyes_hang_up" width="68" height="68"/>
+ <image name="hdl_ez_cat_eyes_ignore" width="68" height="68"/>
<image name="hdl_ez_list_next" width="8" height="8"/>
<image name="icon_download_fill" width="20" height="20"/>
<image name="large_back_btn" width="10" height="19"/>
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a b/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
index f03bcb6..7b678be 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.a
Binary files differ
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings b/EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings
index d14b423..25423a4 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings
@@ -50,6 +50,7 @@
"device_verify_code_wrong"="Incorrect device password.";
"device_restart_talk"="Enabling two-way audio. Please wait...";
"device_save_gallery"="Saved to the albums.";
+"device_save_gallery_failure"="Download failure";
"device_analogue_camera"="Analog Channel";
"device_digital_camera"="Digital Channel";
"device_lan_device_list_title"="LAN Device List";
diff --git a/EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings b/EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings
index 8ba980f..ebed68a 100644
--- a/EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings
+++ b/EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings
@@ -50,6 +50,7 @@
"device_verify_code_wrong"="璁惧瀵嗙爜閿欒";
"device_restart_talk"="姝e湪寮�鍚璁诧紝璇风◢鍊�...";
"device_save_gallery"="宸蹭繚瀛樿嚦鎵嬫満鐩稿唽";
+"device_save_gallery_failure"="涓嬭浇澶辫触";
"device_analogue_camera"="妯℃嫙閫氶亾";
"device_digital_camera"="鏁板瓧閫氶亾";
"device_lan_device_list_title"="灞�鍩熺綉璁惧鍒楄〃";
diff --git a/EZSDK/EZSDK.xcodeproj/project.pbxproj b/EZSDK/EZSDK.xcodeproj/project.pbxproj
index 5930dbe..a290e67 100644
--- a/EZSDK/EZSDK.xcodeproj/project.pbxproj
+++ b/EZSDK/EZSDK.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
830957C32A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */; };
+ 83EE503D2A41C9BA0006435D /* HDLEZOPButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EE503C2A41C9BA0006435D /* HDLEZOPButton.m */; };
AE31FE1F29CC2D2200678568 /* EZOpenSDKFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE31FE1E29CC2D2200678568 /* EZOpenSDKFramework.framework */; platformFilter = ios; };
AE5068D829B9DB5E009EA09A /* HDLEZTemInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = AE5068D729B9DB5E009EA09A /* HDLEZTemInfoModel.m */; };
AEC306D229B9F2B5000B3861 /* HDLEZVisitorRecordView.m in Sources */ = {isa = PBXBuildFile; fileRef = AEC306D129B9F2B5000B3861 /* HDLEZVisitorRecordView.m */; };
@@ -187,6 +188,8 @@
/* Begin PBXFileReference section */
830957C12A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZVideoDoorMsgCell.h; sourceTree = "<group>"; };
830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoDoorMsgCell.m; sourceTree = "<group>"; };
+ 83EE503B2A41C9BA0006435D /* HDLEZOPButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZOPButton.h; sourceTree = "<group>"; };
+ 83EE503C2A41C9BA0006435D /* HDLEZOPButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZOPButton.m; sourceTree = "<group>"; };
AE31FE1E29CC2D2200678568 /* EZOpenSDKFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = EZOpenSDKFramework.framework; sourceTree = "<group>"; };
AE5068D629B9DB5E009EA09A /* HDLEZTemInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZTemInfoModel.h; sourceTree = "<group>"; };
AE5068D729B9DB5E009EA09A /* HDLEZTemInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZTemInfoModel.m; sourceTree = "<group>"; };
@@ -690,6 +693,8 @@
AEF0148E29C188ED00D014FD /* HDLEZScrollView.m */,
AEDD437E29BED161001D9477 /* HDLEZButton.h */,
AEDD437D29BED161001D9477 /* HDLEZButton.m */,
+ 83EE503B2A41C9BA0006435D /* HDLEZOPButton.h */,
+ 83EE503C2A41C9BA0006435D /* HDLEZOPButton.m */,
AEE84D4729BAE2550078FDAD /* HDLEZNoDataView.h */,
AEE84D4829BAE2590078FDAD /* HDLEZNoDataView.m */,
AEE84D4529BACBAD0078FDAD /* HDLEZTopBarView.h */,
@@ -1574,6 +1579,7 @@
B9BC9A1E25C0FFBD00C024FE /* EZWifiInfoViewController.m in Sources */,
830957C32A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m in Sources */,
AEF0148F29C188ED00D014FD /* HDLEZScrollView.m in Sources */,
+ 83EE503D2A41C9BA0006435D /* HDLEZOPButton.m in Sources */,
B9BC9A1925C0FFBD00C024FE /* EZAPWiFiConfigViewController.m in Sources */,
B95AB88826984DD5007BC8D7 /* YYClassInfo.m in Sources */,
B95AB88726984DD5007BC8D7 /* NSObject+YYModel.m in Sources */,
diff --git a/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.h b/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.h
new file mode 100644
index 0000000..d87c585
--- /dev/null
+++ b/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.h
@@ -0,0 +1,88 @@
+//
+// HDLEZOPButton.h
+// EZSDK
+//
+// Created by Davin on 2023/6/20.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// 鎺у埗鍥剧墖鍦║IButton閲岀殑浣嶇疆锛岄粯璁や负HDLOPButtonImagePositionLeft
+typedef NS_ENUM(NSUInteger, HDLEZOPButtonImagePosition) {
+ HDLEZOPButtonImagePositionTop, // imageView鍦╰itleLabel涓婇潰
+ HDLEZOPButtonImagePositionLeft, // imageView鍦╰itleLabel宸﹁竟
+ HDLEZOPButtonImagePositionBottom, // imageView鍦╰itleLabel涓嬮潰
+ HDLEZOPButtonImagePositionRight, // imageView鍦╰itleLabel鍙宠竟
+};
+
+@interface HDLEZOPButton : UIButton
+
+/**
+ * 瀛愮被缁ф壙鏃堕噸鍐欑殑鏂规硶锛屼竴鑸笉寤鸿閲嶅啓 initWithXxx
+ */
+- (void)didInitialize NS_REQUIRES_SUPER;
+
+/**
+ * 璁╂寜閽殑鏂囧瓧棰滆壊鑷姩璺熼殢tintColor璋冩暣锛堢郴缁熼粯璁itleColor鏄笉璺熼殢鐨勶級<br/>
+ * 榛樿涓篘O
+ */
+@property(nonatomic, assign) IBInspectable BOOL adjustsTitleTintColorAutomatically;
+
+/**
+ * 璁╂寜閽殑鍥剧墖棰滆壊鑷姩璺熼殢tintColor璋冩暣锛堢郴缁熼粯璁mage鏄渶瑕佹洿鏀箁enderingMode鎵嶅彲浠ヨ揪鍒拌繖绉嶆晥鏋滐級<br/>
+ * 榛樿涓篘O
+ */
+@property(nonatomic, assign) IBInspectable BOOL adjustsImageTintColorAutomatically;
+
+/**
+ * 绛変环浜� adjustsTitleTintColorAutomatically = YES & adjustsImageTintColorAutomatically = YES & tintColor = xxx
+ * @warning 涓嶆敮鎸佷紶 nil
+ */
+@property(nonatomic, strong) IBInspectable UIColor *tintColorAdjustsTitleAndImage;
+
+/**
+ * 鏄惁鑷姩璋冩暣highlighted鏃剁殑鎸夐挳鏍峰紡锛岄粯璁や负YES銆�<br/>
+ * 褰撳�间负YES鏃讹紝鎸夐挳highlighted鏃朵細鏀瑰彉鑷韩鐨刟lpha灞炴�т负<b>ButtonHighlightedAlpha</b>
+ */
+@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenHighlighted;
+
+/**
+ * 鏄惁鑷姩璋冩暣disabled鏃剁殑鎸夐挳鏍峰紡锛岄粯璁や负YES銆�<br/>
+ * 褰撳�间负YES鏃讹紝鎸夐挳disabled鏃朵細鏀瑰彉鑷韩鐨刟lpha灞炴�т负<b>ButtonDisabledAlpha</b>
+ */
+@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenDisabled;
+
+/**
+ * 璁剧疆鎸夐挳鐐瑰嚮鏃剁殑鑳屾櫙鑹诧紝榛樿涓簄il銆�
+ * @warning 涓嶆敮鎸佸甫閫忔槑搴︾殑鑳屾櫙棰滆壊銆傚綋璁剧疆highlightedBackgroundColor鏃讹紝浼氬己鍒舵妸adjustsButtonWhenHighlighted璁句负NO锛岄伩鍏嶄袱鑰呮晥鏋滃啿绐併��
+ * @see adjustsButtonWhenHighlighted
+ */
+@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBackgroundColor;
+
+/**
+ * 璁剧疆鎸夐挳鐐瑰嚮鏃剁殑杈规棰滆壊锛岄粯璁や负nil銆�
+ * @warning 褰撹缃甴ighlightedBorderColor鏃讹紝浼氬己鍒舵妸adjustsButtonWhenHighlighted璁句负NO锛岄伩鍏嶄袱鑰呮晥鏋滃啿绐併��
+ * @see adjustsButtonWhenHighlighted
+ */
+@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBorderColor;
+
+/**
+ * 璁剧疆鎸夐挳閲屽浘鏍囧拰鏂囧瓧鐨勭浉瀵逛綅缃紝榛樿涓篐DLOPButtonImagePositionLeft<br/>
+ * 鍙厤鍚坕mageEdgeInsets銆乼itleEdgeInsets銆乧ontentHorizontalAlignment銆乧ontentVerticalAlignment浣跨敤
+ */
+@property(nonatomic, assign) HDLEZOPButtonImagePosition imagePosition;
+
+/**
+ * 璁剧疆鎸夐挳閲屽浘鏍囧拰鏂囧瓧涔嬮棿鐨勯棿闅旓紝浼氳嚜鍔ㄥ搷搴� imagePosition 鐨勫彉鍖栬�屽彉鍖栵紝榛樿涓�0銆�<br/>
+ * 绯荤粺榛樿瀹炵幇闇�瑕佸悓鏃惰缃� titleEdgeInsets 鍜� imageEdgeInsets锛屽悓鏃惰繕闇�鑰冭檻 contentEdgeInsets 鐨勫鍔狅紙鍚﹀垯涓嶄細褰卞搷甯冨眬锛屽彲鑳戒細璁╁浘鏍囨垨鏂囧瓧婧㈠嚭鎴栨尋鍘嬶級锛屼娇鐢ㄨ灞炴�у彲浠ラ伩鍏嶄互涓婃儏鍐点��<br/>
+ * @warning 浼氫笌 imageEdgeInsets銆� titleEdgeInsets銆� contentEdgeInsets 鍏卞悓浣滅敤銆�
+ */
+@property(nonatomic, assign) IBInspectable CGFloat spacingBetweenImageAndTitle;
+
+@property(nonatomic, assign) IBInspectable CGFloat cornerRadius UI_APPEARANCE_SELECTOR;// 榛樿涓� 0銆傚皢鍏惰缃负 HDLOPButtonCornerRadiusAdjustsBounds 鍙嚜鍔ㄤ繚鎸佸渾瑙掍负鎸夐挳楂樺害鐨勪竴鍗娿��
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.m b/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.m
new file mode 100644
index 0000000..fc91342
--- /dev/null
+++ b/EZSDK/EZSDK/EZ/Base/HDLEZOPButton.m
@@ -0,0 +1,729 @@
+//
+// HDLEZOPButton.m
+// EZSDK
+//
+// Created by Davin on 2023/6/20.
+//
+
+#import "HDLEZOPButton.h"
+
+#define HDLOPScreenScale ([[UIScreen mainScreen] scale])
+
+#pragma mark - Clang
+#define ArgumentToString(macro) #macro
+#define ClangWarningConcat(warning_name) ArgumentToString(clang diagnostic ignored warning_name)
+/// 鍙傛暟鍙洿鎺ヤ紶鍏� clang 鐨� warning 鍚嶏紝warning 鍒楄〃鍙傝�冿細https://clang.llvm.org/docs/DiagnosticsReference.html
+#define BeginIgnoreClangWarning(warningName) _Pragma("clang diagnostic push") _Pragma(ClangWarningConcat(#warningName))
+#define EndIgnoreClangWarning _Pragma("clang diagnostic pop")
+#define HDLOPBeginIgnorePerformSelectorLeaksWarning BeginIgnoreClangWarning(-Warc-performSelector-leaks)
+#define HDLOPEndIgnorePerformSelectorLeaksWarning EndIgnoreClangWarning
+
+#define CGSizeMax CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
+
+
+
+CG_INLINE CGFloat
+removeFloatMin(CGFloat floatValue) {
+ return floatValue == CGFLOAT_MIN ? 0 : floatValue;
+}
+
+CG_INLINE CGFloat
+flatSpecificScale(CGFloat floatValue, CGFloat scale) {
+ floatValue = removeFloatMin(floatValue);
+ scale = scale ?: HDLOPScreenScale;
+ CGFloat flattedValue = ceil(floatValue * scale) / scale;
+ return flattedValue;
+}
+
+CG_INLINE CGFloat
+flat(CGFloat floatValue) {
+ return flatSpecificScale(floatValue, 0);
+}
+
+CG_INLINE UIEdgeInsets
+UIEdgeInsetsRemoveFloatMin(UIEdgeInsets insets) {
+ UIEdgeInsets result = UIEdgeInsetsMake(removeFloatMin(insets.top), removeFloatMin(insets.left), removeFloatMin(insets.bottom), removeFloatMin(insets.right));
+ return result;
+}
+
+/// 鑾峰彇UIEdgeInsets鍦ㄦ按骞虫柟鍚戜笂鐨勫��
+CG_INLINE CGFloat
+UIEdgeInsetsGetHorizontalValue(UIEdgeInsets insets) {
+ return insets.left + insets.right;
+}
+
+/// 鑾峰彇UIEdgeInsets鍦ㄥ瀭鐩存柟鍚戜笂鐨勫��
+CG_INLINE CGFloat
+UIEdgeInsetsGetVerticalValue(UIEdgeInsets insets) {
+ return insets.top + insets.bottom;
+}
+
+/// 浼犲叆size锛岃繑鍥炰竴涓獂/y涓�0鐨凜GRect
+CG_INLINE CGRect
+CGRectMakeWithSize(CGSize size) {
+ return CGRectMake(0, 0, size.width, size.height);
+}
+
+CG_INLINE CGRect
+CGRectSetX(CGRect rect, CGFloat x) {
+ rect.origin.x = flat(x);
+ return rect;
+}
+
+CG_INLINE CGRect
+CGRectSetY(CGRect rect, CGFloat y) {
+ rect.origin.y = flat(y);
+ return rect;
+}
+
+CG_INLINE CGRect
+CGRectSetXY(CGRect rect, CGFloat x, CGFloat y) {
+ rect.origin.x = flat(x);
+ rect.origin.y = flat(y);
+ return rect;
+}
+
+CG_INLINE CGRect
+CGRectSetWidth(CGRect rect, CGFloat width) {
+ if (width < 0) {
+ return rect;
+ }
+ rect.size.width = flat(width);
+ return rect;
+}
+
+CG_INLINE CGRect
+CGRectSetHeight(CGRect rect, CGFloat height) {
+ if (height < 0) {
+ return rect;
+ }
+ rect.size.height = flat(height);
+ return rect;
+}
+
+/// 灏嗕竴涓� CGSize 鍍忕礌瀵归綈
+CG_INLINE CGSize
+CGSizeFlatted(CGSize size) {
+ return CGSizeMake(flat(size.width), flat(size.height));
+}
+
+CG_INLINE CGRect
+CGRectSetSize(CGRect rect, CGSize size) {
+ rect.size = CGSizeFlatted(size);
+ return rect;
+}
+
+
+/// 鐢ㄤ簬灞呬腑杩愮畻
+CG_INLINE CGFloat
+CGFloatGetCenter(CGFloat parent, CGFloat child) {
+ return flat((parent - child) / 2.0);
+}
+
+/// 瀵笴GRect鐨剎/y銆亀idth/height閮借皟鐢ㄤ竴娆lat锛屼互淇濊瘉鍍忕礌瀵归綈
+CG_INLINE CGRect
+CGRectFlatted(CGRect rect) {
+ return CGRectMake(flat(rect.origin.x), flat(rect.origin.y), flat(rect.size.width), flat(rect.size.height));
+}
+
+/// 鍒ゆ柇涓�涓� CGSize 鏄惁涓虹┖锛堝鎴栭珮涓�0锛�
+CG_INLINE BOOL
+CGSizeIsEmpty(CGSize size) {
+ return size.width <= 0 || size.height <= 0;
+}
+
+const CGFloat HDLOPButtonCornerRadiusAdjustsBounds = -1;
+
+@interface HDLEZOPButton ()
+
+@property(nonatomic, strong) CALayer *highlightedBackgroundLayer;
+@property(nonatomic, strong) UIColor *originBorderColor;
+@end
+
+@implementation HDLEZOPButton
+
+
+
+- (instancetype)initWithFrame:(CGRect)frame {
+ if (self = [super initWithFrame:frame]) {
+ self.tintColor = HDLEZHEXCOLOR(0x5C62FE,0.1);
+ [self setTitleColor:self.tintColor forState:UIControlStateNormal];// 鍒濆鍖栨椂 adjustsTitleTintColorAutomatically 杩樻槸 NO锛屾墍浠ヨ繖閲屾墜鍔ㄦ妸 titleColor 璁剧疆涓� tintColor 鐨勫��
+
+ // iOS7浠ュ悗鐨刡utton锛宻izeToFit鍚庨粯璁や細鑷甫涓�涓笂涓嬬殑contentInsets锛屼负浜嗕繚璇佹寜閽ぇ灏忓嵆涓哄唴瀹瑰ぇ灏忥紝杩欓噷鐩存帴鍘绘帀锛屾敼涓轰竴涓渶灏忕殑鍊笺��
+ self.contentEdgeInsets = UIEdgeInsetsMake(CGFLOAT_MIN, 0, CGFLOAT_MIN, 0);
+
+ // 鏀惧湪鍚庨潰锛岃鍓嶉潰鐨勯粯璁ゅ�煎彲浠ヨ瀛愮被閲嶅啓鐨� didInitialize 瑕嗙洊
+ [self didInitialize];
+ }
+ return self;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)aDecoder {
+ if (self = [super initWithCoder:aDecoder]) {
+ [self didInitialize];
+ }
+ return self;
+}
+
+- (void)didInitialize {
+ // 榛樿鎺ョhighlighted鍜宒isabled鐨勮〃鐜帮紝鍘绘帀绯荤粺榛樿鐨勮〃鐜�
+ self.adjustsImageWhenHighlighted = NO;
+ self.adjustsImageWhenDisabled = NO;
+ self.adjustsButtonWhenHighlighted = YES;
+ self.adjustsButtonWhenDisabled = YES;
+
+ // 鍥剧墖榛樿鍦ㄦ寜閽乏杈癸紝涓庣郴缁烾IButton淇濇寔涓�鑷�
+ self.imagePosition = HDLEZOPButtonImagePositionLeft;
+}
+
+// 绯荤粺璁块棶 self.imageView 浼氳Е鍙� layout锛岃�岀鏈夋柟娉� _imageView 鍒欐槸绠�鍗曞湴璁块棶 imageView锛屾墍浠ュ湪 HDLOPButton layoutSubviews 閲屽簲璇ョ敤杩欎釜鏂规硶
+- (UIImageView *)_hdlop_imageView {
+ HDLOPBeginIgnorePerformSelectorLeaksWarning
+ return [self performSelector:NSSelectorFromString(@"_imageView")];
+ HDLOPEndIgnorePerformSelectorLeaksWarning
+}
+
+- (CGSize)sizeThatFits:(CGSize)size {
+ // 濡傛灉璋冪敤 sizeToFit锛岄偅涔堜紶杩涙潵鐨� size 灏辨槸褰撳墠鎸夐挳鐨� size锛屾鏃剁殑璁$畻涓嶈鍘婚檺鍒跺楂�
+ // 绯荤粺 UIButton 涓嶇浠讳綍鏃跺�欙紝瀵� sizeThatFits:CGSizeZero 閮戒細杩斿洖鐪熷疄鐨勫唴瀹瑰ぇ灏忥紝杩欓噷瀵归綈
+ if (CGSizeEqualToSize(self.bounds.size, size) || CGSizeIsEmpty(size)) {
+ size = CGSizeMax;
+ }
+
+ BOOL isImageViewShowing = !!self.currentImage;
+ BOOL isTitleLabelShowing = !!self.currentTitle || self.currentAttributedTitle;
+ CGSize imageTotalSize = CGSizeZero;// 鍖呭惈 imageEdgeInsets 閭d簺绌洪棿
+ CGSize titleTotalSize = CGSizeZero;// 鍖呭惈 titleEdgeInsets 閭d簺绌洪棿
+ CGFloat spacingBetweenImageAndTitle = flat(isImageViewShowing && isTitleLabelShowing ? self.spacingBetweenImageAndTitle : 0);// 濡傛灉鍥剧墖鎴栨枃瀛楁煇涓�鑰呮病鏄剧ず锛屽垯杩欎釜 spacing 涓嶈�冭檻杩涘竷灞�
+ UIEdgeInsets contentEdgeInsets = UIEdgeInsetsRemoveFloatMin(self.contentEdgeInsets);
+ CGSize resultSize = CGSizeZero;
+ CGSize contentLimitSize = CGSizeMake(size.width - UIEdgeInsetsGetHorizontalValue(contentEdgeInsets), size.height - UIEdgeInsetsGetVerticalValue(contentEdgeInsets));
+
+ switch (self.imagePosition) {
+ case HDLEZOPButtonImagePositionTop:
+ case HDLEZOPButtonImagePositionBottom: {
+ // 鍥剧墖鍜屾枃瀛椾笂涓嬫帓鐗堟椂锛屽搴︿互鏂囧瓧鎴栧浘鐗囩殑鏈�澶у搴︿负鏈�缁堝搴�
+ if (isImageViewShowing) {
+ CGFloat imageLimitWidth = contentLimitSize.width - UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets);
+ CGSize imageSize = self.imageView.image ? [self.imageView sizeThatFits:CGSizeMake(imageLimitWidth, CGFLOAT_MAX)] : self.currentImage.size;
+ imageSize.width = MIN(imageSize.width, imageLimitWidth);// HDLOPButton sizeThatFits 鏃� self._imageView 涓� nil 浣� self.imageView 鏈夊�硷紝鑰屽紑鍚簡 Bold Text 鏃讹紝绯荤粺鐨� self.imageView sizeThatFits 杩斿洖鍊间細姣旀病寮�鍚� BoldText 鏃跺 1pt锛堜笉鐭ラ亾涓轰粈涔堟枃瀛楀姞绮椾笌鍚︿細褰卞搷 imageView...锛夛紝浠庤�屼繚璇佸紑鍚� Bold Text 鍚庢枃瀛椾緷鐒惰兘瀹屾暣灞曠ず鍑烘潵锛屾墍浠ヨ繖閲屽簲璇ョ敤 self.imageView 鑰屼笉鏄� self._imageView
+ imageTotalSize = CGSizeMake(imageSize.width + UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets), imageSize.height + UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ }
+
+ if (isTitleLabelShowing) {
+ CGSize titleLimitSize = CGSizeMake(contentLimitSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), contentLimitSize.height - imageTotalSize.height - spacingBetweenImageAndTitle - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ CGSize titleSize = [self.titleLabel sizeThatFits:titleLimitSize];
+ titleSize.height = MIN(titleSize.height, titleLimitSize.height);
+ titleTotalSize = CGSizeMake(titleSize.width + UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), titleSize.height + UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+
+ resultSize.width = UIEdgeInsetsGetHorizontalValue(contentEdgeInsets);
+ resultSize.width += MAX(imageTotalSize.width, titleTotalSize.width);
+ resultSize.height = UIEdgeInsetsGetVerticalValue(contentEdgeInsets) + imageTotalSize.height + spacingBetweenImageAndTitle + titleTotalSize.height;
+ }
+ break;
+
+ case HDLEZOPButtonImagePositionLeft:
+ case HDLEZOPButtonImagePositionRight: {
+ // 鍥剧墖鍜屾枃瀛楁按骞虫帓鐗堟椂锛岄珮搴︿互鏂囧瓧鎴栧浘鐗囩殑鏈�澶ч珮搴︿负鏈�缁堥珮搴�
+ // 娉ㄦ剰杩欓噷鏈変竴涓拰绯荤粺涓嶄竴鑷寸殑琛屼负锛氬綋 titleLabel 涓哄琛屾椂锛岀郴缁熺殑 sizeThatFits: 璁$畻缁撴灉鍥哄畾鏄崟琛岀殑锛屾墍浠ュ綋 HDLOPButtonImagePositionLeft 骞朵笖titleLabel 澶氳鐨勬儏鍐典笅锛孒DLOPButton 璁$畻鐨勭粨鏋滀笌绯荤粺涓嶄竴鑷�
+
+ if (isImageViewShowing) {
+ CGFloat imageLimitHeight = contentLimitSize.height - UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets);
+ CGSize imageSize = self.imageView.image ? [self.imageView sizeThatFits:CGSizeMake(CGFLOAT_MAX, imageLimitHeight)] : self.currentImage.size;
+ imageSize.height = MIN(imageSize.height, imageLimitHeight);// HDLOPButton sizeThatFits 鏃� self._imageView 涓� nil 浣� self.imageView 鏈夊�硷紝鑰屽紑鍚簡 Bold Text 鏃讹紝绯荤粺鐨� self.imageView sizeThatFits 杩斿洖鍊间細姣旀病寮�鍚� BoldText 鏃跺 1pt锛堜笉鐭ラ亾涓轰粈涔堟枃瀛楀姞绮椾笌鍚︿細褰卞搷 imageView...锛夛紝浠庤�屼繚璇佸紑鍚� Bold Text 鍚庢枃瀛椾緷鐒惰兘瀹屾暣灞曠ず鍑烘潵锛屾墍浠ヨ繖閲屽簲璇ョ敤 self.imageView 鑰屼笉鏄� self._imageView
+ imageTotalSize = CGSizeMake(imageSize.width + UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets), imageSize.height + UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ }
+
+ if (isTitleLabelShowing) {
+ CGSize titleLimitSize = CGSizeMake(contentLimitSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets) - imageTotalSize.width - spacingBetweenImageAndTitle, contentLimitSize.height - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ CGSize titleSize = [self.titleLabel sizeThatFits:titleLimitSize];
+ titleSize.height = MIN(titleSize.height, titleLimitSize.height);
+ titleTotalSize = CGSizeMake(titleSize.width + UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), titleSize.height + UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+
+ resultSize.width = UIEdgeInsetsGetHorizontalValue(contentEdgeInsets) + imageTotalSize.width + spacingBetweenImageAndTitle + titleTotalSize.width;
+ resultSize.height = UIEdgeInsetsGetVerticalValue(contentEdgeInsets);
+ resultSize.height += MAX(imageTotalSize.height, titleTotalSize.height);
+ }
+ break;
+ }
+ return resultSize;
+}
+
+- (CGSize)intrinsicContentSize {
+ return [self sizeThatFits:CGSizeMax];
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+
+ if (CGRectIsEmpty(self.bounds)) {
+ return;
+ }
+
+ if (self.cornerRadius == HDLOPButtonCornerRadiusAdjustsBounds) {
+ self.layer.cornerRadius = CGRectGetHeight(self.bounds) / 2;
+ }
+
+ BOOL isImageViewShowing = !!self.currentImage;
+ BOOL isTitleLabelShowing = !!self.currentTitle || !!self.currentAttributedTitle;
+ CGSize imageLimitSize = CGSizeZero;
+ CGSize titleLimitSize = CGSizeZero;
+ CGSize imageTotalSize = CGSizeZero;// 鍖呭惈 imageEdgeInsets 閭d簺绌洪棿
+ CGSize titleTotalSize = CGSizeZero;// 鍖呭惈 titleEdgeInsets 閭d簺绌洪棿
+ CGFloat spacingBetweenImageAndTitle = flat(isImageViewShowing && isTitleLabelShowing ? self.spacingBetweenImageAndTitle : 0);// 濡傛灉鍥剧墖鎴栨枃瀛楁煇涓�鑰呮病鏄剧ず锛屽垯杩欎釜 spacing 涓嶈�冭檻杩涘竷灞�
+ CGRect imageFrame = CGRectZero;
+ CGRect titleFrame = CGRectZero;
+ UIEdgeInsets contentEdgeInsets = UIEdgeInsetsRemoveFloatMin(self.contentEdgeInsets);
+ CGSize contentSize = CGSizeMake(CGRectGetWidth(self.bounds) - UIEdgeInsetsGetHorizontalValue(contentEdgeInsets), CGRectGetHeight(self.bounds) - UIEdgeInsetsGetVerticalValue(contentEdgeInsets));
+
+ // 鍥剧墖鐨勫竷灞�鍘熷垯閮芥槸灏介噺瀹屾暣灞曠ず锛屾墍浠ヤ笉绠� imagePosition 鐨勫�兼槸浠�涔堬紝杩欎釜璁$畻杩囩▼閮芥槸鐩稿悓鐨�
+ if (isImageViewShowing) {
+ imageLimitSize = CGSizeMake(contentSize.width - UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets), contentSize.height - UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ CGSize imageSize = self._hdlop_imageView.image ? [self._hdlop_imageView sizeThatFits:imageLimitSize] : self.currentImage.size;
+ imageSize.width = MIN(imageLimitSize.width, imageSize.width);
+ imageSize.height = MIN(imageLimitSize.height, imageSize.height);
+ imageFrame = CGRectMakeWithSize(imageSize);
+ imageTotalSize = CGSizeMake(imageSize.width + UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets), imageSize.height + UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ }
+
+ // UIButton 濡傛灉鏈韩澶у皬涓� (0,0)锛屾鏃惰缃竴涓� imageEdgeInsets 浼氳 imageView 鐨� bounds 閿欒锛屽鑷村悗缁� imageView 鐨� subviews 甯冨眬鏃朵細浜х敓鍋忕Щ锛屽洜姝よ繖閲屽仛涓�娆′繚鎶�
+ void (^makesureBoundsPositive)(UIView *) = ^void(UIView *view) {
+ CGRect bounds = view.bounds;
+ if (CGRectGetMinX(bounds) < 0 || CGRectGetMinY(bounds) < 0) {
+ bounds = CGRectMakeWithSize(bounds.size);
+ view.bounds = bounds;
+ }
+ };
+ if (isImageViewShowing) {
+ makesureBoundsPositive(self._hdlop_imageView);
+ }
+ if (isTitleLabelShowing) {
+ makesureBoundsPositive(self.titleLabel);
+ }
+
+ if (self.imagePosition == HDLEZOPButtonImagePositionTop || self.imagePosition == HDLEZOPButtonImagePositionBottom) {
+
+ if (isTitleLabelShowing) {
+ titleLimitSize = CGSizeMake(contentSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), contentSize.height - imageTotalSize.height - spacingBetweenImageAndTitle - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ CGSize titleSize = [self.titleLabel sizeThatFits:titleLimitSize];
+ titleSize.width = MIN(titleLimitSize.width, titleSize.width);
+ titleSize.height = MIN(titleLimitSize.height, titleSize.height);
+ titleFrame = CGRectMakeWithSize(titleSize);
+ titleTotalSize = CGSizeMake(titleSize.width + UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), titleSize.height + UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+
+ switch (self.contentHorizontalAlignment) {
+ case UIControlContentHorizontalAlignmentLeft:
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left) : titleFrame;
+ break;
+ case UIControlContentHorizontalAlignmentCenter:
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left + CGFloatGetCenter(imageLimitSize.width, CGRectGetWidth(imageFrame))) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left + CGFloatGetCenter(titleLimitSize.width, CGRectGetWidth(titleFrame))) : titleFrame;
+ break;
+ case UIControlContentHorizontalAlignmentRight:
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.imageEdgeInsets.right - CGRectGetWidth(imageFrame)) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.titleEdgeInsets.right - CGRectGetWidth(titleFrame)) : titleFrame;
+ break;
+ case UIControlContentHorizontalAlignmentFill:
+ if (isImageViewShowing) {
+ imageFrame = CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left);
+ imageFrame = CGRectSetWidth(imageFrame, imageLimitSize.width);
+ }
+ if (isTitleLabelShowing) {
+ titleFrame = CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left);
+ titleFrame = CGRectSetWidth(titleFrame, titleLimitSize.width);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (self.imagePosition == HDLEZOPButtonImagePositionTop) {
+ switch (self.contentVerticalAlignment) {
+ case UIControlContentVerticalAlignmentTop:
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, contentEdgeInsets.top + imageTotalSize.height + spacingBetweenImageAndTitle + self.titleEdgeInsets.top) : titleFrame;
+ break;
+ case UIControlContentVerticalAlignmentCenter: {
+ CGFloat contentHeight = imageTotalSize.height + spacingBetweenImageAndTitle + titleTotalSize.height;
+ CGFloat minY = CGFloatGetCenter(contentSize.height, contentHeight) + contentEdgeInsets.top;
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, minY + self.imageEdgeInsets.top) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, minY + imageTotalSize.height + spacingBetweenImageAndTitle + self.titleEdgeInsets.top) : titleFrame;
+ }
+ break;
+ case UIControlContentVerticalAlignmentBottom:
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.titleEdgeInsets.bottom - CGRectGetHeight(titleFrame)) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - titleTotalSize.height - spacingBetweenImageAndTitle - self.imageEdgeInsets.bottom - CGRectGetHeight(imageFrame)) : imageFrame;
+ break;
+ case UIControlContentVerticalAlignmentFill: {
+ if (isImageViewShowing && isTitleLabelShowing) {
+
+ // 鍚屾椂鏄剧ず鍥剧墖鍜� label 鐨勬儏鍐典笅锛屽浘鐗囬珮搴︽寜鏈韩澶у皬鏄剧ず锛屽墿浣欑┖闂寸暀缁� label
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, contentEdgeInsets.top + imageTotalSize.height + spacingBetweenImageAndTitle + self.titleEdgeInsets.top) : titleFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetHeight(titleFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.titleEdgeInsets.bottom - CGRectGetMinY(titleFrame)) : titleFrame;
+
+ } else if (isImageViewShowing) {
+ imageFrame = CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top);
+ imageFrame = CGRectSetHeight(imageFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ } else {
+ titleFrame = CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top);
+ titleFrame = CGRectSetHeight(titleFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+ }
+ break;
+ }
+ } else {
+ switch (self.contentVerticalAlignment) {
+ case UIControlContentVerticalAlignmentTop:
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, contentEdgeInsets.top + titleTotalSize.height + spacingBetweenImageAndTitle + self.imageEdgeInsets.top) : imageFrame;
+ break;
+ case UIControlContentVerticalAlignmentCenter: {
+ CGFloat contentHeight = imageTotalSize.height + titleTotalSize.height + spacingBetweenImageAndTitle;
+ CGFloat minY = CGFloatGetCenter(contentSize.height, contentHeight) + contentEdgeInsets.top;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, minY + self.titleEdgeInsets.top) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, minY + titleTotalSize.height + spacingBetweenImageAndTitle + self.imageEdgeInsets.top) : imageFrame;
+ }
+ break;
+ case UIControlContentVerticalAlignmentBottom:
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.imageEdgeInsets.bottom - CGRectGetHeight(imageFrame)) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - imageTotalSize.height - spacingBetweenImageAndTitle - self.titleEdgeInsets.bottom - CGRectGetHeight(titleFrame)) : titleFrame;
+ break;
+ case UIControlContentVerticalAlignmentFill: {
+ if (isImageViewShowing && isTitleLabelShowing) {
+
+ // 鍚屾椂鏄剧ず鍥剧墖鍜� label 鐨勬儏鍐典笅锛屽浘鐗囬珮搴︽寜鏈韩澶у皬鏄剧ず锛屽墿浣欑┖闂寸暀缁� label
+ imageFrame = CGRectSetY(imageFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.imageEdgeInsets.bottom - CGRectGetHeight(imageFrame));
+ titleFrame = CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top);
+ titleFrame = CGRectSetHeight(titleFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - imageTotalSize.height - spacingBetweenImageAndTitle - self.titleEdgeInsets.bottom - CGRectGetMinY(titleFrame));
+
+ } else if (isImageViewShowing) {
+ imageFrame = CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top);
+ imageFrame = CGRectSetHeight(imageFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ } else {
+ titleFrame = CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top);
+ titleFrame = CGRectSetHeight(titleFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+ }
+ break;
+ }
+ }
+
+ if (isImageViewShowing) {
+ imageFrame = CGRectFlatted(imageFrame);
+ self._hdlop_imageView.frame = imageFrame;
+ }
+ if (isTitleLabelShowing) {
+ titleFrame = CGRectFlatted(titleFrame);
+ self.titleLabel.frame = titleFrame;
+ }
+
+ } else if (self.imagePosition == HDLEZOPButtonImagePositionLeft || self.imagePosition == HDLEZOPButtonImagePositionRight) {
+
+ if (isTitleLabelShowing) {
+ titleLimitSize = CGSizeMake(contentSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets) - imageTotalSize.width - spacingBetweenImageAndTitle, contentSize.height - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ CGSize titleSize = [self.titleLabel sizeThatFits:titleLimitSize];
+ titleSize.width = MIN(titleLimitSize.width, titleSize.width);
+ titleSize.height = MIN(titleLimitSize.height, titleSize.height);
+ titleFrame = CGRectMakeWithSize(titleSize);
+ titleTotalSize = CGSizeMake(titleSize.width + UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets), titleSize.height + UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+
+ switch (self.contentVerticalAlignment) {
+ case UIControlContentVerticalAlignmentTop:
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top) : titleFrame;
+
+ break;
+ case UIControlContentVerticalAlignmentCenter:
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, contentEdgeInsets.top + CGFloatGetCenter(contentSize.height, CGRectGetHeight(imageFrame)) + self.imageEdgeInsets.top) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, contentEdgeInsets.top + CGFloatGetCenter(contentSize.height, CGRectGetHeight(titleFrame)) + self.titleEdgeInsets.top) : titleFrame;
+ break;
+ case UIControlContentVerticalAlignmentBottom:
+ imageFrame = isImageViewShowing ? CGRectSetY(imageFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.imageEdgeInsets.bottom - CGRectGetHeight(imageFrame)) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetY(titleFrame, CGRectGetHeight(self.bounds) - contentEdgeInsets.bottom - self.titleEdgeInsets.bottom - CGRectGetHeight(titleFrame)) : titleFrame;
+ break;
+ case UIControlContentVerticalAlignmentFill:
+ if (isImageViewShowing) {
+ imageFrame = CGRectSetY(imageFrame, contentEdgeInsets.top + self.imageEdgeInsets.top);
+ imageFrame = CGRectSetHeight(imageFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.imageEdgeInsets));
+ }
+ if (isTitleLabelShowing) {
+ titleFrame = CGRectSetY(titleFrame, contentEdgeInsets.top + self.titleEdgeInsets.top);
+ titleFrame = CGRectSetHeight(titleFrame, contentSize.height - UIEdgeInsetsGetVerticalValue(self.titleEdgeInsets));
+ }
+ break;
+ }
+
+ if (self.imagePosition == HDLEZOPButtonImagePositionLeft) {
+ switch (self.contentHorizontalAlignment) {
+ case UIControlContentHorizontalAlignmentLeft:
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, contentEdgeInsets.left + imageTotalSize.width + spacingBetweenImageAndTitle + self.titleEdgeInsets.left) : titleFrame;
+ break;
+ case UIControlContentHorizontalAlignmentCenter: {
+ CGFloat contentWidth = imageTotalSize.width + spacingBetweenImageAndTitle + titleTotalSize.width;
+ CGFloat minX = contentEdgeInsets.left + CGFloatGetCenter(contentSize.width, contentWidth);
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, minX + self.imageEdgeInsets.left) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, minX + imageTotalSize.width + spacingBetweenImageAndTitle + self.titleEdgeInsets.left) : titleFrame;
+ }
+ break;
+ case UIControlContentHorizontalAlignmentRight: {
+ if (imageTotalSize.width + spacingBetweenImageAndTitle + titleTotalSize.width > contentSize.width) {
+ // 鍥剧墖鍜屾枃瀛楁�诲瓒呰繃鎸夐挳瀹藉害锛屽垯浼樺厛瀹屾暣鏄剧ず鍥剧墖
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, contentEdgeInsets.left + imageTotalSize.width + spacingBetweenImageAndTitle + self.titleEdgeInsets.left) : titleFrame;
+ } else {
+ // 鍐呭涓嶈秴杩囨寜閽搴︼紝鍒欓潬鍙冲竷灞�鍗冲彲
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.titleEdgeInsets.right - CGRectGetWidth(titleFrame)) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - titleTotalSize.width - spacingBetweenImageAndTitle - imageTotalSize.width + self.imageEdgeInsets.left) : imageFrame;
+ }
+ }
+ break;
+ case UIControlContentHorizontalAlignmentFill: {
+ if (isImageViewShowing && isTitleLabelShowing) {
+ // 鍚屾椂鏄剧ず鍥剧墖鍜� label 鐨勬儏鍐典笅锛屽浘鐗囨寜鏈韩瀹藉害鏄剧ず锛屽墿浣欑┖闂寸暀缁� label
+ imageFrame = CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left);
+ titleFrame = CGRectSetX(titleFrame, contentEdgeInsets.left + imageTotalSize.width + spacingBetweenImageAndTitle + self.titleEdgeInsets.left);
+ titleFrame = CGRectSetWidth(titleFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.titleEdgeInsets.right - CGRectGetMinX(titleFrame));
+ } else if (isImageViewShowing) {
+ imageFrame = CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left);
+ imageFrame = CGRectSetWidth(imageFrame, contentSize.width - UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets));
+ } else {
+ titleFrame = CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left);
+ titleFrame = CGRectSetWidth(titleFrame, contentSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets));
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (self.contentHorizontalAlignment) {
+ case UIControlContentHorizontalAlignmentLeft: {
+ if (imageTotalSize.width + spacingBetweenImageAndTitle + titleTotalSize.width > contentSize.width) {
+ // 鍥剧墖鍜屾枃瀛楁�诲瓒呰繃鎸夐挳瀹藉害锛屽垯浼樺厛瀹屾暣鏄剧ず鍥剧墖
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.imageEdgeInsets.right - CGRectGetWidth(imageFrame)) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - imageTotalSize.width - spacingBetweenImageAndTitle - titleTotalSize.width + self.titleEdgeInsets.left) : titleFrame;
+ } else {
+ // 鍐呭涓嶈秴杩囨寜閽搴︼紝鍒欓潬宸﹀竷灞�鍗冲彲
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, contentEdgeInsets.left + titleTotalSize.width + spacingBetweenImageAndTitle + self.imageEdgeInsets.left) : imageFrame;
+ }
+ }
+ break;
+ case UIControlContentHorizontalAlignmentCenter: {
+ CGFloat contentWidth = imageTotalSize.width + spacingBetweenImageAndTitle + titleTotalSize.width;
+ CGFloat minX = contentEdgeInsets.left + CGFloatGetCenter(contentSize.width, contentWidth);
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, minX + self.titleEdgeInsets.left) : titleFrame;
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, minX + titleTotalSize.width + spacingBetweenImageAndTitle + self.imageEdgeInsets.left) : imageFrame;
+ }
+ break;
+ case UIControlContentHorizontalAlignmentRight:
+ imageFrame = isImageViewShowing ? CGRectSetX(imageFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.imageEdgeInsets.right - CGRectGetWidth(imageFrame)) : imageFrame;
+ titleFrame = isTitleLabelShowing ? CGRectSetX(titleFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - imageTotalSize.width - spacingBetweenImageAndTitle - self.titleEdgeInsets.right - CGRectGetWidth(titleFrame)) : titleFrame;
+ break;
+ case UIControlContentHorizontalAlignmentFill: {
+ if (isImageViewShowing && isTitleLabelShowing) {
+ // 鍥剧墖鎸夎嚜韬ぇ灏忔樉绀猴紝鍓╀綑绌洪棿鐢辨爣棰樺崰婊�
+ imageFrame = CGRectSetX(imageFrame, CGRectGetWidth(self.bounds) - contentEdgeInsets.right - self.imageEdgeInsets.right - CGRectGetWidth(imageFrame));
+ titleFrame = CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left);
+ titleFrame = CGRectSetWidth(titleFrame, CGRectGetMinX(imageFrame) - self.imageEdgeInsets.left - spacingBetweenImageAndTitle - self.titleEdgeInsets.right - CGRectGetMinX(titleFrame));
+
+ } else if (isImageViewShowing) {
+ imageFrame = CGRectSetX(imageFrame, contentEdgeInsets.left + self.imageEdgeInsets.left);
+ imageFrame = CGRectSetWidth(imageFrame, contentSize.width - UIEdgeInsetsGetHorizontalValue(self.imageEdgeInsets));
+ } else {
+ titleFrame = CGRectSetX(titleFrame, contentEdgeInsets.left + self.titleEdgeInsets.left);
+ titleFrame = CGRectSetWidth(titleFrame, contentSize.width - UIEdgeInsetsGetHorizontalValue(self.titleEdgeInsets));
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (isImageViewShowing) {
+ imageFrame = CGRectFlatted(imageFrame);
+ self._hdlop_imageView.frame = imageFrame;
+ }
+ if (isTitleLabelShowing) {
+ titleFrame = CGRectFlatted(titleFrame);
+ self.titleLabel.frame = titleFrame;
+ }
+ }
+}
+
+- (void)setSpacingBetweenImageAndTitle:(CGFloat)spacingBetweenImageAndTitle {
+ _spacingBetweenImageAndTitle = spacingBetweenImageAndTitle;
+
+ [self setNeedsLayout];
+}
+
+- (void)setImagePosition:(HDLEZOPButtonImagePosition)imagePosition {
+ _imagePosition = imagePosition;
+
+ [self setNeedsLayout];
+}
+
+- (void)setHighlightedBackgroundColor:(UIColor *)highlightedBackgroundColor {
+ _highlightedBackgroundColor = highlightedBackgroundColor;
+ if (_highlightedBackgroundColor) {
+ // 鍙寮�鍚簡highlightedBackgroundColor锛屽氨榛樿涓嶉渶瑕乤lpha鐨勯珮浜�
+ self.adjustsButtonWhenHighlighted = NO;
+ }
+}
+
+- (void)setHighlightedBorderColor:(UIColor *)highlightedBorderColor {
+ _highlightedBorderColor = highlightedBorderColor;
+ if (_highlightedBorderColor) {
+ // 鍙寮�鍚簡highlightedBorderColor锛屽氨榛樿涓嶉渶瑕乤lpha鐨勯珮浜�
+ self.adjustsButtonWhenHighlighted = NO;
+ }
+}
+
+- (void)setHighlighted:(BOOL)highlighted {
+ [super setHighlighted:highlighted];
+
+ if (highlighted && !self.originBorderColor) {
+ // 鎵嬫寚鎸夊湪鎸夐挳涓婁細涓嶆柇瑙﹀彂setHighlighted:锛屾墍浠ヨ繖閲屽仛浜嗕繚鎶わ紝璁剧疆杩囦竴娆″氨涓嶇敤鍐嶈缃簡
+ self.originBorderColor = [UIColor colorWithCGColor:self.layer.borderColor];
+ }
+
+ // 娓叉煋鑳屾櫙鑹�
+// if (self.highlightedBackgroundColor || self.highlightedBorderColor) {
+// [self adjustsButtonHighlighted];
+// }
+ // 濡傛灉姝ゆ椂鏄痙isabled锛屽垯disabled鐨勬牱寮忎紭鍏�
+ if (!self.enabled) {
+ return;
+ }
+ // 鑷畾涔塰ighlighted鏍峰紡
+// if (self.adjustsButtonWhenHighlighted) {
+// if (highlighted) {
+// self.alpha = ButtonHighlightedAlpha;
+// } else {
+// self.alpha = 1;
+// }
+// }
+}
+
+- (void)setEnabled:(BOOL)enabled {
+ [super setEnabled:enabled];
+ if (!enabled && self.adjustsButtonWhenDisabled) {
+// self.alpha = ButtonDisabledAlpha;
+ self.alpha = 1;
+ } else {
+ self.alpha = 1;
+ }
+}
+
+//- (void)adjustsButtonHighlighted {
+// if (self.highlightedBackgroundColor) {
+// if (!self.highlightedBackgroundLayer) {
+// self.highlightedBackgroundLayer = [CALayer layer];
+// [self.highlightedBackgroundLayer qmui_removeDefaultAnimations];
+// [self.layer insertSublayer:self.highlightedBackgroundLayer atIndex:0];
+// }
+// self.highlightedBackgroundLayer.frame = self.bounds;
+// self.highlightedBackgroundLayer.cornerRadius = self.layer.cornerRadius;
+// self.highlightedBackgroundLayer.maskedCorners = self.layer.maskedCorners;
+// self.highlightedBackgroundLayer.backgroundColor = self.highlighted ? self.highlightedBackgroundColor.CGColor : UIColorClear.CGColor;
+// }
+//
+// if (self.highlightedBorderColor) {
+// self.layer.borderColor = self.highlighted ? self.highlightedBorderColor.CGColor : self.originBorderColor.CGColor;
+// }
+//}
+
+- (void)setAdjustsTitleTintColorAutomatically:(BOOL)adjustsTitleTintColorAutomatically {
+ _adjustsTitleTintColorAutomatically = adjustsTitleTintColorAutomatically;
+ [self updateTitleColorIfNeeded];
+}
+
+- (void)updateTitleColorIfNeeded {
+ if (self.adjustsTitleTintColorAutomatically && self.currentTitleColor) {
+ [self setTitleColor:self.tintColor forState:UIControlStateNormal];
+ }
+ if (self.adjustsTitleTintColorAutomatically && self.currentAttributedTitle) {
+ NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:self.currentAttributedTitle];
+ [attributedString addAttribute:NSForegroundColorAttributeName value:self.tintColor range:NSMakeRange(0, attributedString.length)];
+ [self setAttributedTitle:attributedString forState:UIControlStateNormal];
+ }
+}
+
+- (void)setAdjustsImageTintColorAutomatically:(BOOL)adjustsImageTintColorAutomatically {
+ BOOL valueDifference = _adjustsImageTintColorAutomatically != adjustsImageTintColorAutomatically;
+ _adjustsImageTintColorAutomatically = adjustsImageTintColorAutomatically;
+
+ if (valueDifference) {
+ [self updateImageRenderingModeIfNeeded];
+ }
+}
+
+- (void)updateImageRenderingModeIfNeeded {
+ if (self.currentImage) {
+ NSArray<NSNumber *> *states = @[@(UIControlStateNormal), @(UIControlStateHighlighted), @(UIControlStateSelected), @(UIControlStateSelected|UIControlStateHighlighted), @(UIControlStateDisabled)];
+
+ for (NSNumber *number in states) {
+ UIImage *image = [self imageForState:number.unsignedIntegerValue];
+ if (!image) {
+ continue;
+ }
+ if (number.unsignedIntegerValue != UIControlStateNormal && image == [self imageForState:UIControlStateNormal]) {
+ continue;
+ }
+
+ if (self.adjustsImageTintColorAutomatically) {
+ // 杩欓噷鐨� setImage: 鎿嶄綔涓嶉渶瑕佷娇鐢� renderingMode 瀵� image 閲嶆柊澶勭悊锛岃�屾槸鏀惧埌閲嶅啓鐨� setImage:forState 閲屽幓鍋氬氨琛屼簡
+ [self setImage:image forState:[number unsignedIntegerValue]];
+ } else {
+ // 濡傛灉涓嶉渶瑕佺敤template鐨勬ā寮忔覆鏌擄紝骞朵笖涔嬪墠鏄娇鐢╰emplate鐨勶紝鍒欐妸renderingMode鏀瑰洖Original
+ [self setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:[number unsignedIntegerValue]];
+ }
+ }
+ }
+}
+
+- (void)setImage:(UIImage *)image forState:(UIControlState)state {
+ if (self.adjustsImageTintColorAutomatically) {
+ image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
+ }
+
+ [super setImage:image forState:state];
+}
+
+- (void)tintColorDidChange {
+ [super tintColorDidChange];
+
+ [self updateTitleColorIfNeeded];
+
+ if (self.adjustsImageTintColorAutomatically) {
+ [self updateImageRenderingModeIfNeeded];
+ }
+}
+
+- (void)setTintColorAdjustsTitleAndImage:(UIColor *)tintColorAdjustsTitleAndImage {
+ _tintColorAdjustsTitleAndImage = tintColorAdjustsTitleAndImage;
+ if (tintColorAdjustsTitleAndImage) {
+ self.tintColor = tintColorAdjustsTitleAndImage;
+ self.adjustsTitleTintColorAutomatically = YES;
+ self.adjustsImageTintColorAutomatically = YES;
+ }
+}
+
+- (void)setCornerRadius:(CGFloat)cornerRadius {
+ _cornerRadius = cornerRadius;
+ if (cornerRadius != HDLOPButtonCornerRadiusAdjustsBounds) {
+ self.layer.cornerRadius = cornerRadius;
+ }
+ [self setNeedsLayout];
+}
+
+
+@end
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDeviceMsgListViewController.m b/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDeviceMsgListViewController.m
index da4e342..baac279 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDeviceMsgListViewController.m
+++ b/EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDeviceMsgListViewController.m
@@ -28,7 +28,8 @@
@property (nonatomic, assign) NSInteger pageSize;//鍒嗛〉瀹归噺
-@property (nonatomic, strong) NSMutableArray <MWPhoto *>*photos; // 棰勮鍥剧墖淇℃伅
+@property (nonatomic, strong) NSMutableArray <MWPhoto *>*photos; // 棰勮鍥剧墖淇℃伅
+@property (nonatomic, strong) NSString *currentPreviewPhoto; // 褰撳墠棰勮鐨勫浘鐗�
@end
@@ -114,6 +115,31 @@
weakSelf.msgListV.msgList=weakSelf.msgList;
weakSelf.currentPageNo+=1;
}else{
+#warning mock
+ if (weakSelf.msgList.count == 0) {
+ HDLEZDeviceMsgInfoModel *model = [[HDLEZDeviceMsgInfoModel alloc] init];
+ model.title = @"mock title 浣犲ソ浣犲ソ鎴戞槸瓒呴暱鐨勬祴璇曟爣棰橈紝浣犳潵鐪嬩笅鏄惁瓒呭嚭闀垮害锛屼綘濂戒綘濂芥垜鏄秴闀跨殑娴嬭瘯鏍囬锛屼綘鏉ョ湅涓嬫槸鍚﹁秴鍑洪暱搴�";
+ model.createTime = @"2023.06.15";
+ model.content = @"mock content";
+ model.imageUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
+ [weakSelf.msgList addObject:model];
+
+ HDLEZDeviceMsgInfoModel *model1 = [[HDLEZDeviceMsgInfoModel alloc] init];
+ model1.title = @"mock title1锛屼綘濂戒綘濂�";
+ model1.createTime = @"2023.06.15";
+ model1.content = @"mock content1";
+ model1.imageUrl = @"http://b.hiphotos.baidu.com/image/pic/item/e824b899a9014c08878b2c4c0e7b02087af4f4a3.jpg";
+ [weakSelf.msgList addObject:model1];
+
+ HDLEZDeviceMsgInfoModel *model2 = [[HDLEZDeviceMsgInfoModel alloc] init];
+ model2.title = @"mock title2";
+ model2.createTime = @"2023.06.15";
+ model2.content = @"mock content2";
+ model2.imageUrl = @"https://fastly.picsum.photos/id/452/1000/3000.jpg?hmac=g6GQYs1wmiPeoKOdwI3ot1y4MInIj_dnPk_jCYbVYfk";
+ [weakSelf.msgList addObject:model2];
+
+ }
+ weakSelf.msgListV.msgList=weakSelf.msgList;
[weakSelf.footer endRefreshingWithNoMoreData];
}
@@ -143,8 +169,11 @@
- (void)didClickDownLoad:(MWPhotoBrowser *)photoBrowser {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
- NSURL *url = [NSURL URLWithString:@"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"];
+ if (!self.currentPreviewPhoto || self.currentPreviewPhoto.length == 0) {
+ [UIView dd_showMessage:NSLocalizedString(@"device_save_gallery_failure", @"涓嬭浇澶辫触")];
+ return;
+ }
+ NSURL *url = [NSURL URLWithString:self.currentPreviewPhoto];
SDWebImageManager *manager = [SDWebImageManager sharedManager];
UIImage *img;
if ([manager diskImageExistsForURL:url]) {
@@ -179,6 +208,7 @@
#pragma mark PrivateMethod
- (void)previewPictureWithUrl:(NSString *)picUrl {
+ self.currentPreviewPhoto = picUrl;
self.photos = [NSMutableArray array];
[self.photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:picUrl]]];
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDeviceMsgInfoModel.h b/EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDeviceMsgInfoModel.h
index a8faa31..8c7e455 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDeviceMsgInfoModel.h
+++ b/EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDeviceMsgInfoModel.h
@@ -14,6 +14,7 @@
@property (nonatomic, copy)NSString *content;//鍐呭
@property (nonatomic, copy)NSString *level;//娑堟伅绛夌骇
@property (nonatomic, copy)NSString *createTime;//鍒涘缓鏃堕棿
+@property (nonatomic, copy)NSString *imageUrl;//鎴睆鍥剧墖閾炬帴
@end
NS_ASSUME_NONNULL_END
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m
index 5fc3518..f1f1cdc 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m
@@ -30,6 +30,9 @@
self.delegate = self;
self.dataSource = self;
cellHeight=80;
+ self.rowHeight = UITableViewAutomaticDimension;
+ self.estimatedRowHeight = 80;
+ [self registerClass:[HDLEZVideoDoorMsgCell class] forCellReuseIdentifier:@"HDLEZVideoDoorMsgCell"];
[self setSeparatorInset:UIEdgeInsetsZero];
// [self setLayoutMargins:UIEdgeInsetsZero];
}
@@ -46,12 +49,12 @@
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return cellHeight;
+ return UITableViewAutomaticDimension;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
HDLEZLog(@"鍒濆鍖朿ell");
- HDLEZVideoDoorMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZVideoDoorMsgCell"];
+ HDLEZVideoDoorMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZVideoDoorMsgCell" forIndexPath:indexPath];
if(cell == nil){
cell=[[HDLEZVideoDoorMsgCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HDLEZVideoDoorMsgCell"];
}
@@ -71,10 +74,8 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.msgList.count <= indexPath.row) return;
HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
-#warning mock
- NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
if (self.previewPic) {
- self.previewPic(tempPicUrl);
+ self.previewPic(messageModel.imageUrl);
}
}
@@ -88,9 +89,16 @@
if (self.msgList.count <= indexPath.row) return;
HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
+
#warning mock
- NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
- [cell configMessageInfoWithTitle:messageModel.title deviceStatus:@"鏈帴鍚�" messageTime:messageModel.createTime messageImage:tempPicUrl];
+ NSString *stataus = @"";
+ if (indexPath.row == 0) {
+ stataus = @"鏈帴";
+ } else if (indexPath.row == 1) {
+ stataus = @"宸叉帴";
+ }
+ [cell configMessageInfoWithTitle:messageModel.title deviceStatus:stataus messageTime:messageModel.createTime messageImage:indexPath.row != 0 ? messageModel.imageUrl : @""];
+ [cell showSpearator:(self.msgList.count != indexPath.row + 1)];
}
/*璁剧疆娑堟伅鍒楄〃鍊�
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.h b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.h
index 8a08c4f..37ab8c8 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.h
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.h
@@ -19,6 +19,10 @@
/// - messageUrl: 娑堟伅鍥剧墖
- (void)configMessageInfoWithTitle:(NSString *)title deviceStatus:(NSString *)deviceStatus messageTime:(NSString *)time messageImage:(NSString *)messageUrl;
+/// 鏄惁灞曠ず鍒嗗壊绾�
+/// - Parameter isShow: 鏄惁灞曠ず
+- (void)showSpearator:(BOOL)isShow;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m
index 8c7c701..35f4305 100644
--- a/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m
+++ b/EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m
@@ -13,6 +13,7 @@
@property (strong, nonatomic) UILabel *statusLabel;
@property (strong, nonatomic) UILabel *timeLabel;
@property (strong, nonatomic) UIImageView *messageImageView;
+@property (strong, nonatomic) UIView *separatorLine;
@end
@@ -31,33 +32,40 @@
[self.contentView addSubview:self.statusLabel];
[self.contentView addSubview:self.timeLabel];
[self.contentView addSubview:self.messageImageView];
+ [self.contentView addSubview:self.separatorLine];
[self.messageTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.contentView.mas_top).offset(16.);
+ make.top.mas_equalTo(self.contentView.mas_top).offset(24.);
make.left.mas_equalTo(self.contentView.mas_left).offset(16.);
- make.height.mas_equalTo(22);
}];
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.messageTitle.mas_bottom).offset(10.);
- make.left.mas_equalTo(self.messageTitle.mas_left);
- make.width.mas_equalTo(50);
- make.height.mas_equalTo(30);
+ make.top.mas_equalTo(self.messageTitle.mas_top).offset(0.);
+ make.left.mas_equalTo(self.messageTitle.mas_right).offset(8.);
+ make.right.mas_lessThanOrEqualTo(self.messageImageView.mas_left).offset(-8.);
+ make.width.mas_equalTo(40);
+ make.height.mas_equalTo(20);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+ make.top.mas_equalTo(self.messageTitle.mas_bottom).offset(4.);
make.left.mas_equalTo(self.messageTitle.mas_left);
- make.bottom.mas_equalTo(self.messageImageView.mas_bottom);
- make.right.mas_equalTo(self.messageTitle.mas_right);
- make.height.mas_equalTo(22);
+ make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-12.);
+ make.height.mas_equalTo(17);
}];
[self.messageImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.contentView.mas_top).offset(16.);
- make.left.mas_equalTo(self.messageTitle.mas_right).offset(10.);
- make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-16.);
make.right.mas_equalTo(self.contentView.mas_right).offset(-16.);
- make.width.mas_equalTo(self.messageImageView.mas_height).multipliedBy(5/3.);
+ make.centerY.mas_equalTo(self.contentView.mas_centerY);
+ make.width.mas_equalTo(72.);
+ make.height.mas_equalTo(41.);
+ }];
+
+ [self.separatorLine mas_makeConstraints:^(MASConstraintMaker *make) {
+ make.left.mas_equalTo(self.messageTitle.mas_left);
+ make.bottom.mas_equalTo(self.contentView.mas_bottom);
+ make.right.mas_equalTo(self.messageImageView.mas_right);
+ make.height.mas_equalTo(0.5);
}];
}
@@ -66,16 +74,36 @@
if (title && title.length > 0) {
self.messageTitle.text = title;
}
+
if (deviceStatus && deviceStatus.length > 0) {
self.statusLabel.text = deviceStatus;
+ [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) {
+ make.width.mas_equalTo(40.);
+ }];
+ self.statusLabel.backgroundColor = [deviceStatus isEqualToString:@"宸叉帴"] ? HDLEZHEXCOLOR(0x00C22D, 1.) : HDLEZHEXCOLOR(0xFF4747, 1.);
+ } else {
+ [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) {
+ make.width.mas_equalTo(0.);
+ }];
}
+
if (time && time.length > 0) {
self.timeLabel.text = time;
}
if (messageUrl && messageUrl.length > 0) {
- NSLog(@"#######cell image url:%@", messageUrl);
[self.messageImageView sd_setImageWithURL:[NSURL URLWithString:messageUrl] placeholderImageScale:[UIImage imageNamed:@""]];
+ [self.messageImageView mas_updateConstraints:^(MASConstraintMaker *make) {
+ make.width.mas_equalTo(72.);
+ }];
+ } else {
+ [self.messageImageView mas_updateConstraints:^(MASConstraintMaker *make) {
+ make.width.mas_equalTo(0.);
+ }];
}
+}
+
+- (void)showSpearator:(BOOL)isShow {
+ self.separatorLine.hidden = !isShow;
}
#pragma mark - Getter
@@ -84,6 +112,7 @@
_messageTitle=[[UILabel alloc] init];
_messageTitle.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14);
_messageTitle.textColor=HDLEZ_COLOR_TITLE_BLACK;
+ _messageTitle.numberOfLines = 2;
}
return _messageTitle;
}
@@ -92,9 +121,9 @@
if (!_statusLabel) {
_statusLabel=[[UILabel alloc] init];
_statusLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
- _statusLabel.textColor = HDLEZ_COLOR_TEXT_LIGHT_GRAY;
- _statusLabel.layer.cornerRadius = 5;
- _statusLabel.layer.borderColor = HDLEZ_COLOR_TEXT_GRAY.CGColor;
+ _statusLabel.textColor = HDLEZ_COLOR_TEXT_WHITE;
+ _statusLabel.textAlignment = NSTextAlignmentCenter;
+ _statusLabel.layer.cornerRadius = 4;
_statusLabel.clipsToBounds = YES;
}
return _statusLabel;
@@ -104,8 +133,7 @@
if (!_timeLabel) {
_timeLabel=[[UILabel alloc] init];
_timeLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
- _timeLabel.textColor=HDLEZ_COLOR_TEXT_GRAY;
- _timeLabel.textAlignment = NSTextAlignmentRight;
+ _timeLabel.textColor=HDLEZ_COLOR_TEXT_LIGHT_GRAY;
}
return _timeLabel;
}
@@ -113,10 +141,20 @@
- (UIImageView *)messageImageView {
if (!_messageImageView) {
_messageImageView = [[UIImageView alloc] init];
+ _messageImageView.contentMode = UIViewContentModeScaleAspectFill;
_messageImageView.backgroundColor = HDLEZ_COLOR_TEXT_LIGHT_GRAY;
-
+ _messageImageView.layer.cornerRadius = 4;
+ _messageImageView.clipsToBounds = YES;
}
return _messageImageView;
}
+- (UIView *)separatorLine {
+ if (!_separatorLine) {
+ _separatorLine = [[UIView alloc] init];
+ _separatorLine.backgroundColor = HDLEZ_COLOR_BACKGROUND_LINE;
+ }
+ return _separatorLine;
+}
+
@end
diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
index d790261..35c1a4c 100644
--- a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
+++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
@@ -24,6 +24,7 @@
#import "MBProgressHUD.h"
#import <EZOpenSDKFramework/EZPMPlayPrivateTokenInfo.h>
#import "HDLEZAlertInputView.h"
+#import "HDLEZOPButton.h"
#define MinimumZoomScale 1.0
#define MaximumZoomScale 4.0
@@ -101,9 +102,9 @@
// 鍛煎彨瑙嗗浘鐩稿叧鎺т欢
@property (weak, nonatomic) IBOutlet UIView *videoCallOutView; // 鍛煎彨寮规
@property (weak, nonatomic) IBOutlet UILabel *callOutAlertLabel; // 鎻愮ず璇█
-@property (weak, nonatomic) IBOutlet UIButton *hangUpButton; // 鎸傛柇鎸夐挳
-@property (weak, nonatomic) IBOutlet UIButton *ignoreButton; // 蹇界暐鎸夐挳
-@property (weak, nonatomic) IBOutlet UIButton *answerButton; // 鎺ュ惉鎸夐挳
+@property (weak, nonatomic) IBOutlet HDLEZOPButton *hangUpButton; // 鎸傛柇鎸夐挳
+@property (weak, nonatomic) IBOutlet HDLEZOPButton *ignoreButton; // 蹇界暐鎸夐挳
+@property (weak, nonatomic) IBOutlet HDLEZOPButton *answerButton; // 鎺ュ惉鎸夐挳
@end
@@ -342,6 +343,7 @@
self.localRecordButton.enabled = NO;
self.streamPlayBtn.hidden = YES;
self.isShowAlert = YES;
+ NSLog(@"#####鍒濆鍖栨柟娉曞睍绀�");
if (_url)
{
@@ -476,11 +478,14 @@
self.callOutAlertLabel.text = HDLEZLocallizedString(@"device_callout_alert_message");
[self.hangUpButton setTitle:HDLEZLocallizedString(@"device_callout_hang_up") forState:UIControlStateNormal];
+ self.hangUpButton.imagePosition = HDLEZOPButtonImagePositionTop;
+ self.hangUpButton.spacingBetweenImageAndTitle = 12.;
[self.ignoreButton setTitle:HDLEZLocallizedString(@"device_callout_ignore") forState:UIControlStateNormal];
+ self.ignoreButton.imagePosition = HDLEZOPButtonImagePositionTop;
+ self.ignoreButton.spacingBetweenImageAndTitle = 12.;
[self.answerButton setTitle:HDLEZLocallizedString(@"device_callout_answer") forState:UIControlStateNormal];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- self.isShowAlert = NO;
- });
+ self.answerButton.imagePosition = HDLEZOPButtonImagePositionTop;
+ self.answerButton.spacingBetweenImageAndTitle = 12.;
}
/*寮�閿�
@@ -889,6 +894,7 @@
self.largeTitleLabel.hidden = NO;
self.largeBackButton.hidden = YES;
self.bottomView.hidden = YES;
+ self.videoCallOutView.hidden = YES;
[self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO];
@@ -927,7 +933,6 @@
- (IBAction)largeBack:(id)sender
{
- NSLog(@"######鏀跺洖妯睆锛�");
_landscape = NO;
if (self.isVideoDoorLock) {
self.navigationController.navigationBarHidden = NO;
@@ -936,6 +941,7 @@
self.bottomView.hidden = NO;
self.largeTitleLabel.hidden = YES;
self.localRecrodContraint.constant = 10;
+ self.videoCallOutView.hidden = !self.isShowAlert;
[self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO];
@@ -1351,14 +1357,18 @@
- (IBAction)clickCalloutHangupAction:(id)sender {
[UIView dd_showMessage:@"鎸傛柇寮�鍙戜腑..."];
+ self.isShowAlert = NO;
}
- (IBAction)clickCalloutIgnoreAction:(id)sender {
[UIView dd_showMessage:@"蹇界暐寮�鍙戜腑..."];
+ self.isShowAlert = NO;
}
- (IBAction)clickCalloutAnswerAction:(id)sender {
[UIView dd_showMessage:@"鎺ュ惉寮�鍙戜腑..."];
+ self.isShowAlert = NO;
+ [self talkButtonClicked:self.talkButton];
}
@@ -1366,12 +1376,15 @@
/// 灞曠ず鍛煎彨寮规
- (void)showCallOutAlertView {
self.videoCallOutView.hidden = NO;
+ [UIView dd_showMessage:@"灞曠ず鍛煎彨寮规"];
+ NSLog(@"灞曠ず鍛煎彨寮规");
}
/// 闅愯棌鍛煎彨寮规
- (void)hiddenCallOutAlertView {
self.videoCallOutView.hidden = YES;
-
+ [UIView dd_showMessage:@"闅愯棌鍛煎彨寮规"];
+ NSLog(@"闅愯棌鍛煎彨寮规");
}
#pragma mark - Private Methods
@@ -1633,8 +1646,10 @@
- (void)setIsShowAlert:(BOOL)isShowAlert {
_isShowAlert = isShowAlert;
if (isShowAlert) {
+ NSLog(@"#####set鏂规硶灞曠ず");
[self showCallOutAlertView];
} else {
+ NSLog(@"#####set鏂规硶闅愯棌");
[self hiddenCallOutAlertView];
}
}
diff --git a/EZSDK/EZSDK/EZ/Venders/MWPhotoBrowser/MWPhotoBrowser.m b/EZSDK/EZSDK/EZ/Venders/MWPhotoBrowser/MWPhotoBrowser.m
index 0943765..0d62a8e 100644
--- a/EZSDK/EZSDK/EZ/Venders/MWPhotoBrowser/MWPhotoBrowser.m
+++ b/EZSDK/EZSDK/EZ/Venders/MWPhotoBrowser/MWPhotoBrowser.m
@@ -1654,7 +1654,11 @@
if (!_downloadBtn) {
_downloadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_downloadBtn setTitle:HDLEZLocallizedString(@"hdl_ez_download") forState:UIControlStateNormal];
- [_downloadBtn setTitleColor:HDLEZ_COLOR_TEXT_LIGHT_GRAY forState:UIControlStateNormal];
+ _downloadBtn.titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16);
+ [_downloadBtn setTitleColor:HDLEZ_COLOR_TEXT_WHITE forState:UIControlStateNormal];
+ _downloadBtn.backgroundColor = HDLEZ_COLOR_BACKGROUND_BUTTON;
+ _downloadBtn.layer.cornerRadius = 22.;
+ _downloadBtn.clipsToBounds = YES;
}
return _downloadBtn;
}
@@ -1662,10 +1666,10 @@
- (void)showDownloadBtn {
[self.view addSubview:self.downloadBtn];
[self.downloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.view.mas_left).offset(32.);
- make.bottom.mas_equalTo(self.view.mas_bottom).offset(-HDLEZ_APP_TAB_BOTTOM_HEIGHT - 16);
- make.width.mas_equalTo((HDLEZ_APP_SCREEN_WIDTH - 96) / 2.);
- make.height.mas_equalTo(50.);
+ make.centerX.mas_equalTo(self.view.mas_centerX);
+ make.bottom.mas_equalTo(self.view.mas_bottom).offset(-37);
+ make.width.mas_equalTo(220.);
+ make.height.mas_equalTo(44.);
}];
[self.downloadBtn addTarget:self action:@selector(downLoadAction) forControlEvents:UIControlEventTouchUpInside];
}
--
Gitblit v1.8.0