mirror of
https://github.com/faroukbmiled/RyukGram.git
synced 2026-06-06 15:33:53 +02:00
modded scinsta with additional features and fixes for recent instagram version
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// JGProgressHUD-Defines.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 28.04.15.
|
||||
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
Positions of the HUD.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, JGProgressHUDPosition) {
|
||||
/** Center position. */
|
||||
JGProgressHUDPositionCenter = 0,
|
||||
/** Top left position. */
|
||||
JGProgressHUDPositionTopLeft,
|
||||
/** Top center position. */
|
||||
JGProgressHUDPositionTopCenter,
|
||||
/** Top right position. */
|
||||
JGProgressHUDPositionTopRight,
|
||||
/** Center left position. */
|
||||
JGProgressHUDPositionCenterLeft,
|
||||
/** Center right position. */
|
||||
JGProgressHUDPositionCenterRight,
|
||||
/** Bottom left position. */
|
||||
JGProgressHUDPositionBottomLeft,
|
||||
/** Bottom center position. */
|
||||
JGProgressHUDPositionBottomCenter,
|
||||
/** Bottom right position. */
|
||||
JGProgressHUDPositionBottomRight
|
||||
};
|
||||
|
||||
/**
|
||||
Appearance styles of the HUD.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, JGProgressHUDStyle) {
|
||||
/** Extra light HUD with dark elements. */
|
||||
JGProgressHUDStyleExtraLight = 0,
|
||||
/** Light HUD with dark elemets. */
|
||||
JGProgressHUDStyleLight,
|
||||
/** Dark HUD with light elements. */
|
||||
JGProgressHUDStyleDark,
|
||||
};
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
/**
|
||||
Interaction types.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) {
|
||||
/** Block all touches. No interaction behin the HUD is possible. */
|
||||
JGProgressHUDInteractionTypeBlockAllTouches = 0,
|
||||
/** Block touches on the HUD view. */
|
||||
JGProgressHUDInteractionTypeBlockTouchesOnHUDView,
|
||||
/** Block no touches. */
|
||||
JGProgressHUDInteractionTypeBlockNoTouches
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
Parallax Modes.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, JGProgressHUDParallaxMode) {
|
||||
/** Follows the device setting for parallax. If "Reduce Motion" is enabled, no parallax effect is added to the HUD, if "Reduce Motion" is disabled the HUD will have a parallax effect. This behaviour is only supported on iOS 8 and higher. */
|
||||
JGProgressHUDParallaxModeDevice = 0,
|
||||
/** Always adds a parallax effect to the HUD. Parallax is only supported on iOS 7 and higher. */
|
||||
JGProgressHUDParallaxModeAlwaysOn,
|
||||
/** Never adds a parallax effect to the HUD. */
|
||||
JGProgressHUDParallaxModeAlwaysOff
|
||||
};
|
||||
|
||||
#ifndef fequal
|
||||
/**
|
||||
Macro for safe floating point comparison (for internal use in JGProgressHUD).
|
||||
*/
|
||||
#define fequal(a,b) (fabs((a) - (b)) < FLT_EPSILON)
|
||||
#endif
|
||||
@@ -0,0 +1,310 @@
|
||||
//
|
||||
// JGProgressHUD.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUD-Defines.h"
|
||||
#import "JGProgressHUDShadow.h"
|
||||
#import "JGProgressHUDAnimation.h"
|
||||
#import "JGProgressHUDFadeAnimation.h"
|
||||
#import "JGProgressHUDFadeZoomAnimation.h"
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#import "JGProgressHUDErrorIndicatorView.h"
|
||||
#import "JGProgressHUDSuccessIndicatorView.h"
|
||||
#import "JGProgressHUDRingIndicatorView.h"
|
||||
#import "JGProgressHUDPieIndicatorView.h"
|
||||
#import "JGProgressHUDIndeterminateIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@protocol JGProgressHUDDelegate;
|
||||
|
||||
/**
|
||||
A HUD to indicate progress, success, error, warnings or other notifications to the user.
|
||||
@discussion @c JGProgressHUD respects its @c layoutMargins when positioning the HUD view. Additionally, on iOS 11 if @c insetsLayoutMarginsFromSafeArea is set to @c YES (default) the @c layoutMargins additionally contain the @c safeAreaInsets.
|
||||
@note Remember to call every method from the main thread! UIKit => main thread!
|
||||
@attention You may not add JGProgressHUD to a view which has an alpha value < 1.0 or to a view which is a subview of a view with an alpha value < 1.0.
|
||||
*/
|
||||
@interface JGProgressHUD : UIView
|
||||
|
||||
/**
|
||||
Designated initializer.
|
||||
@param style The appearance style of the HUD.
|
||||
*/
|
||||
- (instancetype __nonnull)initWithStyle:(JGProgressHUDStyle)style;
|
||||
|
||||
/**
|
||||
Convenience initializer.
|
||||
@param style The appearance style of the HUD.
|
||||
*/
|
||||
+ (instancetype __nonnull)progressHUDWithStyle:(JGProgressHUDStyle)style;
|
||||
|
||||
/**
|
||||
Convenience initializer. The HUD will dynamically change its style based on whether dark mode is enabled or not. When dark mode is on, the style will be JGProgressHUDStyleDark, when dark mode is off the style will be JGProgressHUDStyleExtraLight.
|
||||
*/
|
||||
- (instancetype __nonnull)initWithAutomaticStyle;
|
||||
|
||||
/**
|
||||
Convenience initializer. The HUD will dynamically change its style based on whether dark mode is enabled or not. When dark mode is on, the style will be JGProgressHUDStyleDark, when dark mode is off the style will be JGProgressHUDStyleExtraLight.
|
||||
*/
|
||||
+ (instancetype __nonnull)progressHUDWithAutomaticStyle;
|
||||
|
||||
/**
|
||||
The appearance style of the HUD.
|
||||
@b Default: JGProgressHUDStyleExtraLight.
|
||||
*/
|
||||
@property (nonatomic, assign) JGProgressHUDStyle style;
|
||||
|
||||
/** The view in which the HUD is presented. */
|
||||
@property (nonatomic, weak, readonly, nullable) UIView *targetView;
|
||||
|
||||
/**
|
||||
The delegate of the HUD.
|
||||
@sa JGProgressHUDDelegate.
|
||||
*/
|
||||
@property (nonatomic, weak, nullable) id <JGProgressHUDDelegate> delegate;
|
||||
|
||||
/** The actual HUD view visible on screen. You may add animations to this view. */
|
||||
@property (nonatomic, strong, readonly, nonnull) UIView *HUDView;
|
||||
|
||||
/**
|
||||
The content view inside the @c HUDView. If you want to add additional views to the HUD you should add them as subview to the @c contentView.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nonnull) UIView *contentView;
|
||||
|
||||
/**
|
||||
The label used to present text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label's @c frame or @c bounds.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nonnull) UILabel *textLabel;
|
||||
|
||||
/**
|
||||
The label used to present detail text on the HUD. Set the @c text or @c attributedText property of this label to change the displayed text. You may not change the label's @c frame or @c bounds.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nonnull) UILabel *detailTextLabel;
|
||||
|
||||
/**
|
||||
The indicator view. You can assign a custom subclass of @c JGProgressHUDIndicatorView to this property or one of the default indicator views (if you do so, you should assign it before showing the HUD). This value is optional.
|
||||
@b Default: JGProgressHUDIndeterminateIndicatorView.
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) JGProgressHUDIndicatorView *indicatorView;
|
||||
|
||||
/**
|
||||
The shadow cast by the @c HUDView. This value is optional. Setting this to @c nil means no shadow is cast by the HUD.
|
||||
@b Default: nil.
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) JGProgressHUDShadow *shadow;
|
||||
|
||||
/**
|
||||
The position of the HUD inside the hosting view's frame, or inside the specified frame.
|
||||
@b Default: JGProgressHUDPositionCenter
|
||||
*/
|
||||
@property (nonatomic, assign) JGProgressHUDPosition position;
|
||||
|
||||
/**
|
||||
The animation used for showing and dismissing the HUD.
|
||||
@b Default: JGProgressHUDFadeAnimation.
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) JGProgressHUDAnimation *animation;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
/**
|
||||
Interaction type of the HUD. Determines whether touches should be let through to the views behind the HUD.
|
||||
@sa JGProgressHUDInteractionType.
|
||||
@b Default: JGProgressHUDInteractionTypeBlockAllTouches.
|
||||
*/
|
||||
@property (nonatomic, assign) JGProgressHUDInteractionType interactionType;
|
||||
#endif
|
||||
|
||||
/**
|
||||
Parallax mode for the HUD. This setting determines whether the HUD should have a parallax (@c UIDeviceMotion) effect. This effect is controlled by device motion on iOS and remote touchpad panning gestures on tvOS.
|
||||
@sa JGProgressHUDParallaxMode.
|
||||
@b Default: JGProgressHUDParallaxModeDevice.
|
||||
*/
|
||||
@property (nonatomic, assign) JGProgressHUDParallaxMode parallaxMode;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
/**
|
||||
When this property is set to @c YES the HUD will try to become focused, which prevents interactions with the @c targetView. If set to @c NO the HUD will not become focused and interactions with @c targetView remain possible. Default: @c YES.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL wantsFocus;
|
||||
#endif
|
||||
|
||||
/**
|
||||
If the HUD should always have the same width and height.
|
||||
@b Default: NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL square;
|
||||
|
||||
/**
|
||||
Internally @c JGProgressHUD uses an @c UIVisualEffectView with a @c UIBlurEffect. A second @c UIVisualEffectView can be added on top of that with a @c UIVibrancyEffect which amplifies and adjusts the color of content layered behind the view, allowing content placed inside the contentView to become more vivid. This flag sets whether the @c UIVibrancyEffect should be used. Using the vibrancy effect can sometimes, depending on the contents of the display, result in a weird look (especially on iOS < 9.3).
|
||||
@b Default: NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL vibrancyEnabled;
|
||||
|
||||
/**
|
||||
The radius used for rounding the four corners of the HUD view.
|
||||
@b Default: 10.0.
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat cornerRadius;
|
||||
|
||||
/**
|
||||
Insets the contents of the HUD.
|
||||
@b Default: (20, 20, 20, 20).
|
||||
*/
|
||||
@property (nonatomic, assign) UIEdgeInsets contentInsets;
|
||||
|
||||
/**
|
||||
@return Whether the HUD is visible on screen.
|
||||
*/
|
||||
@property (nonatomic, assign, readonly, getter = isVisible) BOOL visible;
|
||||
|
||||
/**
|
||||
The progress to display using the @c progressIndicatorView. A change of this property is not animated. Use the @c setProgress:animated: method for an animated progress change.
|
||||
@b Default: 0.0.
|
||||
*/
|
||||
@property (nonatomic, assign) float progress;
|
||||
|
||||
/**
|
||||
Adjusts the current progress shown by the receiver, optionally animating the change.
|
||||
|
||||
The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.
|
||||
@param progress The new progress value.
|
||||
@param animated YES if the change should be animated, NO if the change should happen immediately.
|
||||
*/
|
||||
- (void)setProgress:(float)progress animated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
Specifies a minimum time that the HUD will be on-screen. Useful to prevent the HUD from flashing quickly on the screen when indeterminate tasks complete more quickly than expected.
|
||||
@b Default: 0.0.
|
||||
*/
|
||||
@property (nonatomic, assign) NSTimeInterval minimumDisplayTime;
|
||||
|
||||
/**
|
||||
Determines whether Voice Over announcements should be made upon displaying the HUD (if Voice Over is active).
|
||||
@b Default: YES
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL voiceOverEnabled;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
/**
|
||||
A block to be invoked when the HUD view is tapped.
|
||||
@note The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockTouchesOnHUDView or @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won't be fired.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) void (^tapOnHUDViewBlock)(JGProgressHUD *__nonnull HUD);
|
||||
|
||||
/**
|
||||
A block to be invoked when the area outside of the HUD view is tapped.
|
||||
@note The interaction type of the HUD must be @c JGProgressHUDInteractionTypeBlockAllTouches, otherwise this block won't be fired.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) void (^tapOutsideBlock)(JGProgressHUD *__nonnull HUD);
|
||||
#endif
|
||||
|
||||
/**
|
||||
Shows the HUD animated. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
|
||||
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
|
||||
*/
|
||||
- (void)showInView:(UIView *__nonnull)view;
|
||||
|
||||
/**
|
||||
Shows the HUD. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
|
||||
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
|
||||
@param animated If the HUD should show with an animation.
|
||||
*/
|
||||
- (void)showInView:(UIView *__nonnull)view animated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
Shows the HUD after a delay. You should preferably show the HUD in a UIViewController's view. The HUD will be repositioned in response to rotation and keyboard show/hide notifications.
|
||||
You may call @c dismiss to stop the HUD from appearing before the delay has passed.
|
||||
@param view The view to show the HUD in. The frame of the @c view will be used to calculate the position of the HUD.
|
||||
@param animated If the HUD should show with an animation.
|
||||
@param delay The delay until the HUD will be shown.
|
||||
*/
|
||||
- (void)showInView:(UIView *__nonnull)view animated:(BOOL)animated afterDelay:(NSTimeInterval)delay;
|
||||
|
||||
/** Dismisses the HUD animated. If the HUD is currently not visible this method does nothing. */
|
||||
- (void)dismiss;
|
||||
|
||||
/**
|
||||
Dismisses the HUD. If the HUD is currently not visible this method does nothing.
|
||||
@param animated If the HUD should dismiss with an animation.
|
||||
*/
|
||||
- (void)dismissAnimated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
Dismisses the HUD animated after a delay. If the HUD is currently not visible this method does nothing.
|
||||
@param delay The delay until the HUD will be dismissed.
|
||||
*/
|
||||
- (void)dismissAfterDelay:(NSTimeInterval)delay;
|
||||
|
||||
/**
|
||||
Dismisses the HUD after a delay. If the HUD is currently not visible this method does nothing.
|
||||
@param delay The delay until the HUD will be dismissed.
|
||||
@param animated If the HUD should dismiss with an animation.
|
||||
*/
|
||||
- (void)dismissAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
Dismisses the HUD after a delay and runs a block upon completion. If the HUD is currently not visible this method does nothing.
|
||||
@param delay The delay until the HUD will be dismissed.
|
||||
@param animated If the HUD should dismiss with an animation.
|
||||
@param dismissCompletion The block to execute after the HUD was dismissed.
|
||||
*/
|
||||
- (void)dismissAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated completion:(void (^_Nullable)(void))dismissCompletion;
|
||||
|
||||
/**
|
||||
Schedules the given block to be executed when this HUD disapears. If the HUD is currently not visible this method does nothing.
|
||||
@param dismissCompletion The block to execute after the HUD was dismissed. Multiple calls to this method cause the different blocks to be executed in FIFO order.
|
||||
*/
|
||||
- (void)performAfterDismiss:(void (^_Nonnull)(void))dismissCompletion;
|
||||
|
||||
@end
|
||||
|
||||
@interface JGProgressHUD (HUDManagement)
|
||||
|
||||
/**
|
||||
@param view The view to return all visible progress HUDs for.
|
||||
@return All visible progress HUDs in the view.
|
||||
*/
|
||||
+ (NSArray<JGProgressHUD *> *__nonnull)allProgressHUDsInView:(UIView *__nonnull)view;
|
||||
|
||||
/**
|
||||
@param view The view to return all visible progress HUDs for.
|
||||
@return All visible progress HUDs in the view and its subviews.
|
||||
*/
|
||||
+ (NSArray<JGProgressHUD *> *__nonnull)allProgressHUDsInViewHierarchy:(UIView *__nonnull)view;
|
||||
|
||||
@end
|
||||
|
||||
@protocol JGProgressHUDDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
Called before the HUD will appear.
|
||||
@param view The view in which the HUD is presented.
|
||||
*/
|
||||
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD willPresentInView:(UIView *__nonnull)view;
|
||||
|
||||
/**
|
||||
Called after the HUD appeared.
|
||||
@param view The view in which the HUD is presented.
|
||||
*/
|
||||
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD didPresentInView:(UIView *__nonnull)view;
|
||||
|
||||
/**
|
||||
Called before the HUD will disappear.
|
||||
@param view The view in which the HUD is presented and will be dismissed from.
|
||||
*/
|
||||
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD willDismissFromView:(UIView *__nonnull)view;
|
||||
|
||||
/**
|
||||
Called after the HUD has disappeared.
|
||||
@param view The view in which the HUD was presented and was be dismissed from.
|
||||
*/
|
||||
- (void)progressHUD:(JGProgressHUD *__nonnull)progressHUD didDismissFromView:(UIView *__nonnull)view;
|
||||
|
||||
@end
|
||||
Executable
+1234
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// JGProgressHUDAnimation.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class JGProgressHUD;
|
||||
|
||||
/**
|
||||
You may subclass this class to create a custom progress indicator view.
|
||||
*/
|
||||
@interface JGProgressHUDAnimation : NSObject
|
||||
|
||||
/** Convenience initializer. */
|
||||
+ (instancetype __nonnull)animation;
|
||||
|
||||
/** The HUD using this animation. */
|
||||
@property (nonatomic, weak, readonly, nullable) JGProgressHUD *progressHUD;
|
||||
|
||||
/**
|
||||
The @c progressHUD is hidden from screen with @c alpha = 1 and @c hidden = @c YES. Ideally, you should prepare the HUD for presentation, then set @c hidden to @c NO on the @c progressHUD and then perform the animation.
|
||||
@post Call @c animationFinished.
|
||||
*/
|
||||
- (void)show NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
The @c progressHUD wis visible on screen with @c alpha = 1 and @c hidden = @c NO. You should only perform the animation in this method, the @c progressHUD itself will take care of hiding itself and removing itself from superview.
|
||||
@post Call @c animationFinished.
|
||||
*/
|
||||
- (void)hide NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
@pre This method should only be called at the end of a @c show or @c hide animaiton.
|
||||
@attention ALWAYS call this method after completing a @c show or @c hide animation.
|
||||
*/
|
||||
- (void)animationFinished NS_REQUIRES_SUPER;
|
||||
|
||||
@end
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// JGProgressHUDAnimation.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDAnimation.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
@interface JGProgressHUD (Private)
|
||||
|
||||
- (void)animationDidFinish:(BOOL)presenting;
|
||||
|
||||
@end
|
||||
|
||||
@interface JGProgressHUDAnimation () {
|
||||
BOOL _presenting;
|
||||
}
|
||||
|
||||
@property (nonatomic, weak) JGProgressHUD *progressHUD;
|
||||
|
||||
@end
|
||||
|
||||
@implementation JGProgressHUDAnimation
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
+ (instancetype)animation {
|
||||
return [[self alloc] init];
|
||||
}
|
||||
|
||||
#pragma mark - Public methods
|
||||
|
||||
- (void)show {
|
||||
_presenting = YES;
|
||||
}
|
||||
|
||||
- (void)hide {
|
||||
_presenting = NO;
|
||||
}
|
||||
|
||||
- (void)animationFinished {
|
||||
[self.progressHUD animationDidFinish:_presenting];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// JGProgressHUDErrorIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.08.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDImageIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
An image indicator showing a cross, representing a failed operation.
|
||||
*/
|
||||
@interface JGProgressHUDErrorIndicatorView : JGProgressHUDImageIndicatorView
|
||||
|
||||
/**
|
||||
Default initializer for this class.
|
||||
*/
|
||||
- (instancetype __nonnull)init;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// JGProgressHUDErrorIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.08.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDErrorIndicatorView.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
static UIBezierPath *errorBezierPath() {
|
||||
static UIBezierPath *path;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
path = [UIBezierPath bezierPath];
|
||||
[path moveToPoint:CGPointMake(3, 3)];
|
||||
[path addLineToPoint:CGPointMake(30, 30)];
|
||||
[path moveToPoint:CGPointMake(30, 3)];
|
||||
[path addLineToPoint:CGPointMake(3, 30)];
|
||||
|
||||
[path setLineWidth:3];
|
||||
[path setLineJoinStyle:kCGLineJoinRound];
|
||||
[path setLineCapStyle:kCGLineCapRound];
|
||||
});
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@implementation JGProgressHUDErrorIndicatorView
|
||||
|
||||
- (instancetype)initWithContentView:(UIView *__unused)contentView {
|
||||
UIBezierPath *path = errorBezierPath();
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(33, 33), NO, 0.0);
|
||||
[[UIColor blackColor] setStroke];
|
||||
[path stroke];
|
||||
|
||||
UIImage *img = [UIGraphicsGetImageFromCurrentImageContext() imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
self = [super initWithImage:img];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
return [self initWithContentView:nil];
|
||||
}
|
||||
|
||||
- (void)updateAccessibility {
|
||||
self.accessibilityLabel = NSLocalizedString(@"Error",);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// JGProgressHUDFadeAnimation.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDAnimation.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
A simple fade animation that fades the HUD from alpha @c 0.0 to alpha @c 1.0.
|
||||
*/
|
||||
@interface JGProgressHUDFadeAnimation : JGProgressHUDAnimation
|
||||
|
||||
/**
|
||||
Duration of the animation.
|
||||
|
||||
@b Default: 0.4.
|
||||
*/
|
||||
@property (nonatomic, assign) NSTimeInterval duration;
|
||||
|
||||
/**
|
||||
Animation options
|
||||
|
||||
@b Default: UIViewAnimationOptionCurveEaseInOut.
|
||||
*/
|
||||
@property (nonatomic, assign) UIViewAnimationOptions animationOptions;
|
||||
|
||||
@end
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// JGProgressHUDFadeAnimation.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDFadeAnimation.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
@implementation JGProgressHUDFadeAnimation
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.duration = 0.4;
|
||||
self.animationOptions = UIViewAnimationOptionCurveEaseInOut;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setAnimationOptions:(UIViewAnimationOptions)animationOptions {
|
||||
_animationOptions = (animationOptions | UIViewAnimationOptionBeginFromCurrentState);
|
||||
}
|
||||
|
||||
#pragma mark - Showing
|
||||
|
||||
- (void)show {
|
||||
[super show];
|
||||
|
||||
self.progressHUD.alpha = 0.0;
|
||||
self.progressHUD.hidden = NO;
|
||||
|
||||
[UIView animateWithDuration:self.duration delay:0.0 options:self.animationOptions animations:^{
|
||||
self.progressHUD.alpha = 1.0;
|
||||
} completion:^(BOOL __unused finished) {
|
||||
[self animationFinished];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Hiding
|
||||
|
||||
- (void)hide {
|
||||
[super hide];
|
||||
|
||||
[UIView animateWithDuration:self.duration delay:0.0 options:self.animationOptions animations:^{
|
||||
self.progressHUD.alpha = 0.0;
|
||||
} completion:^(BOOL __unused finished) {
|
||||
[self animationFinished];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// JGProgressHUDFadeZoomAnimation.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDAnimation.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
An animation that fades in the HUD and expands the HUD from scale @c (0, 0) to a customizable scale, and finally to scale @c (1, 1), creating a bouncing effect.
|
||||
*/
|
||||
@interface JGProgressHUDFadeZoomAnimation : JGProgressHUDAnimation
|
||||
|
||||
/**
|
||||
Duration of the animation from or to the shrinked state.
|
||||
|
||||
@b Default: 0.2.
|
||||
*/
|
||||
@property (nonatomic, assign) NSTimeInterval shrinkAnimationDuaration;
|
||||
|
||||
/**
|
||||
Duration of the animation from or to the expanded state.
|
||||
|
||||
@b Default: 0.1.
|
||||
*/
|
||||
@property (nonatomic, assign) NSTimeInterval expandAnimationDuaration;
|
||||
|
||||
/**
|
||||
The scale to apply to the HUD when expanding.
|
||||
|
||||
@b Default: (1.1, 1.1).
|
||||
*/
|
||||
@property (nonatomic, assign) CGSize expandScale;
|
||||
|
||||
@end
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// JGProgressHUDFadeZoomAnimation.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDFadeZoomAnimation.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
@implementation JGProgressHUDFadeZoomAnimation
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.shrinkAnimationDuaration = 0.2;
|
||||
self.expandAnimationDuaration = 0.1;
|
||||
self.expandScale = CGSizeMake(1.1, 1.1);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Showing
|
||||
|
||||
- (void)show {
|
||||
[super show];
|
||||
|
||||
self.progressHUD.alpha = 0.0;
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(0.1, 0.1);
|
||||
|
||||
NSTimeInterval totalDuration = self.expandAnimationDuaration+self.shrinkAnimationDuaration;
|
||||
|
||||
self.progressHUD.hidden = NO;
|
||||
|
||||
[UIView animateWithDuration:totalDuration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut) animations:^{
|
||||
self.progressHUD.alpha = 1.0;
|
||||
} completion:nil];
|
||||
|
||||
[UIView animateWithDuration:self.shrinkAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) animations:^{
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(self.expandScale.width, self.expandScale.height);
|
||||
} completion:^(BOOL __unused _finished) {
|
||||
[UIView animateWithDuration:self.expandAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState) animations:^{
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformIdentity;
|
||||
} completion:^(BOOL __unused __finished) {
|
||||
[self animationFinished];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Hiding
|
||||
|
||||
- (void)hide {
|
||||
[super hide];
|
||||
|
||||
NSTimeInterval totalDuration = self.expandAnimationDuaration+self.shrinkAnimationDuaration;
|
||||
|
||||
[UIView animateWithDuration:totalDuration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut) animations:^{
|
||||
self.progressHUD.alpha = 0.0;
|
||||
} completion:nil];
|
||||
|
||||
[UIView animateWithDuration:self.expandAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) animations:^{
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(self.expandScale.width, self.expandScale.height);
|
||||
} completion:^(BOOL __unused _finished) {
|
||||
[UIView animateWithDuration:self.shrinkAnimationDuaration delay:0.0 options:(UIViewAnimationOptions)(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState) animations:^{
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformMakeScale(0.1, 0.1);
|
||||
} completion:^(BOOL __unused __finished) {
|
||||
self.progressHUD.HUDView.transform = CGAffineTransformIdentity;
|
||||
|
||||
[self animationFinished];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// JGProgressHUDImageIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 05.08.15.
|
||||
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
An indicator for displaying custom images. Supports animated images.
|
||||
|
||||
You may subclass this class to create a custom image indicator view.
|
||||
*/
|
||||
@interface JGProgressHUDImageIndicatorView : JGProgressHUDIndicatorView
|
||||
|
||||
/**
|
||||
Initializes the indicator view with an UIImageView showing the @c image.
|
||||
|
||||
@param image The image to show in the indicator view.
|
||||
*/
|
||||
- (instancetype __nonnull)initWithImage:(UIImage *__nonnull)image;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// JGProgressHUDImageIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 05.08.15.
|
||||
// Copyright (c) 2015 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDImageIndicatorView.h"
|
||||
|
||||
@implementation JGProgressHUDImageIndicatorView {
|
||||
BOOL _customizedTintColor;
|
||||
}
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image {
|
||||
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
|
||||
|
||||
self = [super initWithContentView:imageView];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
|
||||
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
|
||||
|
||||
if (!_customizedTintColor) {
|
||||
if (style == JGProgressHUDStyleDark) {
|
||||
self.tintColor = [UIColor whiteColor];
|
||||
}
|
||||
else {
|
||||
self.tintColor = [UIColor blackColor];
|
||||
}
|
||||
_customizedTintColor = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTintColor:(UIColor *)tintColor {
|
||||
[super setTintColor:tintColor];
|
||||
_customizedTintColor = YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// JGProgressHUDIndeterminateIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.07.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
An indeterminate progress indicator showing a @c UIActivityIndicatorView.
|
||||
*/
|
||||
@interface JGProgressHUDIndeterminateIndicatorView : JGProgressHUDIndicatorView
|
||||
|
||||
/**
|
||||
Set the color of the activity indicator view.
|
||||
@param color The color to apply to the activity indicator view.
|
||||
*/
|
||||
- (void)setColor:(UIColor *__nonnull)color;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// JGProgressHUDIndeterminateIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.07.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDIndeterminateIndicatorView.h"
|
||||
|
||||
#ifndef __IPHONE_13_0
|
||||
#define __IPHONE_13_0 130000
|
||||
#endif
|
||||
|
||||
@implementation JGProgressHUDIndeterminateIndicatorView
|
||||
|
||||
- (instancetype)init {
|
||||
UIActivityIndicatorView *activityIndicatorView;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
||||
if (@available(iOS 13, tvOS 13, *)) {
|
||||
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
|
||||
}
|
||||
else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
#else
|
||||
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
|
||||
#endif
|
||||
|
||||
[activityIndicatorView startAnimating];
|
||||
|
||||
self = [super initWithContentView:activityIndicatorView];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
|
||||
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
|
||||
|
||||
if (style != JGProgressHUDStyleDark) {
|
||||
self.color = [UIColor blackColor];
|
||||
}
|
||||
else {
|
||||
self.color = [UIColor whiteColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setColor:(UIColor *)color {
|
||||
[(UIActivityIndicatorView *)self.contentView setColor:color];
|
||||
}
|
||||
|
||||
- (void)updateAccessibility {
|
||||
self.accessibilityLabel = NSLocalizedString(@"Indeterminate progress",);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// JGProgressHUDIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUD-Defines.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/** You may subclass this class to create a custom progress indicator view. */
|
||||
@interface JGProgressHUDIndicatorView : UIView
|
||||
|
||||
/**
|
||||
Designated initializer for this class.
|
||||
|
||||
@param contentView The content view to place on the container view (the container is the JGProgressHUDIndicatorView).
|
||||
*/
|
||||
- (instancetype __nonnull)initWithContentView:(UIView *__nullable)contentView;
|
||||
|
||||
/** Use this method to set up the indicator view to fit the HUD style and vibrancy setting. This method is called by @c JGProgressHUD when the indicator view is added to the HUD and when the HUD's @c vibrancyEnabled property changes. This method may be called multiple times with different values. The default implementation does nothing. */
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled;
|
||||
|
||||
/** Ranges from 0.0 to 1.0. */
|
||||
@property (nonatomic, assign) float progress;
|
||||
|
||||
/**
|
||||
Adjusts the current progress shown by the receiver, optionally animating the change.
|
||||
|
||||
The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.
|
||||
|
||||
@param progress The new progress value.
|
||||
@param animated YES if the change should be animated, NO if the change should happen immediately.
|
||||
*/
|
||||
- (void)setProgress:(float)progress animated:(BOOL)animated;
|
||||
|
||||
/**
|
||||
The content view which displays the progress.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nullable) UIView *contentView;
|
||||
|
||||
/** Schedules an accessibility update on the next run loop. */
|
||||
- (void)setNeedsAccessibilityUpdate;
|
||||
|
||||
/**
|
||||
Runs @c updateAccessibility immediately if an accessibility update has been scheduled (through @c setNeedsAccessibilityUpdate) but has not executed yet.
|
||||
*/
|
||||
- (void)updateAccessibilityIfNeeded;
|
||||
|
||||
/**
|
||||
Override to set custom accessibility properties. This method gets called once when initializing the view and after calling @c setNeedsAccessibilityUpdate.
|
||||
*/
|
||||
- (void)updateAccessibility;
|
||||
|
||||
@end
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// JGProgressHUDIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
@interface JGProgressHUDIndicatorView () {
|
||||
BOOL _accessibilityUpdateScheduled;
|
||||
}
|
||||
|
||||
+ (void)runBlock:(void (^)(void))block;
|
||||
|
||||
@end
|
||||
|
||||
static void runOnNextRunLoop(void (^block)(void)) {
|
||||
[[NSRunLoop currentRunLoop] performSelector:@selector(runBlock:) target:[JGProgressHUDIndicatorView class] argument:(id)block order:0 modes:@[NSRunLoopCommonModes]];
|
||||
}
|
||||
|
||||
@implementation JGProgressHUDIndicatorView
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect __unused)frame {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
return [self initWithContentView:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithContentView:(UIView *)contentView {
|
||||
self = [super initWithFrame:(contentView ? contentView.frame : CGRectMake(0.0, 0.0, 50.0, 50.0))];
|
||||
if (self) {
|
||||
self.opaque = NO;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
self.isAccessibilityElement = YES;
|
||||
[self setNeedsAccessibilityUpdate];
|
||||
|
||||
if (contentView) {
|
||||
_contentView = contentView;
|
||||
|
||||
[self addSubview:self.contentView];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Setup
|
||||
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {}
|
||||
|
||||
#pragma mark - Accessibility
|
||||
|
||||
+ (void)runBlock:(void (^)(void))block {
|
||||
if (block != nil) {
|
||||
block();
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNeedsAccessibilityUpdate {
|
||||
if (!_accessibilityUpdateScheduled) {
|
||||
_accessibilityUpdateScheduled = YES;
|
||||
|
||||
runOnNextRunLoop(^{
|
||||
[self updateAccessibilityIfNeeded];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateAccessibilityIfNeeded {
|
||||
if (_accessibilityUpdateScheduled) {
|
||||
[self updateAccessibility];
|
||||
_accessibilityUpdateScheduled = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateAccessibility {
|
||||
self.accessibilityLabel = [NSLocalizedString(@"Loading",) stringByAppendingFormat:@" %.f %%", self.progress];
|
||||
}
|
||||
|
||||
#pragma mark - Getters & Setters
|
||||
|
||||
- (void)setProgress:(float)progress {
|
||||
[self setProgress:progress animated:NO];
|
||||
}
|
||||
|
||||
- (void)setProgress:(float)progress animated:(__unused BOOL)animated {
|
||||
if (fequal(self.progress, progress)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_progress = progress;
|
||||
|
||||
[self setNeedsAccessibilityUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// JGProgressHUDPieIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.07.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
A pie shaped determinate progress indicator.
|
||||
*/
|
||||
@interface JGProgressHUDPieIndicatorView : JGProgressHUDIndicatorView
|
||||
|
||||
/**
|
||||
Tint color of the Pie.
|
||||
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
|
||||
|
||||
@b Default: White for JGProgressHUDStyleDark, otherwise black.
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) UIColor *color;
|
||||
|
||||
/**
|
||||
The background fill color inside the pie.
|
||||
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
|
||||
|
||||
@b Default: Dark gray for JGProgressHUDStyleDark, otherwise light gray.
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) UIColor *fillColor;
|
||||
|
||||
@end
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// JGProgressHUDPieIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.07.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDPieIndicatorView.h"
|
||||
|
||||
@interface JGProgressHUDPieIndicatorLayer : CALayer
|
||||
|
||||
@property (nonatomic, assign) float progress;
|
||||
|
||||
@property (nonatomic, weak) UIColor *color;
|
||||
|
||||
@property (nonatomic, weak) UIColor *fillColor;
|
||||
|
||||
@end
|
||||
|
||||
@implementation JGProgressHUDPieIndicatorLayer
|
||||
|
||||
@dynamic progress, color, fillColor;
|
||||
|
||||
+ (BOOL)needsDisplayForKey:(NSString *)key {
|
||||
return ([key isEqualToString:@"progress"] || [key isEqualToString:@"color"] || [key isEqualToString:@"fillColor"] || [super needsDisplayForKey:key]);
|
||||
}
|
||||
|
||||
- (id <CAAction>)actionForKey:(NSString *)key {
|
||||
if ([key isEqualToString:@"progress"]) {
|
||||
CABasicAnimation *progressAnimation = [CABasicAnimation animation];
|
||||
progressAnimation.fromValue = [self.presentationLayer valueForKey:key];
|
||||
|
||||
progressAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
return progressAnimation;
|
||||
}
|
||||
|
||||
return [super actionForKey:key];
|
||||
}
|
||||
|
||||
- (void)drawInContext:(CGContextRef)ctx {
|
||||
UIGraphicsPushContext(ctx);
|
||||
|
||||
CGRect rect = self.bounds;
|
||||
|
||||
CGPoint center = CGPointMake(rect.origin.x + (CGFloat)floor(rect.size.width/2.0), rect.origin.y + (CGFloat)floor(rect.size.height/2.0));
|
||||
CGFloat lineWidth = 2.0;
|
||||
CGFloat radius = (CGFloat)floor(MIN(rect.size.width, rect.size.height)/2.0)-lineWidth;
|
||||
|
||||
UIBezierPath *borderPath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:0.0 endAngle:2.0*(CGFloat)M_PI clockwise:NO];
|
||||
|
||||
[borderPath setLineWidth:lineWidth];
|
||||
|
||||
if (self.fillColor) {
|
||||
[self.fillColor setFill];
|
||||
|
||||
[borderPath fill];
|
||||
}
|
||||
|
||||
[self.color set];
|
||||
|
||||
[borderPath stroke];
|
||||
|
||||
if (self.progress > 0.0) {
|
||||
UIBezierPath *processPath = [UIBezierPath bezierPath];
|
||||
|
||||
[processPath setLineWidth:radius];
|
||||
|
||||
CGFloat startAngle = -((CGFloat)M_PI/2.0);
|
||||
CGFloat endAngle = startAngle + 2.0 * (CGFloat)M_PI * self.progress;
|
||||
|
||||
[processPath addArcWithCenter:center radius:radius/2.0 startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
|
||||
[processPath stroke];
|
||||
}
|
||||
|
||||
UIGraphicsPopContext();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation JGProgressHUDPieIndicatorView
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super initWithContentView:nil];
|
||||
|
||||
if (self) {
|
||||
self.layer.contentsScale = [UIScreen mainScreen].scale;
|
||||
[self.layer setNeedsDisplay];
|
||||
|
||||
self.color = [UIColor clearColor];
|
||||
self.fillColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
- (instancetype)initWithContentView:(UIView *)contentView {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
#pragma mark - Getters & Setters
|
||||
|
||||
- (void)setColor:(UIColor *)tintColor {
|
||||
if ([tintColor isEqual:self.color]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_color = tintColor;
|
||||
|
||||
[(JGProgressHUDPieIndicatorLayer *)self.layer setColor:self.color];
|
||||
}
|
||||
|
||||
- (void)setFillColor:(UIColor *)fillColor {
|
||||
if ([fillColor isEqual:self.fillColor]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_fillColor = fillColor;
|
||||
|
||||
[(JGProgressHUDPieIndicatorLayer *)self.layer setFillColor:self.fillColor];
|
||||
}
|
||||
|
||||
- (void)setProgress:(float)progress animated:(BOOL)animated {
|
||||
if (fequal(self.progress, progress)) {
|
||||
return;
|
||||
}
|
||||
|
||||
[super setProgress:progress animated:animated];
|
||||
|
||||
[CATransaction begin];
|
||||
[CATransaction setAnimationDuration:(animated ? 0.3 : 0.0)];
|
||||
|
||||
[(JGProgressHUDPieIndicatorLayer *)self.layer setProgress:progress];
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
|
||||
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
|
||||
|
||||
if (style == JGProgressHUDStyleDark) {
|
||||
self.color = [UIColor colorWithWhite:1.0 alpha:1.0];
|
||||
self.fillColor = [UIColor colorWithWhite:0.2 alpha:1.0];
|
||||
}
|
||||
else {
|
||||
self.color = [UIColor blackColor];
|
||||
if (style == JGProgressHUDStyleLight) {
|
||||
self.fillColor = [UIColor colorWithWhite:0.85 alpha:1.0];
|
||||
}
|
||||
else {
|
||||
self.fillColor = [UIColor colorWithWhite:0.9 alpha:1.0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (Class)layerClass {
|
||||
return [JGProgressHUDPieIndicatorLayer class];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// JGProgressHUDRingIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
A ring shaped determinate progress indicator.
|
||||
*/
|
||||
@interface JGProgressHUDRingIndicatorView : JGProgressHUDIndicatorView
|
||||
|
||||
/**
|
||||
Background color of the ring.
|
||||
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
|
||||
|
||||
@b Default: Black for JGProgressHUDStyleDark, light gray otherwise.
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) UIColor *ringBackgroundColor;
|
||||
|
||||
/**
|
||||
Progress color of the progress ring.
|
||||
@attention Custom values need to be set after assigning the indicator view to @c JGProgressHUD's @c indicatorView property.
|
||||
|
||||
@b Default: White for JGProgressHUDStyleDark, otherwise black.
|
||||
*/
|
||||
@property (nonatomic, strong, nonnull) UIColor *ringColor;
|
||||
|
||||
/**
|
||||
Sets if the progress ring should have a rounded line cap.
|
||||
|
||||
@b Default: NO.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL roundProgressLine;
|
||||
|
||||
/**
|
||||
Width of the ring.
|
||||
|
||||
@b Default: 3.0.
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat ringWidth;
|
||||
|
||||
@end
|
||||
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
//
|
||||
// JGProgressHUDRingIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 20.7.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDRingIndicatorView.h"
|
||||
|
||||
|
||||
@interface JGProgressHUDRingIndicatorLayer : CALayer
|
||||
|
||||
@property (nonatomic, assign) float progress;
|
||||
|
||||
@property (nonatomic, weak) UIColor *ringColor;
|
||||
@property (nonatomic, weak) UIColor *ringBackgroundColor;
|
||||
|
||||
@property (nonatomic, assign) BOOL roundProgressLine;
|
||||
|
||||
@property (nonatomic, assign) CGFloat ringWidth;
|
||||
|
||||
@end
|
||||
|
||||
@implementation JGProgressHUDRingIndicatorLayer
|
||||
|
||||
@dynamic progress, ringBackgroundColor, ringColor, ringWidth, roundProgressLine;
|
||||
|
||||
+ (BOOL)needsDisplayForKey:(NSString *)key {
|
||||
return ([key isEqualToString:@"progress"] || [key isEqualToString:@"ringColor"] || [key isEqualToString:@"ringBackgroundColor"] || [key isEqualToString:@"roundProgressLine"] || [key isEqualToString:@"ringWidth"] || [super needsDisplayForKey:key]);
|
||||
}
|
||||
|
||||
- (id <CAAction>)actionForKey:(NSString *)key {
|
||||
if ([key isEqualToString:@"progress"]) {
|
||||
CABasicAnimation *progressAnimation = [CABasicAnimation animation];
|
||||
progressAnimation.fromValue = [self.presentationLayer valueForKey:key];
|
||||
|
||||
progressAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
return progressAnimation;
|
||||
}
|
||||
|
||||
return [super actionForKey:key];
|
||||
}
|
||||
|
||||
- (void)drawInContext:(CGContextRef)ctx {
|
||||
UIGraphicsPushContext(ctx);
|
||||
|
||||
CGRect rect = self.bounds;
|
||||
|
||||
CGPoint center = CGPointMake(rect.origin.x + (CGFloat)floor(rect.size.width/2.0), rect.origin.y + (CGFloat)floor(rect.size.height/2.0));
|
||||
CGFloat lineWidth = self.ringWidth;
|
||||
CGFloat radius = (CGFloat)floor(MIN(rect.size.width, rect.size.height)/2.0) - lineWidth;
|
||||
|
||||
//Background
|
||||
[self.ringBackgroundColor setStroke];
|
||||
|
||||
UIBezierPath *borderPath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:0.0 endAngle:2.0*(CGFloat)M_PI clockwise:NO];
|
||||
|
||||
[borderPath setLineWidth:lineWidth];
|
||||
[borderPath stroke];
|
||||
|
||||
//Progress
|
||||
[self.ringColor setStroke];
|
||||
|
||||
if (self.progress > 0.0) {
|
||||
UIBezierPath *processPath = [UIBezierPath bezierPath];
|
||||
|
||||
[processPath setLineWidth:lineWidth];
|
||||
[processPath setLineCapStyle:(self.roundProgressLine ? kCGLineCapRound : kCGLineCapSquare)];
|
||||
|
||||
CGFloat startAngle = -((CGFloat)M_PI / 2.0);
|
||||
CGFloat endAngle = startAngle + 2.0 * (CGFloat)M_PI * self.progress;
|
||||
|
||||
[processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
|
||||
[processPath stroke];
|
||||
}
|
||||
|
||||
UIGraphicsPopContext();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation JGProgressHUDRingIndicatorView
|
||||
|
||||
#pragma mark - Initializers
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super initWithContentView:nil];;
|
||||
|
||||
if (self) {
|
||||
self.layer.contentsScale = [UIScreen mainScreen].scale;
|
||||
[self.layer setNeedsDisplay];
|
||||
|
||||
self.ringWidth = 3.0;
|
||||
self.ringColor = [UIColor clearColor];
|
||||
self.ringBackgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithHUDStyle:(JGProgressHUDStyle)style {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
- (instancetype)initWithContentView:(UIView *)contentView {
|
||||
return [self init];
|
||||
}
|
||||
|
||||
#pragma mark - Getters & Setters
|
||||
|
||||
- (void)setRoundProgressLine:(BOOL)roundProgressLine {
|
||||
if (roundProgressLine == self.roundProgressLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
_roundProgressLine = roundProgressLine;
|
||||
|
||||
[(JGProgressHUDRingIndicatorLayer *)self.layer setRoundProgressLine:self.roundProgressLine];
|
||||
}
|
||||
|
||||
- (void)setRingColor:(UIColor *)tintColor {
|
||||
if ([tintColor isEqual:self.ringColor]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_ringColor = tintColor;
|
||||
|
||||
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingColor:self.ringColor];
|
||||
}
|
||||
|
||||
- (void)setRingBackgroundColor:(UIColor *)backgroundTintColor {
|
||||
if ([backgroundTintColor isEqual:self.ringBackgroundColor]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_ringBackgroundColor = backgroundTintColor;
|
||||
|
||||
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingBackgroundColor:self.ringBackgroundColor];
|
||||
}
|
||||
|
||||
- (void)setRingWidth:(CGFloat)ringWidth {
|
||||
if (fequal(ringWidth, self.ringWidth)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_ringWidth = ringWidth;
|
||||
|
||||
[(JGProgressHUDRingIndicatorLayer *)self.layer setRingWidth:self.ringWidth];
|
||||
}
|
||||
|
||||
- (void)setProgress:(float)progress animated:(BOOL)animated {
|
||||
if (fequal(self.progress, progress)) {
|
||||
return;
|
||||
}
|
||||
|
||||
[super setProgress:progress animated:animated];
|
||||
|
||||
[CATransaction begin];
|
||||
[CATransaction setAnimationDuration:(animated ? 0.3 : 0.0)];
|
||||
|
||||
[(JGProgressHUDRingIndicatorLayer *)self.layer setProgress:self.progress];
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
#pragma mark - Overrides
|
||||
|
||||
- (void)setUpForHUDStyle:(JGProgressHUDStyle)style vibrancyEnabled:(BOOL)vibrancyEnabled {
|
||||
[super setUpForHUDStyle:style vibrancyEnabled:vibrancyEnabled];
|
||||
|
||||
if (style == JGProgressHUDStyleDark) {
|
||||
self.ringColor = [UIColor colorWithWhite:1.0 alpha:1.0];
|
||||
self.ringBackgroundColor = [UIColor colorWithWhite:0.0 alpha:1.0];
|
||||
}
|
||||
else {
|
||||
self.ringColor = [UIColor blackColor];
|
||||
if (style == JGProgressHUDStyleLight) {
|
||||
self.ringBackgroundColor = [UIColor colorWithWhite:0.85 alpha:1.0];
|
||||
}
|
||||
else {
|
||||
self.ringBackgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (Class)layerClass {
|
||||
return [JGProgressHUDRingIndicatorLayer class];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// JGProgressHUDShadow.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 25.09.17.
|
||||
// Copyright © 2017 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
A wrapper representing properties of a shadow.
|
||||
*/
|
||||
@interface JGProgressHUDShadow : NSObject
|
||||
|
||||
- (instancetype __nonnull)initWithColor:(UIColor *__nonnull)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity;
|
||||
|
||||
/** Convenience initializer. */
|
||||
+ (instancetype __nonnull)shadowWithColor:(UIColor *__nonnull)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity;
|
||||
|
||||
/**
|
||||
The color of the shadow. Colors created from patterns are currently NOT supported.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nonnull) UIColor *color;
|
||||
|
||||
/** The shadow offset. */
|
||||
@property (nonatomic, assign, readonly) CGSize offset;
|
||||
|
||||
/** The blur radius used to create the shadow. */
|
||||
@property (nonatomic, assign, readonly) CGFloat radius;
|
||||
|
||||
/**
|
||||
The opacity of the shadow. Specifying a value outside the [0,1] range will give undefined results.
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) float opacity;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// JGProgressHUDShadow.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 25.09.17.
|
||||
// Copyright © 2017 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDShadow.h"
|
||||
|
||||
@implementation JGProgressHUDShadow
|
||||
|
||||
+ (instancetype)shadowWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity {
|
||||
return [[self alloc] initWithColor:color offset:offset radius:radius opacity:opacity];
|
||||
}
|
||||
|
||||
- (instancetype)initWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius opacity:(float)opacity {
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
_color = color;
|
||||
_offset = offset;
|
||||
_radius = radius;
|
||||
_opacity = opacity;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// JGProgressHUDSuccessIndicatorView.h
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.08.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
|
||||
#import "JGProgressHUDImageIndicatorView.h"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
/**
|
||||
An image indicator showing a checkmark, representing a failed operation.
|
||||
*/
|
||||
@interface JGProgressHUDSuccessIndicatorView : JGProgressHUDImageIndicatorView
|
||||
|
||||
/**
|
||||
Default initializer for this class.
|
||||
*/
|
||||
- (instancetype __nonnull)init;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// JGProgressHUDSuccessIndicatorView.m
|
||||
// JGProgressHUD
|
||||
//
|
||||
// Created by Jonas Gessner on 19.08.14.
|
||||
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JGProgressHUDSuccessIndicatorView.h"
|
||||
#import "JGProgressHUD.h"
|
||||
|
||||
static UIBezierPath *successBezierPath() {
|
||||
static UIBezierPath *path;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
path = [UIBezierPath bezierPath];
|
||||
[path moveToPoint:CGPointMake(1.5, 18)];
|
||||
[path addLineToPoint:CGPointMake(11, 28)];
|
||||
[path addLineToPoint:CGPointMake(31.5, 5.5)];
|
||||
|
||||
[path setLineWidth:3];
|
||||
[path setLineJoinStyle:kCGLineJoinRound];
|
||||
[path setLineCapStyle:kCGLineCapRound];
|
||||
});
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@implementation JGProgressHUDSuccessIndicatorView
|
||||
|
||||
- (instancetype)initWithContentView:(UIView *__unused)contentView {
|
||||
UIBezierPath *path = successBezierPath();
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(33, 33), NO, 0.0);
|
||||
[[UIColor blackColor] setStroke];
|
||||
[path stroke];
|
||||
|
||||
UIImage *img = [UIGraphicsGetImageFromCurrentImageContext() imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
self = [super initWithImage:img];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
return [self initWithContentView:nil];
|
||||
}
|
||||
|
||||
- (void)updateAccessibility {
|
||||
self.accessibilityLabel = NSLocalizedString(@"Success",);
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user