Skip to content

Commit

Permalink
增加custommode和快捷调用方式
Browse files Browse the repository at this point in the history
  • Loading branch information
liyb93 committed Jul 12, 2023
1 parent a51ad41 commit 4287b8d
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 71 deletions.
21 changes: 21 additions & 0 deletions Example/Assets.xcassets/success.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "success.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 26 additions & 14 deletions Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -707,11 +707,11 @@
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="LBProgressHUD" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="576" height="230"/>
<rect key="frame" x="0.0" y="0.0" width="576" height="264"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Rom-SE-Y4X">
<rect key="frame" x="250" y="147" width="77" height="32"/>
<rect key="frame" x="250" y="181" width="77" height="32"/>
<buttonCell key="cell" type="push" title="default" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6cH-yM-aBa">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -721,7 +721,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bl2-c4-Jac">
<rect key="frame" x="244" y="107" width="88" height="32"/>
<rect key="frame" x="244" y="141" width="88" height="32"/>
<buttonCell key="cell" type="push" title="indicator" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="gWI-2D-SFW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -731,7 +731,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eSH-gs-KsV">
<rect key="frame" x="259" y="67" width="58" height="32"/>
<rect key="frame" x="259" y="101" width="58" height="32"/>
<buttonCell key="cell" type="push" title="text" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xeG-mO-aQE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -741,15 +741,15 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="atM-4n-Y8L">
<rect key="frame" x="-2" y="194" width="580" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="三种样式" id="Ded-tz-vW5">
<rect key="frame" x="-2" y="228" width="580" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="四种样式" id="Ded-tz-vW5">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DHL-TO-21f">
<rect key="frame" x="23" y="17" width="120" height="32"/>
<rect key="frame" x="23" y="21" width="120" height="32"/>
<buttonCell key="cell" type="push" title="textColor" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="l36-dH-8ab">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -759,7 +759,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IWd-6J-cL5">
<rect key="frame" x="159" y="17" width="120" height="32"/>
<rect key="frame" x="159" y="21" width="120" height="32"/>
<buttonCell key="cell" type="push" title="textFont" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="anC-Bn-aDH">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -769,7 +769,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AAl-Gg-zf7">
<rect key="frame" x="297" y="17" width="120" height="32"/>
<rect key="frame" x="297" y="21" width="120" height="32"/>
<buttonCell key="cell" type="push" title="background" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="SwV-dY-kBE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -779,7 +779,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cxu-w1-Y1y">
<rect key="frame" x="433" y="17" width="120" height="32"/>
<rect key="frame" x="433" y="21" width="120" height="32"/>
<buttonCell key="cell" type="push" title="indicatorColor" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="o81-xj-AQK">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -788,6 +788,16 @@
<action selector="indicatorColorClickHandler:" target="XfG-lQ-9wD" id="84q-n8-1Yh"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="E7T-JR-83X">
<rect key="frame" x="249" y="61" width="79" height="32"/>
<buttonCell key="cell" type="push" title="custom" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="MP6-0g-hsC">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="customClickHandler:" target="XfG-lQ-9wD" id="PwC-Fv-tHb"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="AAl-Gg-zf7" firstAttribute="width" secondItem="DHL-TO-21f" secondAttribute="width" id="1Zs-mU-E8I"/>
Expand All @@ -797,8 +807,8 @@
<constraint firstItem="AAl-Gg-zf7" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="IWd-6J-cL5" secondAttribute="trailing" constant="12" symbolic="YES" id="HG6-Mh-QpZ"/>
<constraint firstItem="cxu-w1-Y1y" firstAttribute="width" secondItem="DHL-TO-21f" secondAttribute="width" id="IZw-LM-oTv"/>
<constraint firstItem="IWd-6J-cL5" firstAttribute="leading" secondItem="DHL-TO-21f" secondAttribute="trailing" constant="30" id="InL-R5-KTV"/>
<constraint firstItem="AAl-Gg-zf7" firstAttribute="top" secondItem="E7T-JR-83X" secondAttribute="bottom" constant="20" id="NTz-BD-dIi"/>
<constraint firstItem="atM-4n-Y8L" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="20" id="Nmh-bZ-hUH"/>
<constraint firstItem="AAl-Gg-zf7" firstAttribute="top" secondItem="eSH-gs-KsV" secondAttribute="bottom" constant="30" id="RnO-Ry-aHI"/>
<constraint firstItem="cxu-w1-Y1y" firstAttribute="leading" secondItem="AAl-Gg-zf7" secondAttribute="trailing" constant="30" id="U8E-Bn-Hue"/>
<constraint firstItem="DHL-TO-21f" firstAttribute="top" secondItem="IWd-6J-cL5" secondAttribute="top" id="Vh6-9r-xBb"/>
<constraint firstAttribute="trailing" secondItem="cxu-w1-Y1y" secondAttribute="trailing" constant="30" id="ZRg-Qw-bQ7"/>
Expand All @@ -808,15 +818,17 @@
<constraint firstItem="Rom-SE-Y4X" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="g73-pE-axO"/>
<constraint firstAttribute="trailing" secondItem="atM-4n-Y8L" secondAttribute="trailing" id="gJF-dW-vza"/>
<constraint firstItem="Bl2-c4-Jac" firstAttribute="top" secondItem="Rom-SE-Y4X" secondAttribute="bottom" constant="20" id="gjR-Ll-yxB"/>
<constraint firstItem="E7T-JR-83X" firstAttribute="top" secondItem="eSH-gs-KsV" secondAttribute="bottom" constant="20" id="kER-T5-X2n"/>
<constraint firstItem="Bl2-c4-Jac" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="lpP-OY-zrB"/>
<constraint firstItem="IWd-6J-cL5" firstAttribute="width" secondItem="DHL-TO-21f" secondAttribute="width" id="qGa-D4-ash"/>
<constraint firstItem="E7T-JR-83X" firstAttribute="centerX" secondItem="m2S-Jp-Qdl" secondAttribute="centerX" id="v6f-Cm-jUo"/>
<constraint firstItem="Rom-SE-Y4X" firstAttribute="top" secondItem="atM-4n-Y8L" secondAttribute="bottom" constant="20" id="waR-de-VNW"/>
</constraints>
</view>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="60" y="738"/>
<point key="canvasLocation" x="60" y="755"/>
</scene>
</scenes>
</document>
34 changes: 34 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
EAF1A5BA255E86C900EFD1CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EAF1A5B8255E86C900EFD1CF /* Main.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
EA42146E2A5E5AC300B58532 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 04509DA328D2B26400B8B6D7 /* LYBProgressHUD.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 04509D9928D2B16B00B8B6D7;
remoteInfo = LYBProgressHUD;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
EA20F2C52563ADD2008A31F4 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
Expand Down Expand Up @@ -48,6 +58,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
EA42146B2A5E5AC100B58532 /* Products */ = {
isa = PBXGroup;
children = (
EA42146F2A5E5AC300B58532 /* LYBProgressHUD.framework */,
);
name = Products;
sourceTree = "<group>";
};
EAF1A5A6255E86C700EFD1CF = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -116,13 +134,29 @@
mainGroup = EAF1A5A6255E86C700EFD1CF;
productRefGroup = EAF1A5B0255E86C700EFD1CF /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = EA42146B2A5E5AC100B58532 /* Products */;
ProjectRef = 04509DA328D2B26400B8B6D7 /* LYBProgressHUD.xcodeproj */;
},
);
projectRoot = "";
targets = (
EAF1A5AE255E86C700EFD1CF /* LBProgressHUD */,
);
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
EA42146F2A5E5AC300B58532 /* LYBProgressHUD.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = LYBProgressHUD.framework;
remoteRef = EA42146E2A5E5AC300B58532 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
EAF1A5AD255E86C700EFD1CF /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down
6 changes: 6 additions & 0 deletions Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ class ViewController: NSViewController {
}
}

@IBAction func customClickHandler(_ sender: Any) {
let imageView = NSImageView()
imageView.image = NSImage(named: "success")
view.lyb.showCustom(view: imageView, message: "加载成功").dismiss(delay: 3)
}

@IBAction func defaultClickHandler(_ sender: Any) {
view.lyb.showHUD("Loding...").dismiss(delay: 3)
// LYBProgressHUD.show(in: view, message: "")
Expand Down
2 changes: 1 addition & 1 deletion LYBProgressHUD.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LYBProgressHUD是一款在OSX上简洁易用的HUD组件。

## 功能

- 三种提示样式
- 四种提示样式
- 自定义属性
- 简洁API,方便使用
- 阻止事件穿透,防止父视图事件穿透
Expand Down Expand Up @@ -104,7 +104,11 @@ github "liyb93/LYBProgressHUD"

## 更新记录

### v1.1.3
### v1.1.4

- 增加`custom`mode和快捷调用方式

###v1.1.3

- 支持Carthage和SPM

Expand Down
Loading

0 comments on commit 4287b8d

Please sign in to comment.