口袋优选

TYAlertController.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // TYAlertController.h
  3. // TYAlertControllerDemo
  4. //
  5. // Created by tanyang on 15/9/1.
  6. // Copyright (c) 2015年 tanyang. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "TYAlertView.h"
  10. typedef NS_ENUM(NSInteger, TYAlertControllerStyle) {
  11. TYAlertControllerStyleAlert = 0,
  12. TYAlertControllerStyleActionSheet
  13. };
  14. typedef NS_ENUM(NSInteger, TYAlertTransitionAnimation) {
  15. TYAlertTransitionAnimationFade = 0,
  16. TYAlertTransitionAnimationScaleFade,
  17. TYAlertTransitionAnimationDropDown,
  18. TYAlertTransitionAnimationCustom
  19. };
  20. @interface TYAlertController : UIViewController
  21. @property (nonatomic, strong, readonly) UIView *alertView;
  22. @property (nonatomic, strong) UIColor *backgroundColor; // set backgroundColor
  23. @property (nonatomic, strong) UIView *backgroundView; // you set coustom view to it
  24. @property (nonatomic, assign, readonly) TYAlertControllerStyle preferredStyle;
  25. @property (nonatomic, assign, readonly) TYAlertTransitionAnimation transitionAnimation;
  26. @property (nonatomic, assign, readonly) Class transitionAnimationClass;
  27. @property (nonatomic, assign) BOOL backgoundTapDismissEnable; // default NO
  28. @property (nonatomic, assign) CGFloat alertViewOriginY; // default center Y
  29. @property (nonatomic, assign) CGFloat alertStyleEdging; // when width frame equal to 0,or no width constraint ,this proprty will use, default to 15 edge
  30. @property (nonatomic, assign) CGFloat actionSheetStyleEdging; // default 0
  31. // alertView lifecycle block
  32. @property (copy, nonatomic) void (^viewWillShowHandler)(UIView *alertView);
  33. @property (copy, nonatomic) void (^viewDidShowHandler)(UIView *alertView);
  34. @property (copy, nonatomic) void (^viewWillHideHandler)(UIView *alertView);
  35. @property (copy, nonatomic) void (^viewDidHideHandler)(UIView *alertView);
  36. // dismiss controller completed block
  37. @property (nonatomic, copy) void (^dismissComplete)(void);
  38. + (instancetype)alertControllerWithAlertView:(UIView *)alertView;
  39. + (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(TYAlertControllerStyle)preferredStyle;
  40. + (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(TYAlertControllerStyle)preferredStyle transitionAnimation:(TYAlertTransitionAnimation)transitionAnimation;
  41. + (instancetype)alertControllerWithAlertView:(UIView *)alertView preferredStyle:(TYAlertControllerStyle)preferredStyle transitionAnimationClass:(Class)transitionAnimationClass;
  42. - (void)dismissViewControllerAnimated: (BOOL)animated;
  43. @end
  44. // Transition Animate
  45. @interface TYAlertController (TransitionAnimate)<UIViewControllerTransitioningDelegate>
  46. @end