Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bca42b8011 | |||
| 794de3587a | |||
| 049b2f4dbd | |||
| 3958dc56bf | |||
| bf145ece96 | |||
| 74abf4aa76 | |||
| 501fb0d0bc | |||
| c4d965d2c0 | |||
| 898f027554 | |||
| be98d2d1cb | |||
| 8c7f89a5b9 | |||
| 75673fdecc | |||
| d18733fef4 | |||
| 5dcbf5b191 | |||
| 915134629f | |||
| 0c7ea5defd | |||
| 3fdde685bc | |||
| 0581fc848d | |||
| 9ba89d33f7 | |||
| 3aa49153e1 | |||
| 998d32df35 | |||
| bf31ebe9e6 | |||
| cb9d028f2a | |||
| ace36f8aa2 | |||
| d0669df745 | |||
| 7bedf36884 | |||
| 48f79c8e20 | |||
| b0db9a82c4 | |||
| 27d9ade6ea | |||
| 1ec0e9cf81 | |||
| 116ae6bb45 | |||
| 3139692a41 | |||
| deb72a4a7b | |||
| 25aed45cc8 | |||
| bf2f7fb663 | |||
| f0e2b694b0 | |||
| a570ddafc4 | |||
| 60983ca46c | |||
| 0a86894703 | |||
| e2d8b33d03 | |||
| d2842c9124 | |||
| 9c9771ef27 | |||
| d52dc41576 | |||
| 9a0d8e288d | |||
| 71ab8c0b52 | |||
| c9cde526db | |||
| f25d9697f2 | |||
| 4d90a04699 | |||
| df1a29bfa8 | |||
| bdd4ca3272 | |||
| dcd72533c8 | |||
| 3c410dd1ff | |||
| 29b8447b9c | |||
| 202d8895c6 | |||
| 2347f40e0f | |||
| b934604028 | |||
| 04747f8b3d | |||
| 80f66aa5e7 | |||
| 257ec88cbc | |||
| 27c21b2907 | |||
| 8782fbf288 | |||
| 8df5e8ca98 | |||
| c161ea4227 | |||
| d591e1a8e2 | |||
| e23fad1476 | |||
| 56fe3e6a87 | |||
| b74d8e890e | |||
| c954ef3806 | |||
| c63cf1840e | |||
| a90765f5f2 | |||
| 549fa28546 | |||
| 1f1d7ce8bd | |||
| 16e8622f52 | |||
| f851a0bde0 | |||
| ef9bd9679f | |||
| d34d348a6a | |||
| 364a0fad0b | |||
| d4166737ca | |||
| 643b58c62f | |||
| 8839e57987 | |||
| 7e02366094 | |||
| ec887003cc | |||
| 17ac00a076 | |||
| 96d3e9c424 | |||
| 4131642c82 | |||
| 7777e6dec8 | |||
| 2de9404fff | |||
| 07be9e2326 | |||
| 337d7c5c0d | |||
| 4f620828d8 | |||
| 60853bb7c3 | |||
| 2d0b0e0540 | |||
| 8919a10146 | |||
| 69fbbf6704 | |||
| 9097100c14 | |||
| 3383703d3e | |||
| d235a969bc | |||
| 48e100ed08 | |||
| 862c2003a7 | |||
| 9a019cb420 | |||
| 1afb2dce67 | |||
| 63f5e9ec5e | |||
| b508641808 | |||
| 503daa92d0 | |||
| bb26c1046d | |||
| 809662b2a8 | |||
| dc9257d448 | |||
| 2db1b9f52b | |||
| 3e2e49ea58 | |||
| b6b64697d5 | |||
| af1f2ba839 | |||
| ddd6a21502 | |||
| 2926f383dc | |||
| bcd2aa4020 | |||
| 93b904c8d8 | |||
| 66c322e239 | |||
| 546b96ddb0 | |||
| 4fc565d856 | |||
| ea0d907fff | |||
| 93ed629c62 | |||
| e52e83e428 | |||
| 89f63d0f1f | |||
| 93dac913fa | |||
| 489a91eeda | |||
| 374a708c7c |
@@ -23,3 +23,6 @@ profile
|
||||
|
||||
# Ruby
|
||||
.ruby-version
|
||||
|
||||
# Carthage
|
||||
Carthage/Build
|
||||
|
||||
+16
-5
@@ -1,8 +1,19 @@
|
||||
language: objective-c
|
||||
osx_image: xcode7.2
|
||||
script:
|
||||
- xctool -workspace MBProgressHUD.xcworkspace -scheme HudDemo -sdk iphonesimulator clean build
|
||||
- xctool -workspace MBProgressHUD.xcworkspace -scheme HudDemoTV -sdk iphonesimulator clean build
|
||||
- xctool -workspace MBProgressHUD.xcworkspace -scheme HudTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPad Air 2,OS=9.2" clean build test GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
|
||||
osx_image: xcode11.2
|
||||
|
||||
before_install:
|
||||
- env
|
||||
- locale
|
||||
- xcpretty --version
|
||||
- xcodebuild -version
|
||||
- xcodebuild -showsdks
|
||||
|
||||
script:
|
||||
- set -o pipefail
|
||||
|
||||
- xcodebuild clean build -workspace MBProgressHUD.xcworkspace -scheme HudDemo -sdk iphonesimulator -configuration Debug | xcpretty -c
|
||||
- xcodebuild clean build -workspace MBProgressHUD.xcworkspace -scheme HudDemoTV -sdk appletvsimulator -configuration Debug | xcpretty -c
|
||||
- xcodebuild clean build test -workspace MBProgressHUD.xcworkspace -scheme HudTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPad Air (3rd generation),OS=13.2.2" -configuration Debug GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty -c
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
Please take a moment to review this document in order to make the contribution
|
||||
process easy and effective for everyone involved.
|
||||
|
||||
|
||||
# Using the issue tracker
|
||||
|
||||
The issue tracker is the preferred channel for [bug reports](#bugs) and
|
||||
[features requests](#features), but please respect the following restriction:
|
||||
|
||||
* Please **do not** use the issue tracker for personal support requests (use
|
||||
a service like [Stack Overflow](http://stackoverflow.com) instead).
|
||||
|
||||
<a name="bugs"></a>
|
||||
## Bug reports
|
||||
|
||||
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
||||
Good bug reports are extremely helpful - thank you!
|
||||
|
||||
Guidelines for bug reports:
|
||||
|
||||
1. **Use the GitHub issue search** — check if the issue has already been
|
||||
reported.
|
||||
|
||||
2. **Check if the issue has been fixed** — try to reproduce it using the
|
||||
latest `master` branch in the repository.
|
||||
|
||||
3. **Isolate the problem** — provide exact reproduction steps, preferably
|
||||
in the form of a failing test case or by providing modification steps in the
|
||||
`MBProgressHUD` Demo application.
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more
|
||||
information. Please try to be as detailed as possible in your report. What is
|
||||
your environment? What steps will reproduce the issue? What iOS version did
|
||||
you use? What would you expect to be the outcome?
|
||||
|
||||
|
||||
<a name="features"></a>
|
||||
## Feature requests
|
||||
|
||||
Feature requests are welcome. But take a moment to find out whether your idea
|
||||
fits with the scope and aims of the project. It's up to *you* to make a strong
|
||||
case to convince the project's developers of the merits of this feature. Please
|
||||
provide as much detail and context as possible.
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
|
||||
# Pull requests
|
||||
|
||||
Good pull requests - patches, improvements, new features - are a fantastic
|
||||
help. They should remain focused in scope and avoid containing unrelated
|
||||
commits.
|
||||
|
||||
**Please ask first** before embarking on any significant pull request (e.g.
|
||||
implementing features, refactoring code, porting to a different language),
|
||||
otherwise you risk spending a lot of time working on something that the
|
||||
project's developers might not want to merge into the project.
|
||||
|
||||
Please adhere to the coding conventions used throughout a project (indentation,
|
||||
accurate comments, etc.) and any other requirements (such as test coverage).
|
||||
|
||||
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
|
||||
license your work under the same license as that used by the project.
|
||||
|
||||
This document is based on https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md.
|
||||
@@ -24,6 +24,7 @@
|
||||
D27F18641D3B5E21009D7482 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D27F18611D3B5E21009D7482 /* Main.storyboard */; };
|
||||
D286A76D1518CA9F00E13FB8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D286A76C1518CA9F00E13FB8 /* CoreGraphics.framework */; };
|
||||
D2B174121C5E3A3D00021915 /* HudTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B174111C5E3A3D00021915 /* HudTests.m */; };
|
||||
D2D75D5323A8193100485497 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2D75D5123A8193000485497 /* Launch.storyboard */; };
|
||||
D2EEB3811B55967200F59EC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2EEB3801B55967200F59EC1 /* Images.xcassets */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -63,9 +64,11 @@
|
||||
D27F18621D3B5E21009D7482 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = HudDemo/en.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
D27F18651D3B5E2D009D7482 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = HudDemo/Info.plist; sourceTree = "<group>"; };
|
||||
D286A76C1518CA9F00E13FB8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
D2B1269B23CB8D9C00A01F4C /* HudDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HudDemo.entitlements; sourceTree = "<group>"; };
|
||||
D2B1740F1C5E3A3D00021915 /* HudTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HudTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D2B174111C5E3A3D00021915 /* HudTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HudTests.m; sourceTree = "<group>"; };
|
||||
D2B174131C5E3A3D00021915 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
D2D75D5223A8193000485497 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Launch.storyboard; sourceTree = "<group>"; };
|
||||
D2EEB3801B55967200F59EC1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HudDemo/Images.xcassets; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -101,6 +104,7 @@
|
||||
080E96DDFE201D6D7F000001 /* HudDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2B1269B23CB8D9C00A01F4C /* HudDemo.entitlements */,
|
||||
D27F18561D3B5DFF009D7482 /* MBHudDemoAppDelegate.h */,
|
||||
D27F18571D3B5DFF009D7482 /* MBHudDemoViewController.h */,
|
||||
D27F18581D3B5DFF009D7482 /* MBHudDemoAppDelegate.m */,
|
||||
@@ -108,8 +112,7 @@
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
);
|
||||
name = HudDemo;
|
||||
path = Classes;
|
||||
path = HudDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
@@ -200,6 +203,7 @@
|
||||
D27F18671D3B5E43009D7482 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2D75D5123A8193000485497 /* Launch.storyboard */,
|
||||
D27F184C1D3B5878009D7482 /* Main.storyboard */,
|
||||
D27F18511D3B5878009D7482 /* Info.plist */,
|
||||
D274948A1D3B74AA00ABEB66 /* Images.xcassets */,
|
||||
@@ -287,7 +291,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = MB;
|
||||
LastUpgradeCheck = 0720;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = "Matej Bukovinski";
|
||||
TargetAttributes = {
|
||||
D27F18401D3B5878009D7482 = {
|
||||
@@ -301,13 +305,9 @@
|
||||
};
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HudDemo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
@@ -339,6 +339,7 @@
|
||||
files = (
|
||||
D27F184E1D3B5878009D7482 /* Main.storyboard in Resources */,
|
||||
D274948B1D3B74AA00ABEB66 /* Images.xcassets in Resources */,
|
||||
D2D75D5323A8193100485497 /* Launch.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -417,6 +418,14 @@
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D2D75D5123A8193000485497 /* Launch.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
D2D75D5223A8193000485497 /* Base */,
|
||||
);
|
||||
name = Launch.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
@@ -425,7 +434,9 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = HudDemo/HudDemo.entitlements;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
@@ -434,6 +445,7 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.bukovinski.${PRODUCT_NAME:identifier}";
|
||||
PRODUCT_NAME = HudDemo;
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -443,7 +455,9 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = HudDemo/HudDemo.entitlements;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = HudDemo/HudDemo_Prefix.pch;
|
||||
INFOPLIST_FILE = HudDemo/Info.plist;
|
||||
@@ -451,6 +465,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.bukovinski.${PRODUCT_NAME:identifier}";
|
||||
PRODUCT_NAME = HudDemo;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
@@ -458,15 +473,25 @@
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
@@ -478,7 +503,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -487,15 +512,25 @@
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
@@ -506,7 +541,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Release;
|
||||
@@ -521,6 +556,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
@@ -553,6 +589,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
@@ -598,6 +635,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.bukovinski.HudTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HudDemo.app/HudDemo";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -624,6 +662,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.bukovinski.HudTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HudDemo.app/HudDemo";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.8">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -41,8 +41,6 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
@@ -52,8 +50,18 @@
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D2B1740E1C5E3A3D00021915"
|
||||
BuildableName = "HudTests.xctest"
|
||||
BlueprintName = "HudTests"
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -77,8 +85,6 @@
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
displayScaleIsEnabled = "NO"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -27,8 +27,6 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
@@ -38,8 +36,8 @@
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -61,8 +59,6 @@
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -11,6 +11,15 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
|
||||
BuildableName = "HudDemo.app"
|
||||
BlueprintName = "HudDemo"
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -23,17 +32,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
|
||||
BuildableName = "HudDemo.app"
|
||||
BlueprintName = "HudDemo"
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -55,8 +53,6 @@
|
||||
ReferencedContainer = "container:HudDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
@@ -1,5 +1,17 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-40.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-60.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
@@ -54,6 +66,18 @@
|
||||
"filename" : "Icon-60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-20.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-41.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
@@ -119,6 +143,12 @@
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-167.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "AppStore.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -28,29 +28,6 @@
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchImages</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default-iOS7</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{320, 568}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default-iOS7</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{320, 480}</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>Launch</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
@interface MBHudDemoViewController () <NSURLSessionDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSArray<NSArray<MBExample *> *> *examples;
|
||||
// Atomic, because it may be cancelled from main thread, flag is read on a background thread
|
||||
// Atomic, because it may be canceled from main thread, flag is read on a background thread
|
||||
@property (atomic, assign) BOOL canceled;
|
||||
|
||||
@end
|
||||
@@ -56,7 +56,7 @@
|
||||
[MBExample exampleWithTitle:@"Custom view" selector:@selector(customViewExample)],
|
||||
[MBExample exampleWithTitle:@"With action button" selector:@selector(cancelationExample)],
|
||||
[MBExample exampleWithTitle:@"Mode switching" selector:@selector(modeSwitchingExample)]],
|
||||
@[[MBExample exampleWithTitle:@"On window" selector:@selector(indeterminateExample)],
|
||||
@[[MBExample exampleWithTitle:@"On window" selector:@selector(windowExample)],
|
||||
[MBExample exampleWithTitle:@"NSURLSession" selector:@selector(networkingExample)],
|
||||
[MBExample exampleWithTitle:@"Determinate with NSProgress" selector:@selector(determinateNSProgressExample)],
|
||||
[MBExample exampleWithTitle:@"Dim background" selector:@selector(dimBackgroundExample)],
|
||||
@@ -259,7 +259,7 @@
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
||||
// Do something useful in the background and update the HUD periodically.
|
||||
[self doSomeWorkWithMixedProgress];
|
||||
[self doSomeWorkWithMixedProgress:hud];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[hud hideAnimated:YES];
|
||||
});
|
||||
@@ -340,8 +340,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)doSomeWorkWithMixedProgress {
|
||||
MBProgressHUD *hud = [MBProgressHUD HUDForView:self.navigationController.view];
|
||||
- (void)doSomeWorkWithMixedProgress:(MBProgressHUD *)hud {
|
||||
// Indeterminate mode
|
||||
sleep(2);
|
||||
// Switch to determinate mode
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A282b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Fq2-vR-Rsu">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Fq2-vR-Rsu">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Navigation Controller-->
|
||||
@@ -10,9 +12,8 @@
|
||||
<objects>
|
||||
<navigationController id="Fq2-vR-Rsu" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="2LN-7G-jZD">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="iXE-FA-91q" kind="relationship" relationship="rootViewController" id="peN-oI-nI6"/>
|
||||
@@ -31,10 +32,9 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="YSo-zR-oqe"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="TWt-Z9-CWt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="MBProgressHUD" id="IuF-Dp-Voh"/>
|
||||
</viewController>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="9dw-fs-BGe">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="9dw-fs-BGe">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--MBProgressHUD-->
|
||||
@@ -10,16 +12,16 @@
|
||||
<objects>
|
||||
<tableViewController id="1VA-J6-vTg" customClass="MBHudDemoViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="v14-ld-S1m">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<inset key="separatorInset" minX="30" minY="0.0" maxX="30" maxY="0.0"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="MBExampleCell" id="EW9-df-ImK">
|
||||
<rect key="frame" x="0.0" y="114" width="600" height="44"/>
|
||||
<rect key="frame" x="0.0" y="55.5" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EW9-df-ImK" id="TMc-hr-0mm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
@@ -41,7 +43,7 @@
|
||||
<objects>
|
||||
<navigationController id="9dw-fs-BGe" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="355-tf-2jt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="15702" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="appleTV" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="tvOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="438" y="544"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -26,6 +26,8 @@
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>Launch</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
|
||||
+175
-11
@@ -26,10 +26,15 @@ XCTAssertFalse(hud.hidden, @"The HUD should be visible."); \
|
||||
XCTAssertEqual(hud.bezelView.alpha, 1.f, @"The HUD should be visible."); \
|
||||
} while (0)
|
||||
|
||||
#define MBTestHUDIsHiden(hud, rootView) \
|
||||
do { \
|
||||
XCTAssertEqual(hud.alpha, 0.f, @"The hud should be faded out."); \
|
||||
} while (0)
|
||||
|
||||
#define MBTestHUDIsHidenAndRemoved(hud, rootView) \
|
||||
do { \
|
||||
XCTAssertFalse([rootView.subviews containsObject:hud], @"The HUD should not be part of the view hierarchy."); \
|
||||
XCTAssertEqual(hud.alpha, 0.f, @"The hud should be faded out."); \
|
||||
MBTestHUDIsHiden(hud, rootView); \
|
||||
XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
} while (0)
|
||||
|
||||
@@ -43,10 +48,30 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
|
||||
@implementation HudTests
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
- (void)testInitializers {
|
||||
XCTAssertNotNil([[MBProgressHUD alloc] initWithView:[UIView new]]);
|
||||
UIView *nilView = nil;
|
||||
XCTAssertThrows([[MBProgressHUD alloc] initWithView:nilView]);
|
||||
XCTAssertNotNil([[MBProgressHUD alloc] initWithFrame:CGRectZero]);
|
||||
NSKeyedUnarchiver *dummyUnarchiver;
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
if (@available(iOS 11.0, *)) {
|
||||
#endif
|
||||
dummyUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:[NSData data] error:nil];
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
} else {
|
||||
dummyUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:[NSData data]];
|
||||
}
|
||||
#endif
|
||||
XCTAssertNotNil([[MBProgressHUD alloc] initWithCoder:dummyUnarchiver]);
|
||||
}
|
||||
|
||||
#pragma mark - Convenience
|
||||
|
||||
- (void)testNonAnimatedConvenienceHUDPresentation {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:rootView animated:NO];
|
||||
@@ -67,7 +92,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
}
|
||||
|
||||
- (void)testAnimatedConvenienceHUDPresentation {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -103,7 +128,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
}
|
||||
|
||||
- (void)testCompletionBlock {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -120,10 +145,80 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
[self waitForExpectationsWithTimeout:5. handler:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Modes
|
||||
|
||||
- (void)testRoundDeterminate {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
hud.mode = MBProgressHUDModeDeterminate;
|
||||
[rootView addSubview:hud];
|
||||
[hud showAnimated:NO];
|
||||
|
||||
MBTestHUDIsVisible(hud, rootView);
|
||||
XCTAssertNotNil([self view:hud firstSubviewOfClass:[MBRoundProgressView class]]);
|
||||
|
||||
XCTAssertTrue([MBProgressHUD hideHUDForView:rootView animated:NO], @"The HUD should be found and removed.");
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
- (void)testRoundAnnularDeterminate {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
hud.mode = MBProgressHUDModeAnnularDeterminate;
|
||||
[rootView addSubview:hud];
|
||||
[hud showAnimated:NO];
|
||||
|
||||
MBTestHUDIsVisible(hud, rootView);
|
||||
XCTAssertNotNil([self view:hud firstSubviewOfClass:[MBRoundProgressView class]]);
|
||||
|
||||
XCTAssertTrue([MBProgressHUD hideHUDForView:rootView animated:NO], @"The HUD should be found and removed.");
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
- (void)testDeterminateHorizontalBar {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
hud.mode = MBProgressHUDModeDeterminateHorizontalBar;
|
||||
[rootView addSubview:hud];
|
||||
[hud showAnimated:NO];
|
||||
|
||||
MBTestHUDIsVisible(hud, rootView);
|
||||
XCTAssertNotNil([self view:hud firstSubviewOfClass:[MBBarProgressView class]]);
|
||||
|
||||
XCTAssertTrue([MBProgressHUD hideHUDForView:rootView animated:NO], @"The HUD should be found and removed.");
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Customization
|
||||
|
||||
- (void)testEffectViewOrderAfterSettingBlurStyle {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
|
||||
[hud.bezelView.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
|
||||
XCTAssert(![view isKindOfClass:UIVisualEffectView.class] || idx == 0, @"Just the first subview should be a visual effect view.");
|
||||
}];
|
||||
|
||||
hud.bezelView.blurEffectStyle = UIBlurEffectStyleDark;
|
||||
|
||||
[hud.bezelView.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
|
||||
XCTAssert(![view isKindOfClass:UIVisualEffectView.class] || idx == 0, @"Just the first subview should be a visual effect view even after changing the blurEffectStyle.");
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Delay
|
||||
|
||||
- (void)testDelayedHide {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -153,10 +248,38 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
- (void)testDelayedHideDoesNotRace {
|
||||
// https://github.com/jdg/MBProgressHUD/issues/503
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
[rootView addSubview:hud];
|
||||
|
||||
[hud showAnimated:YES];
|
||||
[hud hideAnimated:YES afterDelay:0.3];
|
||||
MBTestHUDIsVisible(hud, rootView);
|
||||
|
||||
XCTestExpectation *hideCheckExpectation = [self expectationWithDescription:@"Hide check"];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
[hud showAnimated:YES];
|
||||
[hud hideAnimated:YES afterDelay:0.3];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
MBTestHUDIsHiden(hud, rootView);
|
||||
[hideCheckExpectation fulfill];
|
||||
});
|
||||
});
|
||||
|
||||
[self waitForExpectationsWithTimeout:5. handler:nil];
|
||||
|
||||
[hud removeFromSuperview];
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
#pragma mark - Ruse
|
||||
|
||||
- (void)testNonAnimatedHudReuse {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
@@ -175,7 +298,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
}
|
||||
|
||||
- (void)testUnfinishedHidingAnimation {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:rootView animated:NO];
|
||||
@@ -200,7 +323,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
}
|
||||
|
||||
- (void)testAnimatedImmediateHudReuse {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
XCTestExpectation *hideExpectation = [self expectationWithDescription:@"The hud should have been hidden."];
|
||||
@@ -229,7 +352,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
#pragma mark - Min show time
|
||||
|
||||
- (void)testMinShowTime {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -266,7 +389,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
#pragma mark - Grace time
|
||||
|
||||
- (void)testGraceTime {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -307,7 +430,7 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
}
|
||||
|
||||
- (void)testHideBeforeGraceTimeElapsed {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
self.hideExpectation = [self expectationWithDescription:@"The hudWasHidden: delegate should have been called."];
|
||||
@@ -348,6 +471,31 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
#pragma mark - Customization
|
||||
|
||||
- (void)testShape {
|
||||
UIViewController *rootViewController = UIApplication.sharedApplication.windows.firstObject.rootViewController;
|
||||
UIView *rootView = rootViewController.view;
|
||||
|
||||
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:rootView];
|
||||
hud.removeFromSuperViewOnHide = YES;
|
||||
hud.offset = CGPointMake(50, 50);
|
||||
hud.square = YES;
|
||||
hud.label.text = @"Some long text...";
|
||||
[rootView addSubview:hud];
|
||||
[hud showAnimated:NO];
|
||||
|
||||
[hud setNeedsLayout];
|
||||
[hud layoutIfNeeded];
|
||||
|
||||
CGRect frame = hud.bezelView.frame;
|
||||
XCTAssertEqual(frame.size.width, frame.size.height);
|
||||
|
||||
[hud hideAnimated:NO];
|
||||
|
||||
MBTestHUDIsHidenAndRemoved(hud, rootView);
|
||||
}
|
||||
|
||||
#pragma mark - MBProgressHUDDelegate
|
||||
|
||||
- (void)hudWasHidden:(MBProgressHUD *)hud {
|
||||
@@ -358,4 +506,20 @@ XCTAssertNil(hud.superview, @"The HUD should not have a superview."); \
|
||||
self.hideExpectation = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
- (nullable UIView *)view:(UIView *)view firstSubviewOfClass:(Class)clazz {
|
||||
for (__unsafe_unretained UIView *subview in view.subviews) {
|
||||
if ([subview isKindOfClass:clazz]) {
|
||||
return subview;
|
||||
}
|
||||
}
|
||||
__unsafe_unretained UIView *theView;
|
||||
for (__unsafe_unretained UIView *subview in view.subviews) {
|
||||
theView = [self view:subview firstSubviewOfClass:clazz];
|
||||
if (theView) { break; }
|
||||
}
|
||||
return theView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright © 2009-2016 Matej Bukovinski
|
||||
Copyright © 2009-2020 Matej Bukovinski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#import <Availability.h>
|
||||
|
||||
#ifndef __IPHONE_3_0
|
||||
#warning "This project uses features only available in iOS SDK 3.0 and later."
|
||||
#ifndef __IPHONE_8_0
|
||||
#warning "This project uses features only available in iOS SDK 8.0 and later."
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
+36
-60
@@ -1,10 +1,10 @@
|
||||
//
|
||||
// MBProgressHUD.h
|
||||
// Version 1.0.0
|
||||
// Version 1.2.0
|
||||
// Created by Matej Bukovinski on 2.4.09.
|
||||
//
|
||||
|
||||
// This code is distributed under the terms and conditions of the MIT license.
|
||||
// This code is distributed under the terms and conditions of the MIT license.
|
||||
|
||||
// Copyright © 2009-2016 Matej Bukovinski
|
||||
//
|
||||
@@ -69,13 +69,13 @@ typedef NS_ENUM(NSInteger, MBProgressHUDBackgroundStyle) {
|
||||
MBProgressHUDBackgroundStyleBlur
|
||||
};
|
||||
|
||||
typedef void (^MBProgressHUDCompletionBlock)();
|
||||
typedef void (^MBProgressHUDCompletionBlock)(void);
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Displays a simple HUD window containing a progress indicator and two optional labels for short messages.
|
||||
*
|
||||
* This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class.
|
||||
@@ -125,7 +125,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* @param view The view that is going to be searched.
|
||||
* @return A reference to the last HUD subview discovered.
|
||||
*/
|
||||
+ (nullable MBProgressHUD *)HUDForView:(UIView *)view;
|
||||
+ (nullable MBProgressHUD *)HUDForView:(UIView *)view NS_SWIFT_NAME(forView(_:));
|
||||
|
||||
/**
|
||||
* A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with
|
||||
@@ -136,8 +136,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (instancetype)initWithView:(UIView *)view;
|
||||
|
||||
/**
|
||||
* Displays the HUD.
|
||||
/**
|
||||
* Displays the HUD.
|
||||
*
|
||||
* @note You need to make sure that the main thread completes its run loop soon after this method call so that
|
||||
* the user interface can be updated. Call this method when your task is already set up to be executed in a new thread
|
||||
@@ -150,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)showAnimated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Hides the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to
|
||||
* hide the HUD when your task completes.
|
||||
*
|
||||
@@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)hideAnimated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Hides the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to
|
||||
* hide the HUD when your task completes.
|
||||
*
|
||||
@@ -179,16 +179,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) id<MBProgressHUDDelegate> delegate;
|
||||
|
||||
/**
|
||||
* Called after the HUD is hiden.
|
||||
* Called after the HUD is hidden.
|
||||
*/
|
||||
@property (copy, nullable) MBProgressHUDCompletionBlock completionBlock;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Grace period is the time (in seconds) that the invoked method may be run without
|
||||
* showing the HUD. If the task finishes before the grace time runs out, the HUD will
|
||||
* not be shown at all.
|
||||
* This may be used to prevent HUD display for very short tasks.
|
||||
* Defaults to 0 (no grace time).
|
||||
* @note The graceTime needs to be set before the hud is shown. You thus can't use `showHUDAddedTo:animated:`,
|
||||
* but instead need to alloc / init the HUD, configure the grace time and than show it manually.
|
||||
*/
|
||||
@property (assign, nonatomic) NSTimeInterval graceTime;
|
||||
|
||||
@@ -207,7 +209,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// @name Appearance
|
||||
|
||||
/**
|
||||
/**
|
||||
* MBProgressHUD operation mode. The default is MBProgressHUDModeIndeterminate.
|
||||
*/
|
||||
@property (assign, nonatomic) MBProgressHUDMode mode;
|
||||
@@ -250,7 +252,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* When enabled, the bezel center gets slightly affected by the device accelerometer data.
|
||||
* Has no effect on iOS < 7.0. Defaults to YES.
|
||||
* Defaults to NO.
|
||||
*
|
||||
* @note This can cause main thread checker assertions on certain devices. https://github.com/jdg/MBProgressHUD/issues/552
|
||||
*/
|
||||
@property (assign, nonatomic, getter=areDefaultMotionEffectsEnabled) BOOL defaultMotionEffectsEnabled UI_APPEARANCE_SELECTOR;
|
||||
|
||||
@@ -298,7 +302,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (strong, nonatomic, readonly) UILabel *detailsLabel;
|
||||
|
||||
/**
|
||||
* A button that is placed below the labels. Visible only if a target / action is added.
|
||||
* A button that is placed below the labels. Visible only if a target / action is added and a title is assigned..
|
||||
*/
|
||||
@property (strong, nonatomic, readonly) UIButton *button;
|
||||
|
||||
@@ -309,8 +313,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
* Called after the HUD was fully hidden from the screen.
|
||||
/**
|
||||
* Called after the HUD was fully hidden from the screen.
|
||||
*/
|
||||
- (void)hudWasHidden:(MBProgressHUD *)hud;
|
||||
|
||||
@@ -320,7 +324,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* A progress view for showing definite progress by filling up a circle (pie chart).
|
||||
*/
|
||||
@interface MBRoundProgressView : UIView
|
||||
@interface MBRoundProgressView : UIView
|
||||
|
||||
/**
|
||||
* Progress (0.0 to 1.0)
|
||||
@@ -334,7 +338,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, strong) UIColor *progressTintColor;
|
||||
|
||||
/**
|
||||
* Indicator background (non-progress) color.
|
||||
* Indicator background (non-progress) color.
|
||||
* Only applicable on iOS versions older than iOS 7.
|
||||
* Defaults to translucent white (alpha 0.1).
|
||||
*/
|
||||
@@ -349,7 +353,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
/**
|
||||
* A flat bar progress view.
|
||||
* A flat bar progress view.
|
||||
*/
|
||||
@interface MBBarProgressView : UIView
|
||||
|
||||
@@ -382,53 +386,25 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface MBBackgroundView : UIView
|
||||
|
||||
/**
|
||||
* The background style.
|
||||
* Defaults to MBProgressHUDBackgroundStyleBlur on iOS 7 or later and MBProgressHUDBackgroundStyleSolidColor otherwise.
|
||||
* @note Due to iOS 7 not supporting UIVisualEffectView, the blur effect differs slightly between iOS 7 and later versions.
|
||||
* The background style.
|
||||
* Defaults to MBProgressHUDBackgroundStyleBlur.
|
||||
*/
|
||||
@property (nonatomic) MBProgressHUDBackgroundStyle style;
|
||||
|
||||
/**
|
||||
* The background color or the blur tint color.
|
||||
* @note Due to iOS 7 not supporting UIVisualEffectView, the blur effect differs slightly between iOS 7 and later versions.
|
||||
* The blur effect style, when using MBProgressHUDBackgroundStyleBlur.
|
||||
* Defaults to UIBlurEffectStyleLight.
|
||||
*/
|
||||
@property (nonatomic, strong) UIColor *color;
|
||||
@property (nonatomic) UIBlurEffectStyle blurEffectStyle;
|
||||
|
||||
@end
|
||||
|
||||
@interface MBProgressHUD (Deprecated)
|
||||
|
||||
+ (NSArray *)allHUDsForView:(UIView *)view __attribute__((deprecated("Store references when using more than one HUD per view.")));
|
||||
+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated __attribute__((deprecated("Store references when using more than one HUD per view.")));
|
||||
|
||||
- (id)initWithWindow:(UIWindow *)window __attribute__((deprecated("Use initWithView: instead.")));
|
||||
|
||||
- (void)show:(BOOL)animated __attribute__((deprecated("Use showAnimated: instead.")));
|
||||
- (void)hide:(BOOL)animated __attribute__((deprecated("Use hideAnimated: instead.")));
|
||||
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay __attribute__((deprecated("Use hideAnimated:afterDelay: instead.")));
|
||||
|
||||
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated __attribute__((deprecated("Use GCD directly.")));
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block __attribute__((deprecated("Use GCD directly.")));
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(nullable MBProgressHUDCompletionBlock)completion __attribute__((deprecated("Use GCD directly.")));
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue __attribute__((deprecated("Use GCD directly.")));
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue
|
||||
completionBlock:(nullable MBProgressHUDCompletionBlock)completion __attribute__((deprecated("Use GCD directly.")));
|
||||
@property (assign) BOOL taskInProgress __attribute__((deprecated("No longer needed.")));
|
||||
|
||||
@property (nonatomic, copy) NSString *labelText __attribute__((deprecated("Use label.text instead.")));
|
||||
@property (nonatomic, strong) UIFont *labelFont __attribute__((deprecated("Use label.font instead.")));
|
||||
@property (nonatomic, strong) UIColor *labelColor __attribute__((deprecated("Use label.textColor instead.")));
|
||||
@property (nonatomic, copy) NSString *detailsLabelText __attribute__((deprecated("Use detailsLabel.text instead.")));
|
||||
@property (nonatomic, strong) UIFont *detailsLabelFont __attribute__((deprecated("Use detailsLabel.font instead.")));
|
||||
@property (nonatomic, strong) UIColor *detailsLabelColor __attribute__((deprecated("Use detailsLabel.textColor instead.")));
|
||||
@property (assign, nonatomic) CGFloat opacity __attribute__((deprecated("Customize bezelView properties instead.")));
|
||||
@property (strong, nonatomic) UIColor *color __attribute__((deprecated("Customize the bezelView color instead.")));
|
||||
@property (assign, nonatomic) CGFloat xOffset __attribute__((deprecated("Set offset.x instead.")));
|
||||
@property (assign, nonatomic) CGFloat yOffset __attribute__((deprecated("Set offset.y instead.")));
|
||||
@property (assign, nonatomic) CGFloat cornerRadius __attribute__((deprecated("Set bezelView.layer.cornerRadius instead.")));
|
||||
@property (assign, nonatomic) BOOL dimBackground __attribute__((deprecated("Customize HUD background properties instead.")));
|
||||
@property (strong, nonatomic) UIColor *activityIndicatorColor __attribute__((deprecated("Use UIAppearance to customize UIActivityIndicatorView. E.g.: [UIActivityIndicatorView appearanceWhenContainedIn:[MBProgressHUD class], nil].color = [UIColor redColor];")));
|
||||
@property (atomic, assign, readonly) CGSize size __attribute__((deprecated("Get the bezelView.frame.size instead.")));
|
||||
/**
|
||||
* The background color or the blur tint color.
|
||||
*
|
||||
* Defaults to nil on iOS 13 and later and
|
||||
* `[UIColor colorWithWhite:0.8f alpha:0.6f]`
|
||||
* on older systems.
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) UIColor *color;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+121
-414
@@ -1,21 +1,12 @@
|
||||
//
|
||||
// MBProgressHUD.m
|
||||
// Version 1.0.0
|
||||
// Version 1.2.0
|
||||
// Created by Matej Bukovinski on 2.4.09.
|
||||
//
|
||||
|
||||
#import "MBProgressHUD.h"
|
||||
#import <tgmath.h>
|
||||
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber_iOS_7_0
|
||||
#define kCFCoreFoundationVersionNumber_iOS_7_0 847.20
|
||||
#endif
|
||||
|
||||
#ifndef kCFCoreFoundationVersionNumber_iOS_8_0
|
||||
#define kCFCoreFoundationVersionNumber_iOS_8_0 1129.15
|
||||
#endif
|
||||
|
||||
#define MBMainThreadAssert() NSAssert([NSThread isMainThread], @"MBProgressHUD needs to be accessed on the main thread.");
|
||||
|
||||
CGFloat const MBProgressMaxOffset = 1000000.f;
|
||||
@@ -25,11 +16,7 @@ static const CGFloat MBDefaultLabelFontSize = 16.f;
|
||||
static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
|
||||
@interface MBProgressHUD () {
|
||||
// Deprecated
|
||||
UIColor *_activityIndicatorColor;
|
||||
CGFloat _opacity;
|
||||
}
|
||||
@interface MBProgressHUD ()
|
||||
|
||||
@property (nonatomic, assign) BOOL useAnimation;
|
||||
@property (nonatomic, assign, getter=hasFinished) BOOL finished;
|
||||
@@ -39,14 +26,12 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
@property (nonatomic, strong) NSArray *bezelConstraints;
|
||||
@property (nonatomic, strong) UIView *topSpacer;
|
||||
@property (nonatomic, strong) UIView *bottomSpacer;
|
||||
@property (nonatomic, strong) UIMotionEffectGroup *bezelMotionEffects;
|
||||
@property (nonatomic, weak) NSTimer *graceTimer;
|
||||
@property (nonatomic, weak) NSTimer *minShowTimer;
|
||||
@property (nonatomic, weak) NSTimer *hideDelayTimer;
|
||||
@property (nonatomic, weak) CADisplayLink *progressObjectDisplayLink;
|
||||
|
||||
// Deprecated
|
||||
@property (assign) BOOL taskInProgress;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -96,12 +81,14 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
_animationType = MBProgressHUDAnimationFade;
|
||||
_mode = MBProgressHUDModeIndeterminate;
|
||||
_margin = 20.0f;
|
||||
_opacity = 1.f;
|
||||
_defaultMotionEffectsEnabled = YES;
|
||||
_defaultMotionEffectsEnabled = NO;
|
||||
|
||||
if (@available(iOS 13.0, tvOS 13, *)) {
|
||||
_contentColor = [[UIColor labelColor] colorWithAlphaComponent:0.7f];
|
||||
} else {
|
||||
_contentColor = [UIColor colorWithWhite:0.f alpha:0.7f];
|
||||
}
|
||||
|
||||
// Default color, depending on the current iOS version
|
||||
BOOL isLegacy = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0;
|
||||
_contentColor = isLegacy ? [UIColor whiteColor] : [UIColor colorWithWhite:0.f alpha:0.7f];
|
||||
// Transparent background
|
||||
self.opaque = NO;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
@@ -150,7 +137,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
NSTimer *timer = [NSTimer timerWithTimeInterval:self.graceTime target:self selector:@selector(handleGraceTimer:) userInfo:nil repeats:NO];
|
||||
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
|
||||
self.graceTimer = timer;
|
||||
}
|
||||
}
|
||||
// ... otherwise show the HUD immediately
|
||||
else {
|
||||
[self showUsingAnimation:self.useAnimation];
|
||||
@@ -171,13 +158,16 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
|
||||
self.minShowTimer = timer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ... otherwise hide the HUD immediately
|
||||
[self hideUsingAnimation:self.useAnimation];
|
||||
}
|
||||
|
||||
- (void)hideAnimated:(BOOL)animated afterDelay:(NSTimeInterval)delay {
|
||||
// Cancel any scheduled hideAnimated:afterDelay: calls
|
||||
[self.hideDelayTimer invalidate];
|
||||
|
||||
NSTimer *timer = [NSTimer timerWithTimeInterval:delay target:self selector:@selector(handleHideTimer:) userInfo:@(animated) repeats:NO];
|
||||
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
|
||||
self.hideDelayTimer = timer;
|
||||
@@ -213,7 +203,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
[self.bezelView.layer removeAllAnimations];
|
||||
[self.backgroundView.layer removeAllAnimations];
|
||||
|
||||
// Cancel any scheduled hideDelayed: calls
|
||||
// Cancel any scheduled hideAnimated:afterDelay: calls
|
||||
[self.hideDelayTimer invalidate];
|
||||
|
||||
self.showStarted = [NSDate date];
|
||||
@@ -222,18 +212,25 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
// Needed in case we hide and re-show with the same NSProgress object attached.
|
||||
[self setNSProgressDisplayLinkEnabled:YES];
|
||||
|
||||
// Set up motion effects only at this point to avoid needlessly
|
||||
// creating the effect if it was disabled after initialization.
|
||||
[self updateBezelMotionEffects];
|
||||
|
||||
if (animated) {
|
||||
[self animateIn:YES withType:self.animationType completion:NULL];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
self.bezelView.alpha = self.opacity;
|
||||
#pragma clang diagnostic pop
|
||||
self.bezelView.alpha = 1.f;
|
||||
self.backgroundView.alpha = 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)hideUsingAnimation:(BOOL)animated {
|
||||
// Cancel any scheduled hideAnimated:afterDelay: calls.
|
||||
// This needs to happen here instead of in done,
|
||||
// to avoid races if another hideAnimated:afterDelay:
|
||||
// call comes in while the HUD is animating out.
|
||||
[self.hideDelayTimer invalidate];
|
||||
|
||||
if (animated && self.showStarted) {
|
||||
self.showStarted = nil;
|
||||
[self animateIn:NO withType:self.animationType completion:^(BOOL finished) {
|
||||
@@ -273,26 +270,14 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
} else if (!animatingIn && type == MBProgressHUDAnimationZoomOut) {
|
||||
bezelView.transform = small;
|
||||
}
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
bezelView.alpha = animatingIn ? self.opacity : 0.f;
|
||||
#pragma clang diagnostic pop
|
||||
self.backgroundView.alpha = animatingIn ? 1.f : 0.f;
|
||||
CGFloat alpha = animatingIn ? 1.f : 0.f;
|
||||
bezelView.alpha = alpha;
|
||||
self.backgroundView.alpha = alpha;
|
||||
};
|
||||
|
||||
// Spring animations are nicer, but only available on iOS 7+
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 || TARGET_OS_TV
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
|
||||
[UIView animateWithDuration:0.3 delay:0. usingSpringWithDamping:1.f initialSpringVelocity:0.f options:UIViewAnimationOptionBeginFromCurrentState animations:animations completion:completion];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
[UIView animateWithDuration:0.3 delay:0. options:UIViewAnimationOptionBeginFromCurrentState animations:animations completion:completion];
|
||||
[UIView animateWithDuration:0.3 delay:0. usingSpringWithDamping:1.f initialSpringVelocity:0.f options:UIViewAnimationOptionBeginFromCurrentState animations:animations completion:completion];
|
||||
}
|
||||
|
||||
- (void)done {
|
||||
// Cancel any scheduled hideDelayed: calls
|
||||
[self.hideDelayTimer invalidate];
|
||||
[self setNSProgressDisplayLinkEnabled:NO];
|
||||
|
||||
if (self.hasFinished) {
|
||||
@@ -330,7 +315,6 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
bezelView.alpha = 0.f;
|
||||
[self addSubview:bezelView];
|
||||
_bezelView = bezelView;
|
||||
[self updateBezelMotionEffects];
|
||||
|
||||
UILabel *label = [UILabel new];
|
||||
label.adjustsFontSizeToFitWidth = NO;
|
||||
@@ -386,9 +370,20 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
if (mode == MBProgressHUDModeIndeterminate) {
|
||||
if (!isActivityIndicator) {
|
||||
// Update to indeterminate indicator
|
||||
UIActivityIndicatorView *activityIndicator;
|
||||
[indicator removeFromSuperview];
|
||||
indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||
[(UIActivityIndicatorView *)indicator startAnimating];
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
if (@available(iOS 13.0, tvOS 13.0, *)) {
|
||||
#endif
|
||||
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
|
||||
activityIndicator.color = [UIColor whiteColor];
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
} else {
|
||||
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||
}
|
||||
#endif
|
||||
[activityIndicator startAnimating];
|
||||
indicator = activityIndicator;
|
||||
[self.bezelView addSubview:indicator];
|
||||
}
|
||||
}
|
||||
@@ -408,7 +403,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
if (mode == MBProgressHUDModeAnnularDeterminate) {
|
||||
[(MBRoundProgressView *)indicator setAnnular:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mode == MBProgressHUDModeCustomView && self.customView != indicator) {
|
||||
// Update custom view indicator
|
||||
[indicator removeFromSuperview];
|
||||
@@ -440,13 +435,6 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
self.detailsLabel.textColor = color;
|
||||
[self.button setTitleColor:color forState:UIControlStateNormal];
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (self.activityIndicatorColor) {
|
||||
color = self.activityIndicatorColor;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// UIAppearance settings are prioritized. If they are preset the set color is ignored.
|
||||
|
||||
UIView *indicator = self.indicator;
|
||||
@@ -458,7 +446,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
// For iOS 9+
|
||||
appearance = [UIActivityIndicatorView appearanceWhenContainedInInstancesOfClasses:@[[MBProgressHUD class]]];
|
||||
#endif
|
||||
|
||||
|
||||
if (appearance.color == nil) {
|
||||
((UIActivityIndicatorView *)indicator).color = color;
|
||||
}
|
||||
@@ -489,20 +477,15 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
((MBBarProgressView *)indicator).lineColor = color;
|
||||
}
|
||||
} else {
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 || TARGET_OS_TV
|
||||
if ([indicator respondsToSelector:@selector(setTintColor:)]) {
|
||||
[indicator setTintColor:color];
|
||||
}
|
||||
#endif
|
||||
[indicator setTintColor:color];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateBezelMotionEffects {
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 || TARGET_OS_TV
|
||||
MBBackgroundView *bezelView = self.bezelView;
|
||||
if (![bezelView respondsToSelector:@selector(addMotionEffect:)]) return;
|
||||
UIMotionEffectGroup *bezelMotionEffects = self.bezelMotionEffects;
|
||||
|
||||
if (self.defaultMotionEffectsEnabled) {
|
||||
if (self.defaultMotionEffectsEnabled && !bezelMotionEffects) {
|
||||
CGFloat effectOffset = 10.f;
|
||||
UIInterpolatingMotionEffect *effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
|
||||
effectX.maximumRelativeValue = @(effectOffset);
|
||||
@@ -515,14 +498,12 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
UIMotionEffectGroup *group = [[UIMotionEffectGroup alloc] init];
|
||||
group.motionEffects = @[effectX, effectY];
|
||||
|
||||
self.bezelMotionEffects = group;
|
||||
[bezelView addMotionEffect:group];
|
||||
} else {
|
||||
NSArray *effects = [bezelView motionEffects];
|
||||
for (UIMotionEffect *effect in effects) {
|
||||
[bezelView removeMotionEffect:effect];
|
||||
}
|
||||
} else if (bezelMotionEffects) {
|
||||
self.bezelMotionEffects = nil;
|
||||
[bezelView removeMotionEffect:bezelMotionEffects];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma mark - Layout
|
||||
@@ -610,10 +591,10 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
[bezel addConstraints:bezelConstraints];
|
||||
self.bezelConstraints = bezelConstraints;
|
||||
|
||||
|
||||
self.paddingConstraints = [paddingConstraints copy];
|
||||
[self updatePaddingConstraints];
|
||||
|
||||
|
||||
[super updateConstraints];
|
||||
}
|
||||
|
||||
@@ -698,9 +679,9 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
- (void)setProgressObjectDisplayLink:(CADisplayLink *)progressObjectDisplayLink {
|
||||
if (progressObjectDisplayLink != _progressObjectDisplayLink) {
|
||||
[_progressObjectDisplayLink invalidate];
|
||||
|
||||
|
||||
_progressObjectDisplayLink = progressObjectDisplayLink;
|
||||
|
||||
|
||||
[_progressObjectDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
}
|
||||
@@ -758,7 +739,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
#pragma mark - Notifications
|
||||
|
||||
- (void)registerForNotifications {
|
||||
#if !TARGET_OS_TV
|
||||
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc addObserver:self selector:@selector(statusBarOrientationDidChange:)
|
||||
@@ -767,13 +748,13 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
}
|
||||
|
||||
- (void)unregisterFromNotifications {
|
||||
#if !TARGET_OS_TV
|
||||
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
|
||||
- (void)statusBarOrientationDidChange:(NSNotification *)notification {
|
||||
UIView *superview = self.superview;
|
||||
if (!superview) {
|
||||
@@ -805,7 +786,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
UIInterfaceOrientation orientation = application.statusBarOrientation;
|
||||
CGFloat radians = 0;
|
||||
|
||||
|
||||
if (UIInterfaceOrientationIsLandscape(orientation)) {
|
||||
radians = orientation == UIInterfaceOrientationLandscapeLeft ? -(CGFloat)M_PI_2 : (CGFloat)M_PI_2;
|
||||
// Window coordinates differ!
|
||||
@@ -883,11 +864,10 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
BOOL isPreiOS7 = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0;
|
||||
|
||||
if (_annular) {
|
||||
// Draw background
|
||||
CGFloat lineWidth = isPreiOS7 ? 5.f : 2.f;
|
||||
CGFloat lineWidth = 2.f;
|
||||
UIBezierPath *processBackgroundPath = [UIBezierPath bezierPath];
|
||||
processBackgroundPath.lineWidth = lineWidth;
|
||||
processBackgroundPath.lineCapStyle = kCGLineCapButt;
|
||||
@@ -900,7 +880,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
[processBackgroundPath stroke];
|
||||
// Draw progress
|
||||
UIBezierPath *processPath = [UIBezierPath bezierPath];
|
||||
processPath.lineCapStyle = isPreiOS7 ? kCGLineCapRound : kCGLineCapSquare;
|
||||
processPath.lineCapStyle = kCGLineCapSquare;
|
||||
processPath.lineWidth = lineWidth;
|
||||
endAngle = (self.progress * 2 * (float)M_PI) + startAngle;
|
||||
[processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
@@ -915,33 +895,20 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
[_progressTintColor setStroke];
|
||||
[_backgroundTintColor setFill];
|
||||
CGContextSetLineWidth(context, lineWidth);
|
||||
if (isPreiOS7) {
|
||||
CGContextFillEllipseInRect(context, circleRect);
|
||||
}
|
||||
CGContextStrokeEllipseInRect(context, circleRect);
|
||||
// 90 degrees
|
||||
CGFloat startAngle = - ((float)M_PI / 2.f);
|
||||
// Draw progress
|
||||
if (isPreiOS7) {
|
||||
CGFloat radius = (CGRectGetWidth(self.bounds) / 2.f) - lineWidth;
|
||||
CGFloat endAngle = (self.progress * 2.f * (float)M_PI) + startAngle;
|
||||
[_progressTintColor setFill];
|
||||
CGContextMoveToPoint(context, center.x, center.y);
|
||||
CGContextAddArc(context, center.x, center.y, radius, startAngle, endAngle, 0);
|
||||
CGContextClosePath(context);
|
||||
CGContextFillPath(context);
|
||||
} else {
|
||||
UIBezierPath *processPath = [UIBezierPath bezierPath];
|
||||
processPath.lineCapStyle = kCGLineCapButt;
|
||||
processPath.lineWidth = lineWidth * 2.f;
|
||||
CGFloat radius = (CGRectGetWidth(self.bounds) / 2.f) - (processPath.lineWidth / 2.f);
|
||||
CGFloat endAngle = (self.progress * 2.f * (float)M_PI) + startAngle;
|
||||
[processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
// Ensure that we don't get color overlaping when _progressTintColor alpha < 1.f.
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
[_progressTintColor set];
|
||||
[processPath stroke];
|
||||
}
|
||||
UIBezierPath *processPath = [UIBezierPath bezierPath];
|
||||
processPath.lineCapStyle = kCGLineCapButt;
|
||||
processPath.lineWidth = lineWidth * 2.f;
|
||||
CGFloat radius = (CGRectGetWidth(self.bounds) / 2.f) - (processPath.lineWidth / 2.f);
|
||||
CGFloat endAngle = (self.progress * 2.f * (float)M_PI) + startAngle;
|
||||
[processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
// Ensure that we don't get color overlapping when _progressTintColor alpha < 1.f.
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
[_progressTintColor set];
|
||||
[processPath stroke];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,8 +939,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
#pragma mark - Layout
|
||||
|
||||
- (CGSize)intrinsicContentSize {
|
||||
BOOL isPreiOS7 = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0;
|
||||
return CGSizeMake(120.f, isPreiOS7 ? 20.f : 10.f);
|
||||
return CGSizeMake(120.f, 10.f);
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
@@ -1005,51 +971,39 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
|
||||
CGContextSetLineWidth(context, 2);
|
||||
CGContextSetStrokeColorWithColor(context,[_lineColor CGColor]);
|
||||
CGContextSetFillColorWithColor(context, [_progressRemainingColor CGColor]);
|
||||
|
||||
// Draw background
|
||||
|
||||
// Draw background and Border
|
||||
CGFloat radius = (rect.size.height / 2) - 2;
|
||||
CGContextMoveToPoint(context, 2, rect.size.height/2);
|
||||
CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius);
|
||||
CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2);
|
||||
CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius);
|
||||
CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius);
|
||||
CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2);
|
||||
CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius);
|
||||
CGContextFillPath(context);
|
||||
|
||||
// Draw border
|
||||
CGContextMoveToPoint(context, 2, rect.size.height/2);
|
||||
CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius);
|
||||
CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2);
|
||||
CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius);
|
||||
CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius);
|
||||
CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2);
|
||||
CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius);
|
||||
CGContextStrokePath(context);
|
||||
|
||||
CGContextDrawPath(context, kCGPathFillStroke);
|
||||
|
||||
CGContextSetFillColorWithColor(context, [_progressColor CGColor]);
|
||||
radius = radius - 2;
|
||||
CGFloat amount = self.progress * rect.size.width;
|
||||
|
||||
|
||||
// Progress in the middle area
|
||||
if (amount >= radius + 4 && amount <= (rect.size.width - radius - 4)) {
|
||||
CGContextMoveToPoint(context, 4, rect.size.height/2);
|
||||
CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);
|
||||
CGContextAddLineToPoint(context, amount, 4);
|
||||
CGContextAddLineToPoint(context, amount, radius + 4);
|
||||
|
||||
|
||||
CGContextMoveToPoint(context, 4, rect.size.height/2);
|
||||
CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);
|
||||
CGContextAddLineToPoint(context, amount, rect.size.height - 4);
|
||||
CGContextAddLineToPoint(context, amount, radius + 4);
|
||||
|
||||
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
|
||||
|
||||
// Progress in the right arc
|
||||
else if (amount > radius + 4) {
|
||||
CGFloat x = amount - (rect.size.width - radius - 4);
|
||||
@@ -1069,10 +1023,10 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
if (isnan(angle)) angle = 0;
|
||||
CGContextAddArc(context, rect.size.width - radius - 4, rect.size.height/2, radius, -M_PI, angle, 1);
|
||||
CGContextAddLineToPoint(context, amount, rect.size.height/2);
|
||||
|
||||
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
|
||||
|
||||
// Progress is in the left arc
|
||||
else if (amount < radius + 4 && amount > 0) {
|
||||
CGContextMoveToPoint(context, 4, rect.size.height/2);
|
||||
@@ -1082,7 +1036,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
CGContextMoveToPoint(context, 4, rect.size.height/2);
|
||||
CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);
|
||||
CGContextAddLineToPoint(context, radius + 4, rect.size.height/2);
|
||||
|
||||
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
}
|
||||
@@ -1092,12 +1046,7 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
@interface MBBackgroundView ()
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
|
||||
@property UIVisualEffectView *effectView;
|
||||
#endif
|
||||
#if !TARGET_OS_TV
|
||||
@property UIToolbar *toolbar;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@@ -1108,16 +1057,17 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
|
||||
_style = MBProgressHUDBackgroundStyleBlur;
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
|
||||
_color = [UIColor colorWithWhite:0.8f alpha:0.6f];
|
||||
} else {
|
||||
_color = [UIColor colorWithWhite:0.95f alpha:0.6f];
|
||||
}
|
||||
_style = MBProgressHUDBackgroundStyleBlur;
|
||||
if (@available(iOS 13.0, *)) {
|
||||
#if TARGET_OS_TV
|
||||
_blurEffectStyle = UIBlurEffectStyleRegular;
|
||||
#else
|
||||
_blurEffectStyle = UIBlurEffectStyleSystemThickMaterial;
|
||||
#endif
|
||||
// Leaving the color unassigned yields best results.
|
||||
} else {
|
||||
_style = MBProgressHUDBackgroundStyleSolidColor;
|
||||
_color = [[UIColor blackColor] colorWithAlphaComponent:0.8];
|
||||
_blurEffectStyle = UIBlurEffectStyleLight;
|
||||
_color = [UIColor colorWithWhite:0.8f alpha:0.6f];
|
||||
}
|
||||
|
||||
self.clipsToBounds = YES;
|
||||
@@ -1137,9 +1087,6 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
#pragma mark - Appearance
|
||||
|
||||
- (void)setStyle:(MBProgressHUDBackgroundStyle)style {
|
||||
if (style == MBProgressHUDBackgroundStyleBlur && kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0) {
|
||||
style = MBProgressHUDBackgroundStyleSolidColor;
|
||||
}
|
||||
if (_style != style) {
|
||||
_style = style;
|
||||
[self updateForBackgroundStyle];
|
||||
@@ -1154,62 +1101,41 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setBlurEffectStyle:(UIBlurEffectStyle)blurEffectStyle {
|
||||
if (_blurEffectStyle == blurEffectStyle) {
|
||||
return;
|
||||
}
|
||||
|
||||
_blurEffectStyle = blurEffectStyle;
|
||||
|
||||
[self updateForBackgroundStyle];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark - Views
|
||||
|
||||
- (void)updateForBackgroundStyle {
|
||||
[self.effectView removeFromSuperview];
|
||||
self.effectView = nil;
|
||||
|
||||
MBProgressHUDBackgroundStyle style = self.style;
|
||||
if (style == MBProgressHUDBackgroundStyleBlur) {
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
|
||||
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
|
||||
[self addSubview:effectView];
|
||||
effectView.frame = self.bounds;
|
||||
effectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
self.backgroundColor = self.color;
|
||||
self.layer.allowsGroupOpacity = NO;
|
||||
self.effectView = effectView;
|
||||
} else {
|
||||
#endif
|
||||
#if !TARGET_OS_TV
|
||||
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectInset(self.bounds, -100.f, -100.f)];
|
||||
toolbar.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
toolbar.barTintColor = self.color;
|
||||
toolbar.translucent = YES;
|
||||
[self addSubview:toolbar];
|
||||
self.toolbar = toolbar;
|
||||
#endif
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
|
||||
}
|
||||
#endif
|
||||
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:self.blurEffectStyle];
|
||||
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
|
||||
[self insertSubview:effectView atIndex:0];
|
||||
effectView.frame = self.bounds;
|
||||
effectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
self.backgroundColor = self.color;
|
||||
self.layer.allowsGroupOpacity = NO;
|
||||
self.effectView = effectView;
|
||||
} else {
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
|
||||
[self.effectView removeFromSuperview];
|
||||
self.effectView = nil;
|
||||
} else {
|
||||
#endif
|
||||
#if !TARGET_OS_TV
|
||||
[self.toolbar removeFromSuperview];
|
||||
self.toolbar = nil;
|
||||
#endif
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
|
||||
}
|
||||
#endif
|
||||
self.backgroundColor = self.color;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateViewsForColor:(UIColor *)color {
|
||||
if (self.style == MBProgressHUDBackgroundStyleBlur) {
|
||||
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
|
||||
self.backgroundColor = self.color;
|
||||
} else {
|
||||
#if !TARGET_OS_TV
|
||||
self.toolbar.barTintColor = color;
|
||||
#endif
|
||||
}
|
||||
self.backgroundColor = self.color;
|
||||
} else {
|
||||
self.backgroundColor = self.color;
|
||||
}
|
||||
@@ -1218,226 +1144,6 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
@end
|
||||
|
||||
|
||||
@implementation MBProgressHUD (Deprecated)
|
||||
|
||||
#pragma mark - Class
|
||||
|
||||
+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated {
|
||||
NSArray *huds = [MBProgressHUD allHUDsForView:view];
|
||||
for (MBProgressHUD *hud in huds) {
|
||||
hud.removeFromSuperViewOnHide = YES;
|
||||
[hud hideAnimated:animated];
|
||||
}
|
||||
return [huds count];
|
||||
}
|
||||
|
||||
+ (NSArray *)allHUDsForView:(UIView *)view {
|
||||
NSMutableArray *huds = [NSMutableArray array];
|
||||
NSArray *subviews = view.subviews;
|
||||
for (UIView *aView in subviews) {
|
||||
if ([aView isKindOfClass:self]) {
|
||||
[huds addObject:aView];
|
||||
}
|
||||
}
|
||||
return [NSArray arrayWithArray:huds];
|
||||
}
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (id)initWithWindow:(UIWindow *)window {
|
||||
return [self initWithView:window];
|
||||
}
|
||||
|
||||
#pragma mark - Show & hide
|
||||
|
||||
- (void)show:(BOOL)animated {
|
||||
[self showAnimated:animated];
|
||||
}
|
||||
|
||||
- (void)hide:(BOOL)animated {
|
||||
[self hideAnimated:animated];
|
||||
}
|
||||
|
||||
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay {
|
||||
[self hideAnimated:animated afterDelay:delay];
|
||||
}
|
||||
|
||||
#pragma mark - Threading
|
||||
|
||||
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated {
|
||||
[self showAnimated:animated whileExecutingBlock:^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
// Start executing the requested task
|
||||
[target performSelector:method withObject:object];
|
||||
#pragma clang diagnostic pop
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block {
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
[self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL];
|
||||
}
|
||||
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(void (^)())completion {
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
[self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:completion];
|
||||
}
|
||||
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue {
|
||||
[self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL];
|
||||
}
|
||||
|
||||
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue completionBlock:(nullable MBProgressHUDCompletionBlock)completion {
|
||||
self.taskInProgress = YES;
|
||||
self.completionBlock = completion;
|
||||
dispatch_async(queue, ^(void) {
|
||||
block();
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
||||
[self cleanUp];
|
||||
});
|
||||
});
|
||||
[self showAnimated:animated];
|
||||
}
|
||||
|
||||
- (void)cleanUp {
|
||||
self.taskInProgress = NO;
|
||||
[self hideAnimated:self.useAnimation];
|
||||
}
|
||||
|
||||
#pragma mark - Labels
|
||||
|
||||
- (NSString *)labelText {
|
||||
return self.label.text;
|
||||
}
|
||||
|
||||
- (void)setLabelText:(NSString *)labelText {
|
||||
MBMainThreadAssert();
|
||||
self.label.text = labelText;
|
||||
}
|
||||
|
||||
- (UIFont *)labelFont {
|
||||
return self.label.font;
|
||||
}
|
||||
|
||||
- (void)setLabelFont:(UIFont *)labelFont {
|
||||
MBMainThreadAssert();
|
||||
self.label.font = labelFont;
|
||||
}
|
||||
|
||||
- (UIColor *)labelColor {
|
||||
return self.label.textColor;
|
||||
}
|
||||
|
||||
- (void)setLabelColor:(UIColor *)labelColor {
|
||||
MBMainThreadAssert();
|
||||
self.label.textColor = labelColor;
|
||||
}
|
||||
|
||||
- (NSString *)detailsLabelText {
|
||||
return self.detailsLabel.text;
|
||||
}
|
||||
|
||||
- (void)setDetailsLabelText:(NSString *)detailsLabelText {
|
||||
MBMainThreadAssert();
|
||||
self.detailsLabel.text = detailsLabelText;
|
||||
}
|
||||
|
||||
- (UIFont *)detailsLabelFont {
|
||||
return self.detailsLabel.font;
|
||||
}
|
||||
|
||||
- (void)setDetailsLabelFont:(UIFont *)detailsLabelFont {
|
||||
MBMainThreadAssert();
|
||||
self.detailsLabel.font = detailsLabelFont;
|
||||
}
|
||||
|
||||
- (UIColor *)detailsLabelColor {
|
||||
return self.detailsLabel.textColor;
|
||||
}
|
||||
|
||||
- (void)setDetailsLabelColor:(UIColor *)detailsLabelColor {
|
||||
MBMainThreadAssert();
|
||||
self.detailsLabel.textColor = detailsLabelColor;
|
||||
}
|
||||
|
||||
- (CGFloat)opacity {
|
||||
return _opacity;
|
||||
}
|
||||
|
||||
- (void)setOpacity:(CGFloat)opacity {
|
||||
MBMainThreadAssert();
|
||||
_opacity = opacity;
|
||||
}
|
||||
|
||||
- (UIColor *)color {
|
||||
return self.bezelView.color;
|
||||
}
|
||||
|
||||
- (void)setColor:(UIColor *)color {
|
||||
MBMainThreadAssert();
|
||||
self.bezelView.color = color;
|
||||
}
|
||||
|
||||
- (CGFloat)yOffset {
|
||||
return self.offset.y;
|
||||
}
|
||||
|
||||
- (void)setYOffset:(CGFloat)yOffset {
|
||||
MBMainThreadAssert();
|
||||
self.offset = CGPointMake(self.offset.x, yOffset);
|
||||
}
|
||||
|
||||
- (CGFloat)xOffset {
|
||||
return self.offset.x;
|
||||
}
|
||||
|
||||
- (void)setXOffset:(CGFloat)xOffset {
|
||||
MBMainThreadAssert();
|
||||
self.offset = CGPointMake(xOffset, self.offset.y);
|
||||
}
|
||||
|
||||
- (CGFloat)cornerRadius {
|
||||
return self.bezelView.layer.cornerRadius;
|
||||
}
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)cornerRadius {
|
||||
MBMainThreadAssert();
|
||||
self.bezelView.layer.cornerRadius = cornerRadius;
|
||||
}
|
||||
|
||||
- (BOOL)dimBackground {
|
||||
MBBackgroundView *backgroundView = self.backgroundView;
|
||||
UIColor *dimmedColor = [UIColor colorWithWhite:0.f alpha:.2f];
|
||||
return backgroundView.style == MBProgressHUDBackgroundStyleSolidColor && [backgroundView.color isEqual:dimmedColor];
|
||||
}
|
||||
|
||||
- (void)setDimBackground:(BOOL)dimBackground {
|
||||
MBMainThreadAssert();
|
||||
self.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor;
|
||||
self.backgroundView.color = dimBackground ? [UIColor colorWithWhite:0.f alpha:.2f] : [UIColor clearColor];
|
||||
}
|
||||
|
||||
- (CGSize)size {
|
||||
return self.bezelView.frame.size;
|
||||
}
|
||||
|
||||
- (UIColor *)activityIndicatorColor {
|
||||
return _activityIndicatorColor;
|
||||
}
|
||||
|
||||
- (void)setActivityIndicatorColor:(UIColor *)activityIndicatorColor {
|
||||
if (activityIndicatorColor != _activityIndicatorColor) {
|
||||
_activityIndicatorColor = activityIndicatorColor;
|
||||
UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)self.indicator;
|
||||
if ([indicator isKindOfClass:[UIActivityIndicatorView class]]) {
|
||||
[indicator setColor:activityIndicatorColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MBProgressHUDRoundedButton
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
@@ -1461,8 +1167,9 @@ static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
|
||||
}
|
||||
|
||||
- (CGSize)intrinsicContentSize {
|
||||
// Only show if we have associated control events
|
||||
if (self.allControlEvents == 0) return CGSizeZero;
|
||||
// Only show if we have associated control events and a title
|
||||
if ((self.allControlEvents == 0) || ([self titleForState:UIControlStateNormal].length == 0))
|
||||
return CGSizeZero;
|
||||
CGSize size = [super intrinsicContentSize];
|
||||
// Add some side padding
|
||||
size.width += 20.f;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "MBProgressHUD"
|
||||
s.version = "1.0.0"
|
||||
s.version = "1.2.0"
|
||||
s.summary = "An iOS activity indicator view."
|
||||
s.description = <<-DESC
|
||||
MBProgressHUD is an iOS drop-in class that displays a translucent HUD
|
||||
with an indicator and/or labels while work is being done in a background thread.
|
||||
The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD
|
||||
MBProgressHUD is an iOS drop-in class that displays a translucent HUD
|
||||
with an indicator and/or labels while work is being done in a background thread.
|
||||
The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD
|
||||
with some additional features.
|
||||
DESC
|
||||
s.homepage = "http://www.bukovinski.com"
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'Matej Bukovinski' => 'matej@bukovinski.com' }
|
||||
s.source = { :git => "https://github.com/matej/MBProgressHUD.git", :tag => s.version.to_s }
|
||||
s.ios.deployment_target = '6.0'
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.source_files = '*.{h,m}'
|
||||
s.frameworks = "CoreGraphics", "QuartzCore"
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1315DD7617804CBC0032507D /* MBProgressHUD.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = D286A7511518C70F00E13FB8 /* MBProgressHUD.h */; };
|
||||
1777D3E71D757B690037C7F1 /* MBProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = D286A7511518C70F00E13FB8 /* MBProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
1777D3E81D757B6E0037C7F1 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D286A7521518C70F00E13FB8 /* MBProgressHUD.m */; };
|
||||
1D104D931ACA371400973364 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D286A7521518C70F00E13FB8 /* MBProgressHUD.m */; };
|
||||
1D104D941ACA373100973364 /* MBProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = D286A7511518C70F00E13FB8 /* MBProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D286A74D1518C70F00E13FB8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D286A74C1518C70F00E13FB8 /* Foundation.framework */; };
|
||||
@@ -31,6 +33,8 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1315DD73178045000032507D /* MBProgressHUD-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD-Prefix.pch"; sourceTree = SOURCE_ROOT; };
|
||||
1777D3DF1D757AF50037C7F1 /* MBProgressHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MBProgressHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1777D3E21D757AF50037C7F1 /* Framework-tvOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Framework-tvOS-Info.plist"; sourceTree = SOURCE_ROOT; };
|
||||
1D104D7A1ACA36CC00973364 /* MBProgressHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MBProgressHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1D104D951ACA376200973364 /* Framework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Framework-Info.plist"; sourceTree = SOURCE_ROOT; };
|
||||
D286A7491518C70F00E13FB8 /* libMBProgressHUD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMBProgressHUD.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -42,6 +46,13 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
1777D3DB1D757AF50037C7F1 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D104D761ACA36CC00973364 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -66,6 +77,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D104D951ACA376200973364 /* Framework-Info.plist */,
|
||||
1777D3E21D757AF50037C7F1 /* Framework-tvOS-Info.plist */,
|
||||
1315DD73178045000032507D /* MBProgressHUD-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
@@ -85,6 +97,7 @@
|
||||
children = (
|
||||
D286A7491518C70F00E13FB8 /* libMBProgressHUD.a */,
|
||||
1D104D7A1ACA36CC00973364 /* MBProgressHUD.framework */,
|
||||
1777D3DF1D757AF50037C7F1 /* MBProgressHUD.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -106,12 +119,20 @@
|
||||
D286A7521518C70F00E13FB8 /* MBProgressHUD.m */,
|
||||
1315DD72178044770032507D /* Supporting Files */,
|
||||
);
|
||||
path = MBProgressHUD;
|
||||
name = MBProgressHUD;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
1777D3DC1D757AF50037C7F1 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1777D3E71D757B690037C7F1 /* MBProgressHUD.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D104D771ACA36CC00973364 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -123,6 +144,24 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
1777D3DE1D757AF50037C7F1 /* MBProgressHUD Framework tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1777D3E61D757AF50037C7F1 /* Build configuration list for PBXNativeTarget "MBProgressHUD Framework tvOS" */;
|
||||
buildPhases = (
|
||||
1777D3DA1D757AF50037C7F1 /* Sources */,
|
||||
1777D3DB1D757AF50037C7F1 /* Frameworks */,
|
||||
1777D3DC1D757AF50037C7F1 /* Headers */,
|
||||
1777D3DD1D757AF50037C7F1 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "MBProgressHUD Framework tvOS";
|
||||
productName = "MBProgressHUD Framework tvOS";
|
||||
productReference = 1777D3DF1D757AF50037C7F1 /* MBProgressHUD.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
1D104D791ACA36CC00973364 /* MBProgressHUD Framework */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1D104D8D1ACA36CC00973364 /* Build configuration list for PBXNativeTarget "MBProgressHUD Framework" */;
|
||||
@@ -165,9 +204,13 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = MB;
|
||||
LastUpgradeCheck = 0700;
|
||||
LastUpgradeCheck = 1120;
|
||||
ORGANIZATIONNAME = "Matej Bukovinski";
|
||||
TargetAttributes = {
|
||||
1777D3DE1D757AF50037C7F1 = {
|
||||
CreatedOnToolsVersion = 8.0;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
1D104D791ACA36CC00973364 = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
};
|
||||
@@ -175,10 +218,11 @@
|
||||
};
|
||||
buildConfigurationList = D286A7431518C70E00E13FB8 /* Build configuration list for PBXProject "MBProgressHUD" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = D286A73E1518C70E00E13FB8;
|
||||
productRefGroup = D286A74A1518C70F00E13FB8 /* Products */;
|
||||
@@ -187,11 +231,19 @@
|
||||
targets = (
|
||||
D286A7481518C70F00E13FB8 /* MBProgressHUD Static Library */,
|
||||
1D104D791ACA36CC00973364 /* MBProgressHUD Framework */,
|
||||
1777D3DE1D757AF50037C7F1 /* MBProgressHUD Framework tvOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
1777D3DD1D757AF50037C7F1 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D104D781ACA36CC00973364 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -202,6 +254,14 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
1777D3DA1D757AF50037C7F1 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1777D3E81D757B6E0037C7F1 /* MBProgressHUD.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D104D751ACA36CC00973364 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -221,6 +281,82 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1777D3E41D757AF50037C7F1 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = "Framework-tvOS-Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.matej.MBProgressHUD;
|
||||
PRODUCT_NAME = MBProgressHUD;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1777D3E51D757AF50037C7F1 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = "Framework-tvOS-Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.matej.MBProgressHUD;
|
||||
PRODUCT_NAME = MBProgressHUD;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1D104D8E1ACA36CC00973364 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -230,9 +366,11 @@
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
@@ -244,8 +382,8 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = "Framework-Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.matej.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = MBProgressHUD;
|
||||
@@ -265,10 +403,12 @@
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
@@ -277,8 +417,8 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = "Framework-Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.matej.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = MBProgressHUD;
|
||||
@@ -293,14 +433,25 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -322,7 +473,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -332,14 +483,25 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
@@ -353,7 +515,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -386,6 +548,15 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1777D3E61D757AF50037C7F1 /* Build configuration list for PBXNativeTarget "MBProgressHUD Framework tvOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1777D3E41D757AF50037C7F1 /* Debug */,
|
||||
1777D3E51D757AF50037C7F1 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1D104D8D1ACA36CC00973364 /* Build configuration list for PBXNativeTarget "MBProgressHUD Framework" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1777D3DE1D757AF50037C7F1"
|
||||
BuildableName = "MBProgressHUD.framework"
|
||||
BlueprintName = "MBProgressHUD Framework tvOS"
|
||||
ReferencedContainer = "container:MBProgressHUD.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1777D3DE1D757AF50037C7F1"
|
||||
BuildableName = "MBProgressHUD.framework"
|
||||
BlueprintName = "MBProgressHUD Framework tvOS"
|
||||
ReferencedContainer = "container:MBProgressHUD.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1777D3DE1D757AF50037C7F1"
|
||||
BuildableName = "MBProgressHUD.framework"
|
||||
BlueprintName = "MBProgressHUD Framework tvOS"
|
||||
ReferencedContainer = "container:MBProgressHUD.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -29,8 +29,6 @@
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -51,8 +49,6 @@
|
||||
ReferencedContainer = "container:MBProgressHUD.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -29,8 +29,6 @@
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -51,8 +49,6 @@
|
||||
ReferencedContainer = "container:MBProgressHUD.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,19 @@
|
||||
// swift-tools-version:4.2
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "MBProgressHUD",
|
||||
products: [
|
||||
.library(name: "MBProgressHUD", targets: ["MBProgressHUD"])
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "MBProgressHUD",
|
||||
dependencies: [],
|
||||
path: ".",
|
||||
exclude: ["Demo"],
|
||||
sources: ["MBProgressHUD.h", "MBProgressHUD.m"],
|
||||
publicHeadersPath: "include"
|
||||
)
|
||||
]
|
||||
)
|
||||
+31
-19
@@ -1,23 +1,23 @@
|
||||
# MBProgressHUD
|
||||
|
||||
[](https://travis-ci.org/matej/MBProgressHUD) [](https://codecov.io/github/matej/MBProgressHUD?branch=master)
|
||||
[](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) [](https://cocoapods.org/pods/MBProgressHUD) [](http://opensource.org/licenses/MIT)
|
||||
[](https://github.com/apple/swift-package-manager) [](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) [](https://github.com/JamitLabs/Accio) [](https://cocoapods.org/pods/MBProgressHUD) [](http://opensource.org/licenses/MIT)
|
||||
|
||||
`MBProgressHUD` is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private `UIKit` `UIProgressHUD` with some additional features.
|
||||
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737572/94a137a6-477f-11e7-9778-6266006f2dba.png)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737575/95178c6c-477f-11e7-8df9-03aeeca5d39d.png)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737578/95235920-477f-11e7-9968-9ecf506aba06.png)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737573/95048432-477f-11e7-8f1d-4d5736b10488.)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737580/954aff70-477f-11e7-9634-5802daea2dee.png)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737582/9552886c-477f-11e7-8e90-46acd9a8527c.png)
|
||||
[](https://cloud.githubusercontent.com/assets/91322/26737584/956392f6-477f-11e7-918f-717a42758156.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/1.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/2.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/3.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/4.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/5.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/6.png)
|
||||
[](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/7.png)
|
||||
|
||||
**NOTE:** The class has recently undegone a major rewrite. The old version is available in the [legacy](https://github.com/jdg/MBProgressHUD/tree/legacy) branch, should you need it.
|
||||
**NOTE:** The class has recently undergone a major rewrite. The old version is available in the [legacy](https://github.com/jdg/MBProgressHUD/tree/legacy) branch, should you need it.
|
||||
|
||||
## Requirements
|
||||
|
||||
`MBProgressHUD` works on iOS 6+ and requires ARC to build. It depends on the following Apple frameworks, which should already be included with most Xcode templates:
|
||||
`MBProgressHUD` works on iOS 9.0+. It depends on the following Apple frameworks, which should already be included with most Xcode templates:
|
||||
|
||||
* Foundation.framework
|
||||
* UIKit.framework
|
||||
@@ -31,16 +31,28 @@ You will need the latest developer tools in order to build `MBProgressHUD`. Old
|
||||
|
||||
[CocoaPods](http://cocoapods.org) is the recommended way to add MBProgressHUD to your project.
|
||||
|
||||
1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 1.0.0'`
|
||||
1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 1.2.0'`
|
||||
2. Install the pod(s) by running `pod install`.
|
||||
3. Include MBProgressHUD wherever you need it with `#import "MBProgressHUD.h"`.
|
||||
|
||||
### Carthage
|
||||
|
||||
1. Add MBProgressHUD to your Cartfile. e.g., `github "jdg/MBProgressHUD" ~> 1.0.0`
|
||||
1. Add MBProgressHUD to your Cartfile. e.g., `github "jdg/MBProgressHUD" ~> 1.2.0`
|
||||
2. Run `carthage update`
|
||||
3. Follow the rest of the [standard Carthage installation instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add MBProgressHUD to your project.
|
||||
|
||||
### SwiftPM / Accio
|
||||
|
||||
1. Add the following to your `Package.swift`:
|
||||
```swift
|
||||
.package(url: "https://github.com/jdg/MBProgressHUD.git", .upToNextMajor(from: "1.2.0")),
|
||||
```
|
||||
2. Next, add `MBProgressHUD` to your App targets dependencies like so:
|
||||
```swift
|
||||
.target(name: "App", dependencies: ["MBProgressHUD"]),
|
||||
```
|
||||
3. Then open your project in Xcode 11+ (SwiftPM) or run `accio update` (Accio).
|
||||
|
||||
### Source files
|
||||
|
||||
Alternatively you can directly add the `MBProgressHUD.h` and `MBProgressHUD.m` source files to your project.
|
||||
@@ -72,18 +84,18 @@ dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
|
||||
});
|
||||
```
|
||||
|
||||
You can add the HUD on any view or window. It is however a good idea to avoid adding the HUD to certain `UIKit` views with complex view hierarchies - like `UITableView` or `UICollectionView`. Those can mutate their subviews in unexpected ways and thereby break HUD display.
|
||||
You can add the HUD on any view or window. It is however a good idea to avoid adding the HUD to certain `UIKit` views with complex view hierarchies - like `UITableView` or `UICollectionView`. Those can mutate their subviews in unexpected ways and thereby break HUD display.
|
||||
|
||||
If you need to configure the HUD you can do this by using the MBProgressHUD reference that showHUDAddedTo:animated: returns.
|
||||
|
||||
```objective-c
|
||||
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
hud.mode = MBProgressHUDModeAnnularDeterminate;
|
||||
hud.labelText = @"Loading";
|
||||
hud.label.text = @"Loading";
|
||||
[self doSomethingInBackgroundWithProgressCallback:^(float progress) {
|
||||
hud.progress = progress;
|
||||
} completionCallback:^{
|
||||
[hud hide:YES];
|
||||
[hud hideAnimated:YES];
|
||||
}];
|
||||
```
|
||||
|
||||
@@ -92,14 +104,14 @@ You can also use a `NSProgress` object and MBProgressHUD will update itself when
|
||||
```objective-c
|
||||
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
hud.mode = MBProgressHUDModeAnnularDeterminate;
|
||||
hud.labelText = @"Loading";
|
||||
hud.label.text = @"Loading";
|
||||
NSProgress *progress = [self doSomethingInBackgroundCompletion:^{
|
||||
[hud hide:YES];
|
||||
[hud hideAnimated:YES];
|
||||
}];
|
||||
hud.progressObject = progress;
|
||||
```
|
||||
|
||||
UI updates should always be done on the main thread. Some MBProgressHUD setters are however considered "thread safe" and can be called from background threads. Those also include `setMode:`, `setCustomView:`, `setLabelText:`, `setLabelFont:`, `setDetailsLabelText:`, `setDetailsLabelFont:` and `setProgress:`.
|
||||
Keep in mind that UI updates, inclining calls to MBProgressHUD should always be done on the main thread.
|
||||
|
||||
If you need to run your long-running task in the main thread, you should perform it with a slight delay, so UIKit will have enough time to update the UI (i.e., draw the HUD) before you block the main thread with your task.
|
||||
|
||||
@@ -123,4 +135,4 @@ This code is distributed under the terms and conditions of the [MIT license](LIC
|
||||
|
||||
## Change-log
|
||||
|
||||
A brief summary of each MBProgressHUD release can be found in the [CHANGELOG](CHANGELOG.mdown).
|
||||
A brief summary of each MBProgressHUD release can be found in the [CHANGELOG](CHANGELOG.mdown).
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../MBProgressHUD.h
|
||||
@@ -0,0 +1,5 @@
|
||||
module MBProgressHUD {
|
||||
umbrella header "MBProgressHUD/MBProgressHUD.h"
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
Reference in New Issue
Block a user