DSHPopupContainer.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // DSHPopupContainer.h
  3. // tetstst
  4. //
  5. // Created by 路 on 2018/11/8.
  6. // Copyright © 2018年 路. All rights reserved.
  7. // 弹层容器
  8. #import <UIKit/UIKit.h>
  9. @class DSHPopupContainer;
  10. @protocol DSHCustomPopupView <NSObject>
  11. // 准备弹出(初始化弹层位置)
  12. - (void)willPopupContainer:(DSHPopupContainer *)container;
  13. // 已弹出(做弹出动画)
  14. - (void)didPopupContainer:(DSHPopupContainer *)container duration:(NSTimeInterval)duration;
  15. // 将要移除(做移除动画)
  16. - (void)willDismissContainer:(DSHPopupContainer *)container duration:(NSTimeInterval)duration;
  17. @optional
  18. @property (readonly) DSHPopupContainer *container; // 用来获取当前弹层容器
  19. @end
  20. @protocol DSHPopupContainerDelegate <NSObject>
  21. @optional
  22. - (void)popupContainer:(DSHPopupContainer *)popupContainer willShowCustomView:(UIView <DSHCustomPopupView>*)customPopupView;
  23. - (void)popupContainer:(DSHPopupContainer *)popupContainer willDismissCustomView:(UIView <DSHCustomPopupView>*)customPopupView;
  24. @end
  25. @interface DSHPopupContainer : UIView
  26. - (id)initWithCustomPopupView:(UIView <DSHCustomPopupView>*)customPopupView;
  27. - (id)initWithCustomPopupView:(UIView <DSHCustomPopupView>*)customPopupView containerView:(UIView *)containerView;
  28. - (void)show;
  29. - (void)dismiss;
  30. @property (assign ,nonatomic) NSTimeInterval showAnimationDuration;
  31. @property (assign ,nonatomic) NSTimeInterval dismissAnimationDuration;
  32. @property (strong ,nonatomic) UIColor *maskColor; // 蒙层背景色 默认:nil
  33. @property (assign ,nonatomic) BOOL penetrable;
  34. @property (assign ,nonatomic) BOOL autoDismissWhenClickedBackground; // 蒙层交互开关(点击蒙层自动隐藏,默认:YES)
  35. @property (weak ,nonatomic) id <DSHPopupContainerDelegate>delegate;
  36. + (DSHPopupContainer *)findContainerFromView:(UIView *)view DEPRECATED_MSG_ATTRIBUTE("Please use findContainersFromView:");
  37. + (__kindof UIView <DSHCustomPopupView>*)findPopupViewFromView:(UIView *)view class:(Class)aClass DEPRECATED_MSG_ATTRIBUTE("Please use findPopupViewsFromView::");
  38. + (NSArray <DSHPopupContainer *>*)findContainersFromView:(UIView *)view;
  39. + (NSArray <__kindof UIView <DSHCustomPopupView>*>*)findPopupViewsFromView:(UIView *)view class:(Class)aClass;
  40. @end