This commit is contained in:
DDIsFriend
2023-08-18 17:28:57 +08:00
commit f0e8a1709d
4282 changed files with 192396 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "custom.chevron.backward@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "custom.chevron.backward@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "navigation_back_arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "navigation_back_arrow@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "navigation_back_arrow@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,35 @@
//
// DDViewControllerAnimatedTransition.h
// DDAnimationsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, DDViewControllerAnimatedTransitionType) {
DDViewControllerAnimatedTransitionNone = 0,
DDViewControllerAnimatedTransitionPush,
DDViewControllerAnimatedTransitionPop
};
@interface DDViewControllerAnimatedTransition : NSObject <UIViewControllerAnimatedTransitioning>
@property(nonatomic,assign)DDViewControllerAnimatedTransitionType animatedTransitionType;
- (instancetype)initWithTransitionType:(DDViewControllerAnimatedTransitionType)animatedTransitionType;
@end
@interface UIViewController (Transition)
/**
* This property is to save the state of the navigation bar during the transition animation.
*/
@property (nonatomic, strong, nullable)UIView *dd_transitionNavigationBarSnapshot;// save snapshot when push transition.
/**
* This property is to save the state of the tabBar during the transition animation.
*/
@property (nonatomic, strong, nullable)UIView *dd_transitionTabBarSnapshot;// save snapshot when push transition.
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,219 @@
//
// DDViewControllerAnimatedTransition.m
// DDAnimationsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import "DDViewControllerAnimatedTransition.h"
#import <objc/runtime.h>
#define VIEWCONTROLLER_ANIMATEDTRANSITION_DURATION 0.25
@implementation DDViewControllerAnimatedTransition
- (instancetype)initWithTransitionType:(DDViewControllerAnimatedTransitionType)animatedTransitionType{
self = [super init];
if (self) {
self.animatedTransitionType = animatedTransitionType;
}
return self;
}
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
return VIEWCONTROLLER_ANIMATEDTRANSITION_DURATION;
}
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
switch (self.animatedTransitionType) {
case DDViewControllerAnimatedTransitionPush:
[self pushAnimation:transitionContext];
break;
case DDViewControllerAnimatedTransitionPop:
[self popAnimation:transitionContext];
break;
default:
break;
}
}
-(void)pushAnimation:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *container = [transitionContext containerView];
CGRect fromVCRect = [transitionContext initialFrameForViewController:fromVC];
fromVCRect.origin.x = 0;
fromVCRect.origin.y = 0;
fromVCRect.size = container.frame.size;
fromVC.view.frame = fromVCRect;
CGRect fromVCToRect = fromVC.view.frame;
fromVCToRect.origin.x = container.frame.size.width * 1 * (-0.5);
CGRect toVCRect = [transitionContext initialFrameForViewController:fromVC];
toVCRect.origin.x = container.frame.size.width;
toVCRect.origin.y = 0;
toVCRect.size = container.frame.size;
toVC.view.frame = toVCRect;
CGRect toVCToRect = toVC.view.frame;
toVCToRect.origin.x = 0;
UIBezierPath *path = [UIBezierPath bezierPathWithRect:toVC.view.bounds];
path.lineWidth = 3;
toVC.view.layer.shadowPath = path.CGPath;
toVC.view.layer.shadowColor = UIColor.darkGrayColor.CGColor;
toVC.view.layer.shadowOpacity = 3;
UIView *navigationBarSnapshot = [fromVC.navigationController.view resizableSnapshotViewFromRect:CGRectMake(0, 0, container.frame.size.width, CGRectGetMaxY(fromVC.navigationController.navigationBar.frame)) afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
fromVC.dd_transitionNavigationBarSnapshot = navigationBarSnapshot;
[fromVC.view addSubview:navigationBarSnapshot];
if (([fromVC.navigationController.parentViewController isKindOfClass:[UITabBarController class]] == YES) && (fromVC.navigationController.viewControllers.count == 2)) {
UITabBarController *tabBarController = (UITabBarController *)fromVC.navigationController.parentViewController;
UIView *tabBarSnapshot = [tabBarController.tabBar resizableSnapshotViewFromRect:CGRectMake(0, 0, container.frame.size.width, CGRectGetMaxY(tabBarController.tabBar.frame) - CGRectGetMinY(tabBarController.tabBar.frame)) afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
fromVC.dd_transitionTabBarSnapshot = tabBarSnapshot;
tabBarSnapshot.frame = CGRectMake(0, CGRectGetMaxY(fromVC.view.frame) - tabBarSnapshot.bounds.size.height, tabBarSnapshot.bounds.size.width, tabBarSnapshot.bounds.size.height);
[fromVC.view addSubview:tabBarSnapshot];
}
if (fromVC.dd_transitionTabBarSnapshot != nil) {
fromVC.tabBarController.tabBar.hidden = YES;
}
[fromVC.navigationController.view addSubview:fromVC.view];
[fromVC.navigationController.view addSubview:toVC.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
fromVC.view.frame = fromVCToRect;
toVC.view.frame = toVCToRect;
} completion:^(BOOL finished) {
if (![transitionContext transitionWasCancelled]){
[fromVC.dd_transitionNavigationBarSnapshot removeFromSuperview];
[fromVC.dd_transitionTabBarSnapshot removeFromSuperview];
[fromVC.view removeFromSuperview];
[toVC.view removeFromSuperview];
[container addSubview:toVC.view];
}else{
[fromVC.dd_transitionNavigationBarSnapshot removeFromSuperview];
fromVC.dd_transitionNavigationBarSnapshot = nil;
if (fromVC.dd_transitionTabBarSnapshot != nil) {
[fromVC.dd_transitionTabBarSnapshot removeFromSuperview];
fromVC.dd_transitionTabBarSnapshot = nil;
}
[fromVC.view removeFromSuperview];
[toVC.view removeFromSuperview];
[container addSubview:fromVC.view];
}
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
}];
}
-(void)popAnimation:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *container = [transitionContext containerView];
CGRect fromVCRect = [transitionContext initialFrameForViewController:fromVC];
fromVCRect.origin.x = 0;
fromVCRect.origin.y = 0;
fromVCRect.size = container.frame.size;
fromVC.view.frame = fromVCRect;
CGRect fromVCToRect = fromVC.view.frame;
fromVCToRect.origin.x = container.frame.size.width;
CGRect toVCRect = [transitionContext initialFrameForViewController:fromVC];
toVCRect.origin.x = container.frame.size.width * 1 * (-0.5);
toVCRect.origin.y = 0;
toVCRect.size = container.frame.size;
toVC.view.frame = toVCRect;
CGRect toVCToRect = toVC.view.frame;
toVCToRect.origin.x = 0;
UIBezierPath *path = [UIBezierPath bezierPathWithRect:fromVC.view.bounds];
path.lineWidth = 3;
fromVC.view.layer.shadowPath = path.CGPath;
fromVC.view.layer.shadowColor = UIColor.darkGrayColor.CGColor;
fromVC.view.layer.shadowOpacity = 3;
UIView *navigationBarSnapshot = [fromVC.navigationController.view resizableSnapshotViewFromRect:CGRectMake(0, 0, container.frame.size.width, CGRectGetMaxY(fromVC.navigationController.navigationBar.frame)) afterScreenUpdates:NO withCapInsets:UIEdgeInsetsZero];
fromVC.dd_transitionNavigationBarSnapshot = navigationBarSnapshot;
[fromVC.view addSubview:navigationBarSnapshot];
[toVC.view addSubview:toVC.dd_transitionNavigationBarSnapshot];
if (toVC.dd_transitionTabBarSnapshot != nil) {
[toVC.view addSubview:toVC.dd_transitionTabBarSnapshot];
toVC.tabBarController.tabBar.hidden = YES;
}
[fromVC.navigationController.view addSubview:toVC.view];
[fromVC.navigationController.view addSubview:fromVC.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
fromVC.view.frame = fromVCToRect;
toVC.view.frame = toVCToRect;
} completion:^(BOOL finished){
if (![transitionContext transitionWasCancelled]){
[fromVC.dd_transitionNavigationBarSnapshot removeFromSuperview];
fromVC.dd_transitionNavigationBarSnapshot = nil;
[fromVC.view removeFromSuperview];
[toVC.dd_transitionNavigationBarSnapshot removeFromSuperview];
toVC.dd_transitionNavigationBarSnapshot = nil;
if (toVC.dd_transitionTabBarSnapshot != nil) {
[toVC.dd_transitionTabBarSnapshot removeFromSuperview];
toVC.dd_transitionTabBarSnapshot = nil;
toVC.tabBarController.tabBar.hidden = NO;
}
[toVC.view removeFromSuperview];
[container addSubview:toVC.view];
toVC.view.frame = container.bounds;
}else{
[fromVC.dd_transitionNavigationBarSnapshot removeFromSuperview];
fromVC.dd_transitionNavigationBarSnapshot = nil;
[fromVC.view removeFromSuperview];
[toVC.view removeFromSuperview];
[container addSubview:fromVC.view];
fromVC.view.frame = container.bounds;
}
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
}];
}
@end
@implementation UIViewController (Transition)
// MARK: <NavigationController Push Transition Snapshot>
- (UIView *)dd_transitionNavigationBarSnapshot{
return objc_getAssociatedObject(self, _cmd);
}
- (void)setDd_transitionNavigationBarSnapshot:(UIView *)dd_transitionNavigationBarSnapshot{
objc_setAssociatedObject(self, @selector(dd_transitionNavigationBarSnapshot), dd_transitionNavigationBarSnapshot, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
// MARK: <TabBarController Push Transition Snapshot>
- (UIView *)dd_transitionTabBarSnapshot{
return objc_getAssociatedObject(self, _cmd);
}
- (void)setDd_transitionTabBarSnapshot:(UIView *)dd_transitionTabBarSnapshot{
objc_setAssociatedObject(self, @selector(dd_transitionTabBarSnapshot), dd_transitionTabBarSnapshot, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseAttributedString.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import <Foundation/Foundation.h>
#import <DDCategoryKit_Private/NSAttributedString+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseAttributedString : NSAttributedString
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseAttributedString.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import "DDBaseAttributedString.h"
@implementation DDBaseAttributedString
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseMutableAttributedString.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import <Foundation/Foundation.h>
#import <DDCategoryKit_Private/NSMutableAttributedString+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseMutableAttributedString : NSMutableAttributedString
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseMutableAttributedString.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import "DDBaseMutableAttributedString.h"
@implementation DDBaseMutableAttributedString
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseButton.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIButton+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseButton : UIButton
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseButton.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseButton.h"
@implementation DDBaseButton
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseCollectionView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UICollectionView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseCollectionView : UICollectionView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,18 @@
//
// DDBaseCollectionView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseCollectionView.h"
@implementation DDBaseCollectionView
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{
self = [super initWithFrame:frame collectionViewLayout:layout];
if (self) {
}
return self;
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseCollectionViewCell.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UICollectionViewCell+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseCollectionViewCell : UICollectionViewCell
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseCollectionViewCell.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseCollectionViewCell.h"
@implementation DDBaseCollectionViewCell
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseImage.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/15.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIImage+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseImage : UIImage
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseImage.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/15.
#import "DDBaseImage.h"
@implementation DDBaseImage
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseImageView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/15.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIImageView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseImageView : UIImageView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseImageView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/15.
#import "DDBaseImageView.h"
@implementation DDBaseImageView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseLabel.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UILabel+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseLabel : UILabel
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseLabel.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseLabel.h"
@implementation DDBaseLabel
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,15 @@
//
// DDBaseModel.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseModel : NSObject
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseModel.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseModel.h"
@implementation DDBaseModel
@end

View File

@@ -0,0 +1,15 @@
//
// DDBaseNavigationController.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UINavigationController+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseNavigationController : UINavigationController
- (void)screenEdgePanGestureRecognizerEnable:(BOOL)enable;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,108 @@
//
// DDBaseNavigationController.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import "DDBaseNavigationController.h"
#import "DDNavigationControllerDelegateReceiver.h"
#import <DDLogKit_Private/DDOCLog.h>
@interface DDBaseNavigationController ()
@property (nullable , nonatomic, strong)DDNavigationControllerDelegateReceiver *delegateReceiver;
@property (nullable , nonatomic, strong)UIScreenEdgePanGestureRecognizer *screenEdgePanGestureRecognizer;
@end
@implementation DDBaseNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
[self config];
[self addNavigationControllerDelegateReceiver];
[self addScreenEdgePanGestureRecognizer];
}
// MARK: <Custom Function>
- (void)config{
self.dd_hidesBottomBarWhenPushed = YES;
}
- (void)addNavigationControllerDelegateReceiver{
self.delegateReceiver = [[DDNavigationControllerDelegateReceiver alloc] init];
self.delegate = self.delegateReceiver;
}
// MARK: <ScreenEdgePanGestureRecognizer>
- (void)addScreenEdgePanGestureRecognizer{
UIScreenEdgePanGestureRecognizer *interactivePopGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizerToPop:)];
interactivePopGestureRecognizer.edges = UIRectEdgeLeft;
[self.view addGestureRecognizer:interactivePopGestureRecognizer];
self.screenEdgePanGestureRecognizer = interactivePopGestureRecognizer;
// self.interactivePopGestureRecognizer.delegate = self;
self.interactivePopGestureRecognizer.enabled = NO;
}
- (void)panGestureRecognizerToPop:(UIPanGestureRecognizer *)ges{
if (ges.state == UIGestureRecognizerStateBegan){
if (self.viewControllers.count == 1){
return;
}
self.delegateReceiver.percentDrivenInteractiveTransition = [UIPercentDrivenInteractiveTransition new];
[self popViewControllerAnimated:YES];
}
CGFloat progress = [ges translationInView:self.view].x / [UIScreen mainScreen].bounds.size.width;
if (ges.state == UIGestureRecognizerStateChanged){
[self.delegateReceiver.percentDrivenInteractiveTransition updateInteractiveTransition:progress];
}else if (ges.state == UIGestureRecognizerStateEnded || ges.state == UIGestureRecognizerStateCancelled){
if (progress >= 0.5){
[self.delegateReceiver.percentDrivenInteractiveTransition finishInteractiveTransition];
}else{
[self.delegateReceiver.percentDrivenInteractiveTransition cancelInteractiveTransition];
}
self.delegateReceiver.percentDrivenInteractiveTransition = nil;
}else if (ges.state == UIGestureRecognizerStateFailed){
return;
}
}
- (void)screenEdgePanGestureRecognizerEnable:(BOOL)enable{
self.screenEdgePanGestureRecognizer.enabled = enable;
}
// MARK: <UIStatusBarStyle>
//- (UIStatusBarStyle)preferredStatusBarStyle{
// return UIStatusBarStyleDefault;
//}
// override this method will instead - (UIStatusBarStyle)preferredStatusBarStyle.
- (UIViewController *)childViewControllerForStatusBarStyle{
return self.topViewController;
}
- (UIViewController *)childViewControllerForStatusBarHidden{
return self.topViewController;
}
// MARK: <Orientations>
- (BOOL)shouldAutorotate{
return self.topViewController.shouldAutorotate;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return self.topViewController.supportedInterfaceOrientations;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return self.topViewController.preferredInterfaceOrientationForPresentation;
}
// MARK: <Dealloc>
- (void)dealloc{
DDLog(@"Attention:控制器 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----%@ dealloc",[self class]);
}
@end

View File

@@ -0,0 +1,14 @@
//
// DDNavigationControllerDelegateReceiver.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDNavigationControllerDelegateReceiver : NSObject <UINavigationControllerDelegate>
@property (nonatomic, strong, nullable)UIPercentDrivenInteractiveTransition *percentDrivenInteractiveTransition;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,32 @@
//
// UINavigationControllerDelegateReceiver.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/9/20.
#import "DDNavigationControllerDelegateReceiver.h"
#import <DDBasicControlsKit_Private/DDViewControllerAnimatedTransition.h>
@implementation DDNavigationControllerDelegateReceiver
// MARK: <UINavigationControllerDelegate>
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController{
return self.percentDrivenInteractiveTransition;
}
- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
animationControllerForOperation:(UINavigationControllerOperation)operation
fromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC {
if (operation == UINavigationControllerOperationNone) {
return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionNone];
}
if (operation == UINavigationControllerOperationPush){
return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionPush];
}
return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionPop];
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseScrollView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/26.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIScrollView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseScrollView : UIScrollView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseScrollView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/26.
#import "DDBaseScrollView.h"
@implementation DDBaseScrollView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,15 @@
//
// DDBaseTabBarController.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/11/7.
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseTabBarController : UITabBarController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,45 @@
//
// DDBaseTabBarController.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/11/7.
#import "DDBaseTabBarController.h"
@interface DDBaseTabBarController ()
@end
@implementation DDBaseTabBarController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
// MARK: <UIStatusBarStyle>
//- (UIStatusBarStyle)preferredStatusBarStyle{
// return UIStatusBarStyleDefault;
//}
// override this method will instead - (UIStatusBarStyle)preferredStatusBarStyle.
- (UIViewController *)childViewControllerForStatusBarStyle{
return self.selectedViewController;
}
- (UIViewController *)childViewControllerForStatusBarHidden{
return self.selectedViewController;
}
// MARK: <Orientations>
- (BOOL)shouldAutorotate{
return self.selectedViewController.shouldAutorotate;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return self.selectedViewController.supportedInterfaceOrientations;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return self.selectedViewController.preferredInterfaceOrientationForPresentation;
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseTableView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UITableView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseTableView : UITableView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseTableView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseTableView.h"
@implementation DDBaseTableView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseTableViewCell.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UITableViewCell+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseTableViewCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,31 @@
//
// DDBaseTableViewCell.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseTableViewCell.h"
@implementation DDBaseTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
}
return self;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseTextField.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/21.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UITextField+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseTextField : UITextField
@property (nonatomic, assign)NSInteger textLimitCount;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,25 @@
//
// DDBaseTextField.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/21.
#import "DDBaseTextField.h"
@implementation DDBaseTextField
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.textLimitCount = UINTMAX_MAX;
[self addTarget:self action:@selector(limitTextCount:) forControlEvents:UIControlEventEditingChanged];
}
return self;
}
- (void)limitTextCount:(UITextField *)textField{
if (textField.text.length >= self.textLimitCount) {
textField.text = [textField.text substringToIndex:self.textLimitCount];
}
}
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseTextView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UITextView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseTextView : UITextView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseTextView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/22.
#import "DDBaseTextView.h"
@implementation DDBaseTextView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,16 @@
//
// DDBaseView.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIView+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// DDBaseView.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseView.h"
@implementation DDBaseView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,27 @@
//
// DDBaseViewController.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/10/27.
#import <UIKit/UIKit.h>
#import <DDCategoryKit_Private/UIViewController+DDCategory.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseViewController : UIViewController
@property (nonatomic, strong, nullable) NSString *dd_navigationItemTitle;
@property (nonatomic, strong, nullable) UIView *dd_navigationItemTitleView;
@property (nonatomic, strong, nullable) UIBarButtonItem *dd_backBarButtonItem; // This item contains a customView consist of a button.
- (void)dd_backButtonWithImage:(nullable UIImage *)backButtonImage action:(SEL)sel;
- (void)dd_backActionPopViewController:(BOOL)isAnimated;
- (void)dd_backActionPopToRootViewController:(BOOL)isAnimated;
- (void)dd_setInterfaceOrientation:(UIInterfaceOrientation)orientation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,147 @@
//
// DDBaseViewController.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2022/10/27.
#import "DDBaseViewController.h"
#import <DDCategoryKit_Private/UIImage+DDCategory.h>
#import <DDLogKit_Private/DDOCLog.h>
@interface DDBaseViewController ()
@end
@implementation DDBaseViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self configNavigationBar];
[self configView];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)coder{
self = [super initWithCoder:coder];
if (self) {
[self configNavigationBar];
[self configView];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
// MARK: <NavigationBar Config>
- (void)configNavigationBar{
//
self.navigationItem.hidesBackButton = YES;
// navigationBar Attributes.
[self defaultNavigationBarBackgroundColor];
[self defaultNavigationBarTitleTextAttributes];
[self defaultNavigationBarBarButtonItemAttributes];
[self defaultNavigationBarLeftBarButtonItems];
}
- (void)defaultNavigationBarBackgroundColor{
self.dd_navigationBarBackgroundColor = UIColor.whiteColor;
}
- (void)defaultNavigationBarTitleTextAttributes{
self.dd_navigationBarTitleTextAttributes = @{NSForegroundColorAttributeName : UIColor.blackColor,NSFontAttributeName : [UIFont systemFontOfSize:17 weight:UIFontWeightMedium]};
}
- (void)defaultNavigationBarBarButtonItemAttributes{
self.dd_navigationBarBarButtonItemAttributes = @{NSForegroundColorAttributeName : UIColor.blackColor,NSFontAttributeName : [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]};
}
- (void)defaultNavigationBarLeftBarButtonItems{
UIImage *backButtonImage = [UIImage dd_imageNamed:@"navigation_back_arrow" bundleName:@"DDBaseViewController" aClass:self.class];
[self dd_backButtonWithImage:backButtonImage action:@selector(defaultBackActionPopViewController)];
}
- (void)defaultBackActionPopViewController{
[self dd_backActionPopViewController:YES];
}
- (void)dd_backButtonWithImage:(nullable UIImage *)backButtonImage action:(SEL)sel{
self.navigationItem.leftBarButtonItems = nil;
self.navigationItem.leftBarButtonItems = [self dd_backBarButtonItem:[self barButtonItemWithImage:backButtonImage title:nil target:self action:sel] WithOtherItems:nil];
}
- (nullable UIBarButtonItem *)barButtonItemWithImage:(nullable UIImage *)image title:(nullable NSString *)title target:(nullable id)target action:(nullable SEL)action {
if (image != nil){
return [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:target action:action];
}else if (title != nil){
return [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:target action:action];
}
return nil;
}
- (nullable NSArray<UIBarButtonItem *> *)dd_backBarButtonItem:(nonnull UIBarButtonItem *)backBarButtonItem WithOtherItems:(nullable NSArray<UIBarButtonItem *> *)items{
_dd_backBarButtonItem = backBarButtonItem;
UIBarButtonItem *flexibleSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
NSArray *backItems = [[NSArray arrayWithObjects:backBarButtonItem,flexibleSpaceItem, nil] arrayByAddingObjectsFromArray:items];
return backItems;
}
- (void)dd_backActionPopViewController:(BOOL)isAnimated{
[self.navigationController popViewControllerAnimated:isAnimated];
}
- (void)dd_backActionPopToRootViewController:(BOOL)isAnimated{
[self.navigationController popToRootViewControllerAnimated:isAnimated];
}
// MARK: <View>
- (void)configView{
// self.view.backgroundColor = [UIColor whiteColor];
}
// MARK: <NavigationItemTitle>
- (void)setDd_navigationItemTitle:(NSString *)navigationItemTitle{
_dd_navigationItemTitle = navigationItemTitle;
self.navigationItem.title = navigationItemTitle;
}
- (void)setDd_navigationItemTitleView:(UIView *)navigationItemTitleView{
_dd_navigationItemTitleView = navigationItemTitleView;
self.navigationItem.titleView = navigationItemTitleView;
}
// MARK: <UIStatusBarStyle>
- (UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleDefault;
}
- (BOOL)prefersStatusBarHidden{
return NO;
}
// MARK: <UIOrientation>
- (void)dd_setInterfaceOrientation:(UIInterfaceOrientation)orientation {
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
SEL selector = NSSelectorFromString(@"setOrientation:");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:[UIDevice currentDevice]];
UIInterfaceOrientation val = orientation;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
}
// MARK: <Dealloc>
- (void)dealloc{
DDLog(@"Attention:控制器 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----%@ dealloc",[self class]);
}
@end

View File

@@ -0,0 +1,15 @@
//
// DDBaseViewModel.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDBaseViewModel : NSObject
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,11 @@
//
// DDBaseViewModel.m
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/10.
#import "DDBaseViewModel.h"
@implementation DDBaseViewModel
@end

View File

@@ -0,0 +1,29 @@
//
// DDBasicControls.h
// DDBasicControlsKit_Private
// Created by DDIsFriend on 2023/2/13.
#ifndef DDBasicControls_h
#define DDBasicControls_h
#import <DDBasicControlsKit_Private/DDBaseAttributedString.h>
#import <DDBasicControlsKit_Private/DDBaseButton.h>
#import <DDBasicControlsKit_Private/DDBaseCollectionView.h>
#import <DDBasicControlsKit_Private/DDBaseCollectionViewCell.h>
#import <DDBasicControlsKit_Private/DDBaseImage.h>
#import <DDBasicControlsKit_Private/DDBaseImageView.h>
#import <DDBasicControlsKit_Private/DDBaseLabel.h>
#import <DDBasicControlsKit_Private/DDBaseModel.h>
#import <DDBasicControlsKit_Private/DDBaseNavigationController.h>
#import <DDBasicControlsKit_Private/DDBaseScrollView.h>
#import <DDBasicControlsKit_Private/DDBaseTabBarController.h>
#import <DDBasicControlsKit_Private/DDBaseTableView.h>
#import <DDBasicControlsKit_Private/DDBaseTableViewCell.h>
#import <DDBasicControlsKit_Private/DDBaseTextField.h>
#import <DDBasicControlsKit_Private/DDBaseTextView.h>
#import <DDBasicControlsKit_Private/DDBaseView.h>
#import <DDBasicControlsKit_Private/DDBaseViewController.h>
#import <DDBasicControlsKit_Private/DDBaseViewModel.h>
#endif /* DDBasicControls_h */

19
Pods/DDBasicControlsKit_Private/LICENSE generated Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2022 DDIsFriend <DDIsFriend@163.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,29 @@
# DDBasicControlsKit_Private
[![CI Status](https://img.shields.io/travis/DDIsFriend/DDBasicControlsKit_Private.svg?style=flat)](https://travis-ci.org/DDIsFriend/DDBasicControlsKit_Private)
[![Version](https://img.shields.io/cocoapods/v/DDBasicControlsKit_Private.svg?style=flat)](https://cocoapods.org/pods/DDBasicControlsKit_Private)
[![License](https://img.shields.io/cocoapods/l/DDBasicControlsKit_Private.svg?style=flat)](https://cocoapods.org/pods/DDBasicControlsKit_Private)
[![Platform](https://img.shields.io/cocoapods/p/DDBasicControlsKit_Private.svg?style=flat)](https://cocoapods.org/pods/DDBasicControlsKit_Private)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
DDBasicControlsKit_Private is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'DDBasicControlsKit_Private'
```
## Author
DDIsFriend, DDIsFriend@163.com
## License
DDBasicControlsKit_Private is available under the MIT license. See the LICENSE file for more info.