Skip to content

Commit cf61bab

Browse files
author
szl
committed
2019年10月23日STHUD更新
1 parent b0139de commit cf61bab

File tree

10 files changed

+115
-24
lines changed

10 files changed

+115
-24
lines changed

CHANGELOG.md

+18-10
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@
66

77
| 名称 | 功能描述 | 状态 |
88
| --- | --- | --- |
9-
| STAlertView | UIAlertController在alert风格下的封装 | 新增 |
10-
| STGradientButton | 支持渐变色功能的按钮 | 新增 |
11-
| STGradientView | IB支持渐变色、阴影功能的视图 | 新增 |
12-
| STHUD | 弱提示框 | 新增 |
13-
| STMoveButton | 可移动按钮 | 新增 |
14-
| STPhoneTextField | 指定文本显示样式与文本正则的手机号输入框 | 新增 |
15-
| STProgressView | 支持渐变色功能的进度框 | 新增 |
16-
| STSegmentedControl | 根据内容偏移的分段选择器 | 新增 |
9+
| [STAlertView](#STAlertView) | UIAlertController在alert风格下的封装 | 新增 |
10+
| [STGradientButton](#STGradientButton) | 支持渐变色功能的按钮 | 新增 |
11+
| [STGradientView](#STGradientView) | IB支持渐变色、阴影功能的视图 | 新增 |
12+
| [STHUD](#STHUD) | 弱提示框 | 新增 |
13+
| [STMoveButton](#STMoveButton) | 可移动按钮 | 新增 |
14+
| [STPhoneTextField](#STPhoneTextField) | 指定文本显示样式与文本正则的手机号输入框 | 新增 |
15+
| [STProgressView](#STProgressView) | 支持渐变色功能的进度框 | 新增 |
16+
| [STSegmentedControl](#STSegmentedControl) | 根据内容偏移的分段选择器 | 新增 |
1717

18-
## 1.2(未发布)
1918

19+
## 1.2
20+
21+
| 名称 | 功能描述 | 状态 |
22+
| --- | --- | --- |
23+
| [STTimerButton](#STTimerButton) | 支持计时与倒计时的按钮 | 新增 |
24+
| [STAreaPickerView](#STAreaPickerView) | 省市区选择器 | 新增 |
25+
| [STDatePickerView](#STDatePickerView) | 年月日选择器 | 新增 |
26+
27+
## 1.3(未发布)
2028
| 名称 | 功能描述 | 状态 |
2129
| --- | --- | --- |
22-
| STTimerButton | 支持计时与倒计时的按钮 | 新增 |
30+
| [STHUD](#STHUD) | 支持图片与文本提示 | 更新 |

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ Changelog
5656
| [STAreaPickerView](#STAreaPickerView) | 省市区选择器 | 新增 |
5757
| [STDatePickerView](#STDatePickerView) | 年月日选择器 | 新增 |
5858

59+
## 1.3(未发布)
60+
| 名称 | 功能描述 | 状态 |
61+
| --- | --- | --- |
62+
| [STHUD](#STHUD) | 支持图片与文本提示 | 更新 |
63+
5964
## STAlertView
6065

6166
### Installing

STKitSwift/STHUD.swift

+38
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public class STHUD: UIView{
3838
return noticeView
3939
}
4040

41+
@discardableResult
42+
public class func show(_ title:String, image:UIImage?, completion:((Bool) -> Void)? = nil) -> STHUD{
43+
let noticeView = STHUD.init(frame: UIScreen.main.bounds)
44+
noticeView.setupImageUI()
45+
noticeView.labelTitle.text = title
46+
noticeView.imageView.image = image
47+
noticeView.show()
48+
noticeView.completion = completion
49+
return noticeView
50+
}
51+
4152
// MARK: 2.private methods
4253
private func show() {
4354
let window = UIApplication.shared.keyWindow!
@@ -75,6 +86,26 @@ public class STHUD: UIView{
7586
maker.bottom.equalTo(-14)
7687
}
7788
}
89+
90+
private func setupImageUI(){
91+
contentView.snp.makeConstraints { (maker) in
92+
maker.left.greaterThanOrEqualTo(50)
93+
maker.right.lessThanOrEqualTo(-50)
94+
maker.center.equalToSuperview()
95+
}
96+
97+
imageView.snp.makeConstraints { (maker) in
98+
maker.centerX.equalToSuperview()
99+
maker.top.equalTo(16)
100+
}
101+
102+
labelTitle.snp.makeConstraints { (maker) in
103+
maker.left.equalTo(28)
104+
maker.right.equalTo(-28)
105+
maker.top.equalTo(imageView.snp.bottom).offset(14)
106+
maker.bottom.equalTo(-14)
107+
}
108+
}
78109
// MARK: 4.interface
79110
var completion: ((Bool) -> Void)? = nil
80111
// MARK: 5.getter
@@ -96,4 +127,11 @@ public class STHUD: UIView{
96127
addSubview(contentView)
97128
return contentView
98129
}()
130+
131+
private lazy var imageView: UIImageView = {
132+
let imageView = UIImageView()
133+
imageView.contentMode = UIView.ContentMode.scaleAspectFit
134+
contentView.addSubview(imageView)
135+
return imageView
136+
}()
99137
}

STKitSwiftDemo/Podfile.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
PODS:
22
- SnapKit (5.0.0)
3-
- STKitSwift (1.1):
3+
- STKitSwift (1.2):
44
- SnapKit
5-
- STKitSwift/STKit (= 1.1)
6-
- STKitSwift/STKit (1.1):
5+
- STKitSwift/STKit (= 1.2)
6+
- STKitSwift/STKit (1.2):
77
- SnapKit
88

99
DEPENDENCIES:
1010
- SnapKit (~> 5.0.0)
1111
- STKitSwift (from `../`)
1212

1313
SPEC REPOS:
14-
https://github.com/cocoapods/specs.git:
14+
https://github.com/CocoaPods/Specs.git:
1515
- SnapKit
1616

1717
EXTERNAL SOURCES:
@@ -20,8 +20,8 @@ EXTERNAL SOURCES:
2020

2121
SPEC CHECKSUMS:
2222
SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf
23-
STKitSwift: e4a73aa26df6d7a762c907192daf3e7840aec356
23+
STKitSwift: 395ba95b0b49a0605ce3251243eff4d53c58d74e
2424

2525
PODFILE CHECKSUM: b5ed0d54d1e94a22b025305f0a758b0305d262ac
2626

27-
COCOAPODS: 1.6.1
27+
COCOAPODS: 1.8.3

STKitSwiftDemo/STKitSwiftDemo.xcodeproj/project.pbxproj

+4-7
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,12 @@
210210
buildActionMask = 2147483647;
211211
files = (
212212
);
213-
inputPaths = (
214-
"${PODS_ROOT}/Target Support Files/Pods-STKitSwiftDemo/Pods-STKitSwiftDemo-frameworks.sh",
215-
"${BUILT_PRODUCTS_DIR}/STKitSwift/STKitSwift.framework",
216-
"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework",
213+
inputFileListPaths = (
214+
"${PODS_ROOT}/Target Support Files/Pods-STKitSwiftDemo/Pods-STKitSwiftDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
217215
);
218216
name = "[CP] Embed Pods Frameworks";
219-
outputPaths = (
220-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/STKitSwift.framework",
221-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework",
217+
outputFileListPaths = (
218+
"${PODS_ROOT}/Target Support Files/Pods-STKitSwiftDemo/Pods-STKitSwiftDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
222219
);
223220
runOnlyForDeploymentPostprocessing = 0;
224221
shellPath = /bin/sh;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "icon_ok@2x.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"filename" : "icon_ok@3x.png",
15+
"scale" : "3x"
16+
}
17+
],
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
21+
}
22+
}
Loading
Loading

STKitSwiftDemo/STKitSwiftDemo/Base.lproj/Main.storyboard

+16
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@
5555
<action selector="actionShow:" destination="3Zu-ep-hZS" eventType="touchUpInside" id="Jmu-w2-Sj0"/>
5656
</connections>
5757
</button>
58+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="d2j-DY-jbB">
59+
<rect key="frame" x="107" y="458" width="200" height="50"/>
60+
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
61+
<constraints>
62+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="EWt-uo-e0T"/>
63+
<constraint firstAttribute="height" constant="50" id="Wtw-uj-GhQ"/>
64+
</constraints>
65+
<state key="normal" title="Image Content">
66+
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
67+
</state>
68+
<connections>
69+
<action selector="actionImage:" destination="3Zu-ep-hZS" eventType="touchUpInside" id="27A-0n-hDf"/>
70+
</connections>
71+
</button>
5872
</subviews>
5973
<color key="backgroundColor" red="0.8770066352739726" green="0.97549229452054798" blue="0.98584653253424659" alpha="1" colorSpace="calibratedRGB"/>
6074
<constraints>
@@ -63,6 +77,8 @@
6377
<constraint firstItem="VAU-BV-fBe" firstAttribute="leading" secondItem="Nfq-0m-Yhb" secondAttribute="leading" constant="50" id="GxL-AQ-n9E"/>
6478
<constraint firstItem="e56-tW-boD" firstAttribute="top" secondItem="VAU-BV-fBe" secondAttribute="bottom" constant="20" id="MJw-bM-eeb"/>
6579
<constraint firstItem="e56-tW-boD" firstAttribute="centerX" secondItem="wED-MK-cxm" secondAttribute="centerX" id="RfG-0l-kPL"/>
80+
<constraint firstItem="d2j-DY-jbB" firstAttribute="top" secondItem="9zZ-iZ-YJy" secondAttribute="bottom" constant="20" id="Xzq-tQ-N29"/>
81+
<constraint firstItem="d2j-DY-jbB" firstAttribute="centerX" secondItem="wED-MK-cxm" secondAttribute="centerX" id="cbs-2x-Q0Q"/>
6682
<constraint firstItem="VAU-BV-fBe" firstAttribute="top" secondItem="Nfq-0m-Yhb" secondAttribute="top" constant="10" id="dGy-CQ-WZ6"/>
6783
<constraint firstItem="9zZ-iZ-YJy" firstAttribute="top" secondItem="e56-tW-boD" secondAttribute="bottom" constant="20" id="l8u-ln-oYe"/>
6884
</constraints>

STKitSwiftDemo/STKitSwiftDemo/STHUDController.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@ class STHUDController: UIViewController {
2727
@IBOutlet weak var textView: UITextView!
2828
// MARK: 5.getter
2929

30-
30+
@IBAction func actionImage(_ sender: UIButton) {
31+
STHUD.show(textView.text, image: UIImage.init(named:"icon_ok" )) { (flag) in
32+
33+
}
34+
}
35+
3136
}

0 commit comments

Comments
 (0)