SVProgressHUD.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // SVProgressHUD.h
  3. //
  4. // Created by Sam Vermette on 27.03.11.
  5. // Copyright 2011 Sam Vermette. All rights reserved.
  6. //
  7. // https://github.com/samvermette/SVProgressHUD
  8. //
  9. #import <UIKit/UIKit.h>
  10. #import <AvailabilityMacros.h>
  11. extern NSString * const SVProgressHUDDidReceiveTouchEventNotification;
  12. extern NSString * const SVProgressHUDWillDisappearNotification;
  13. extern NSString * const SVProgressHUDDidDisappearNotification;
  14. extern NSString * const SVProgressHUDWillAppearNotification;
  15. extern NSString * const SVProgressHUDDidAppearNotification;
  16. extern NSString * const SVProgressHUDStatusUserInfoKey;
  17. enum {
  18. SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed
  19. SVProgressHUDMaskTypeClear, // don't allow
  20. SVProgressHUDMaskTypeBlack, // don't allow and dim the UI in the back of the HUD
  21. SVProgressHUDMaskTypeGradient // don't allow and dim the UI with a a-la-alert-view bg gradient
  22. };
  23. typedef NSUInteger SVProgressHUDMaskType;
  24. @interface SVProgressHUD : UIView
  25. #pragma mark - Customization
  26. + (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor]
  27. + (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor]
  28. + (void)setRingThickness:(CGFloat)width; // default is 4 pt
  29. + (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]
  30. + (void)setSuccessImage:(UIImage*)image; // default is bundled success image from Glyphish
  31. + (void)setErrorImage:(UIImage*)image; // default is bundled error image from Glyphish
  32. #pragma mark - Show Methods
  33. + (void)show;
  34. + (void)showWithMaskType:(SVProgressHUDMaskType)maskType;
  35. + (void)showWithStatus:(NSString*)status;
  36. + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
  37. + (void)showProgress:(float)progress;
  38. + (void)showProgress:(float)progress status:(NSString*)status;
  39. + (void)showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
  40. + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing
  41. // stops the activity indicator, shows a glyph + status, and dismisses HUD 1s later
  42. + (void)showSuccessWithStatus:(NSString*)string;
  43. + (void)showErrorWithStatus:(NSString *)string;
  44. + (void)showImage:(UIImage*)image status:(NSString*)status; // use 28x28 white pngs
  45. + (void)setOffsetFromCenter:(UIOffset)offset;
  46. + (void)resetOffsetFromCenter;
  47. + (void)popActivity;
  48. + (void)dismiss;
  49. + (BOOL)isVisible;
  50. @end
  51. @interface SVIndefiniteAnimatedView : UIView
  52. @property (nonatomic, assign) CGFloat strokeThickness;
  53. @property (nonatomic, assign) CGFloat radius;
  54. @property (nonatomic, strong) UIColor *strokeColor;
  55. @end