MMPopupView.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // MMPopupView.h
  3. // MMPopupView
  4. //
  5. // Created by Ralph Li on 9/6/15.
  6. // Copyright © 2015 LJC. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "MMPopupItem.h"
  10. #import "MMPopupWindow.h"
  11. #import "MMPopupCategory.h"
  12. #import "MMPopupDefine.h"
  13. typedef NS_ENUM(NSUInteger, MMPopupType)
  14. {
  15. MMPopupTypeAlert,
  16. MMPopupTypeSheet,
  17. MMPopupTypeCustom,
  18. };
  19. @class MMPopupView;
  20. typedef void(^MMPopupBlock)(MMPopupView *);
  21. typedef void(^MMPopupCompletionBlock)(MMPopupView *, BOOL);
  22. @interface MMPopupView : UIView
  23. @property (nonatomic, assign, readonly) BOOL visible; // default is NO.
  24. @property (nonatomic, strong ) UIView *attachedView; // default is MMPopupWindow. You can attach MMPopupView to any UIView.
  25. @property (nonatomic, assign ) MMPopupType type; // default is MMPopupTypeAlert.
  26. @property (nonatomic, assign ) NSTimeInterval animationDuration; // default is 0.3 sec.
  27. @property (nonatomic, assign ) BOOL withKeyboard; // default is NO. When YES, alert view with be shown with a center offset (only effect with MMPopupTypeAlert).
  28. @property (nonatomic, copy ) MMPopupCompletionBlock showCompletionBlock; // show completion block.
  29. @property (nonatomic, copy ) MMPopupCompletionBlock hideCompletionBlock; // hide completion block
  30. @property (nonatomic, copy ) MMPopupBlock showAnimation; // custom show animation block.
  31. @property (nonatomic, copy ) MMPopupBlock hideAnimation; // custom hide animation block.
  32. /**
  33. * override this method to show the keyboard if with a keyboard
  34. */
  35. - (void) showKeyboard;
  36. /**
  37. * override this method to hide the keyboard if with a keyboard
  38. */
  39. - (void) hideKeyboard;
  40. /**
  41. * show the popup view
  42. */
  43. - (void) show;
  44. /**
  45. * show the popup view with completiom block
  46. *
  47. * @param block show completion block
  48. */
  49. - (void) showWithBlock:(MMPopupCompletionBlock)block;
  50. /**
  51. * hide the popup view
  52. */
  53. - (void) hide;
  54. /**
  55. * hide the popup view with completiom block
  56. *
  57. * @param block hide completion block
  58. */
  59. - (void) hideWithBlock:(MMPopupCompletionBlock)block;
  60. /**
  61. * hide all popupview with current class, eg. [MMAlertview hideAll];
  62. */
  63. + (void) hideAll;
  64. @end