添加HWPanModal和FLAnimatedImage

This commit is contained in:
2025-11-05 22:04:56 +08:00
parent efdcf60ed1
commit abf32e8457
97 changed files with 10853 additions and 2067 deletions

View File

@@ -0,0 +1,29 @@
//
// HWPanModalPresentationDelegate.h
// HWPanModal
//
// Created by heath wang on 2019/4/29.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class HWPanModalInteractiveAnimator;
typedef NS_ENUM(NSInteger, PanModalInteractiveMode) {
PanModalInteractiveModeNone,
PanModalInteractiveModeSideslip, // 侧滑返回
PanModalInteractiveModeDragDown, // 向下拖拽返回
};
NS_ASSUME_NONNULL_BEGIN
@interface HWPanModalPresentationDelegate : NSObject <UIViewControllerTransitioningDelegate, UIAdaptivePresentationControllerDelegate, UIPopoverPresentationControllerDelegate>
@property (nonatomic, assign) BOOL interactive;
@property (nonatomic, assign) PanModalInteractiveMode interactiveMode;
@property (nonnull, nonatomic, strong, readonly) HWPanModalInteractiveAnimator *interactiveDismissalAnimator;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,66 @@
//
// HWPanModalPresentationDelegate.m
// HWPanModal
//
// Created by heath wang on 2019/4/29.
//
#import "HWPanModalPresentationDelegate.h"
#import "HWPanModalPresentationAnimator.h"
#import "HWPanModalPresentationController.h"
#import "HWPanModalInteractiveAnimator.h"
@interface HWPanModalPresentationDelegate ()
@property (nonatomic, strong) HWPanModalInteractiveAnimator *interactiveDismissalAnimator;
@end
@implementation HWPanModalPresentationDelegate
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
return [[HWPanModalPresentationAnimator alloc] initWithTransitionStyle:TransitionStylePresentation interactiveMode:PanModalInteractiveModeNone];
}
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
return [[HWPanModalPresentationAnimator alloc] initWithTransitionStyle:TransitionStyleDismissal interactiveMode:self.interactiveMode];
}
- (nullable id <UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator {
if (self.interactive) {
return self.interactiveDismissalAnimator;
}
return nil;
}
- (nullable UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(nullable UIViewController *)presenting sourceViewController:(UIViewController *)source {
UIPresentationController *controller = [[HWPanModalPresentationController alloc] initWithPresentedViewController:presented presentingViewController:presenting];
controller.delegate = self;
return controller;
}
#pragma mark - UIAdaptivePresentationControllerDelegate
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection {
return UIModalPresentationNone;
}
#pragma mark - Getter
- (HWPanModalInteractiveAnimator *)interactiveDismissalAnimator {
if (!_interactiveDismissalAnimator) {
_interactiveDismissalAnimator = [[HWPanModalInteractiveAnimator alloc] init];
}
return _interactiveDismissalAnimator;
}
#ifdef DEBUG
- (void)dealloc {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
#endif
@end