├── .gitignore.gitignore ├── .travis.yml ├── MixT ├── .DS_Store ├── MixT.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── Devil.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── xcschemes │ │ └── MixT.xcscheme ├── MixT.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── Devil.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── MixT │ ├── Categories │ │ ├── UIButton+DLAdaptiveButton.h │ │ ├── UIButton+DLAdaptiveButton.m │ │ ├── UIColor+DLAddtion.h │ │ ├── UIColor+DLAddtion.m │ │ ├── UIImage+DLRotate.h │ │ ├── UIImage+DLRotate.m │ │ ├── UIView+DLSize.h │ │ └── UIView+DLSize.m │ ├── Classes │ │ ├── .DS_Store │ │ ├── Base │ │ │ ├── DLBaseViewController.h │ │ │ ├── DLBaseViewController.m │ │ │ ├── DLCommon.h │ │ │ ├── DLCommon.m │ │ │ └── View │ │ │ │ ├── DLBaseTableViewCell.h │ │ │ │ ├── DLBaseTableViewCell.m │ │ │ │ ├── DLNavigationBar.h │ │ │ │ └── DLNavigationBar.m │ │ ├── DLTestViewController.h │ │ ├── DLTestViewController.m │ │ ├── Main │ │ │ ├── DLMainViewController.h │ │ │ ├── DLMainViewController.m │ │ │ ├── DLNavigationController.h │ │ │ ├── DLNavigationController.m │ │ │ └── Navigation │ │ │ │ ├── .DS_Store │ │ │ │ ├── Category │ │ │ │ ├── UIImage+GKCategory.h │ │ │ │ ├── UIImage+GKCategory.m │ │ │ │ ├── UIScrollView+GKCategory.h │ │ │ │ ├── UIScrollView+GKCategory.m │ │ │ │ ├── UITabBarController+GKCategory.h │ │ │ │ ├── UITabBarController+GKCategory.m │ │ │ │ ├── UIViewController+GKCategory.h │ │ │ │ ├── UIViewController+GKCategory.m │ │ │ │ ├── btn_back_white@2x.png │ │ │ │ └── btn_back_white@3x.png │ │ │ │ ├── GKNavigationController.h │ │ │ │ ├── GKNavigationController.m │ │ │ │ ├── GKPanGestureHandler │ │ │ │ ├── GKFullScreenPanGestureRecognizerDelegate.h │ │ │ │ └── GKFullScreenPanGestureRecognizerDelegate.m │ │ │ │ └── GKWrapViewController │ │ │ │ ├── GKWrapNavigationController.h │ │ │ │ ├── GKWrapNavigationController.m │ │ │ │ ├── GKWrapViewController.h │ │ │ │ ├── GKWrapViewController.m │ │ │ │ ├── UIViewController+GKNavigationController.h │ │ │ │ └── UIViewController+GKNavigationController.m │ │ ├── Network │ │ │ ├── DLNetworkViewController.h │ │ │ └── DLNetworkViewController.m │ │ ├── Resources │ │ │ ├── Color │ │ │ │ ├── UIColor+DLGlobalColor.h │ │ │ │ └── UIColor+DLGlobalColor.m │ │ │ └── Image │ │ │ │ ├── UIImage+DLGlobalImage.h │ │ │ │ └── UIImage+DLGlobalImage.m │ │ ├── System │ │ │ ├── DLSystemViewController.h │ │ │ ├── DLSystemViewController.m │ │ │ ├── DLUMLImageViewController.h │ │ │ ├── DLUMLImageViewController.m │ │ │ ├── DataStructure │ │ │ │ ├── LeetCode │ │ │ │ │ ├── 二叉树 │ │ │ │ │ │ ├── DLBinaryTreePractice.h │ │ │ │ │ │ ├── DLBinaryTreePractice.m │ │ │ │ │ │ ├── DLTree.h │ │ │ │ │ │ └── DLTree.m │ │ │ │ │ ├── 栈 │ │ │ │ │ │ ├── DLStackPractice.h │ │ │ │ │ │ └── DLStackPractice.m │ │ │ │ │ └── 链表 │ │ │ │ │ │ ├── DLLinkListPractice.h │ │ │ │ │ │ └── DLLinkListPractice.m │ │ │ │ ├── LinkList │ │ │ │ │ ├── DLCircleLinkList.h │ │ │ │ │ ├── DLCircleLinkList.m │ │ │ │ │ ├── DLLinkList.h │ │ │ │ │ ├── DLLinkList.m │ │ │ │ │ ├── DLNode.h │ │ │ │ │ ├── DLNode.m │ │ │ │ │ ├── DLSingleCircleList.h │ │ │ │ │ ├── DLSingleCircleList.m │ │ │ │ │ ├── DLSingleLinkList.h │ │ │ │ │ ├── DLSingleLinkList.m │ │ │ │ │ ├── DLSingleNode.h │ │ │ │ │ └── DLSingleNode.m │ │ │ │ ├── Queue │ │ │ │ │ ├── DLDeque.h │ │ │ │ │ ├── DLDeque.m │ │ │ │ │ ├── DLQueue.h │ │ │ │ │ └── DLQueue.m │ │ │ │ ├── Set │ │ │ │ │ ├── DLTreeSet.h │ │ │ │ │ └── DLTreeSet.m │ │ │ │ ├── Stack │ │ │ │ │ ├── DLStack.h │ │ │ │ │ └── DLStack.m │ │ │ │ └── Tree │ │ │ │ │ ├── DLAVLTree.h │ │ │ │ │ ├── DLAVLTree.m │ │ │ │ │ ├── DLAVLTreeNode.h │ │ │ │ │ ├── DLAVLTreeNode.m │ │ │ │ │ ├── DLBalanceBinarySearchTree.h │ │ │ │ │ ├── DLBalanceBinarySearchTree.m │ │ │ │ │ ├── DLBinarySearchTree.h │ │ │ │ │ ├── DLBinarySearchTree.m │ │ │ │ │ ├── DLBinaryTree.h │ │ │ │ │ ├── DLBinaryTree.m │ │ │ │ │ ├── DLCompareProtocol.h │ │ │ │ │ ├── DLRedBlackTree.h │ │ │ │ │ ├── DLRedBlackTree.m │ │ │ │ │ ├── DLRedBlackTreeNode.h │ │ │ │ │ ├── DLRedBlackTreeNode.m │ │ │ │ │ ├── DLTreeNode.h │ │ │ │ │ ├── DLTreeNode.m │ │ │ │ │ └── MJBinaryTrees │ │ │ │ │ ├── MJBinaryTrees.h │ │ │ │ │ ├── MJBinaryTrees.m │ │ │ │ │ ├── MJPrinter │ │ │ │ │ ├── MJBinaryTreeInfo.h │ │ │ │ │ ├── MJInorderPrinter.h │ │ │ │ │ ├── MJInorderPrinter.m │ │ │ │ │ ├── MJLevelOrderPrinter.h │ │ │ │ │ ├── MJLevelOrderPrinter.m │ │ │ │ │ ├── MJPrinter.h │ │ │ │ │ └── MJPrinter.m │ │ │ │ │ ├── NSString+Trees.h │ │ │ │ │ └── NSString+Trees.m │ │ │ └── DesignPatterns │ │ │ │ ├── DLDesignMainViewController.h │ │ │ │ ├── DLDesignMainViewController.m │ │ │ │ ├── NumberTextField.h │ │ │ │ ├── NumberTextField.m │ │ │ │ ├── SimpleFactoryModel │ │ │ │ ├── Caculate业务类 │ │ │ │ │ ├── CalculateAdd.h │ │ │ │ │ ├── CalculateAdd.m │ │ │ │ │ ├── CalculateDivide.h │ │ │ │ │ ├── CalculateDivide.m │ │ │ │ │ ├── CalculateFactory.h │ │ │ │ │ ├── CalculateFactory.m │ │ │ │ │ ├── CalculateReduce.h │ │ │ │ │ ├── CalculateReduce.m │ │ │ │ │ ├── CalculateTake.h │ │ │ │ │ ├── CalculateTake.m │ │ │ │ │ ├── CalculateTool.h │ │ │ │ │ └── CalculateTool.m │ │ │ │ ├── DLCalculateViewController.h │ │ │ │ └── DLCalculateViewController.m │ │ │ │ └── StrategyPattern │ │ │ │ ├── CashTool │ │ │ │ ├── DLCashContext.h │ │ │ │ ├── DLCashContext.m │ │ │ │ ├── DLCashNormal.h │ │ │ │ ├── DLCashNormal.m │ │ │ │ ├── DLCashRebate.h │ │ │ │ ├── DLCashRebate.m │ │ │ │ ├── DLCashReturn.h │ │ │ │ ├── DLCashReturn.m │ │ │ │ ├── DLCashSuper.h │ │ │ │ └── DLCashSuper.m │ │ │ │ ├── DLStrategyPatternViewController.h │ │ │ │ └── DLStrategyPatternViewController.m │ │ ├── UI │ │ │ ├── Controllers │ │ │ │ ├── Alert │ │ │ │ │ ├── AlertTools │ │ │ │ │ │ ├── DLCustomPresentationController.h │ │ │ │ │ │ ├── DLCustomPresentationController.m │ │ │ │ │ │ ├── UIViewController+DLPresent.h │ │ │ │ │ │ └── UIViewController+DLPresent.m │ │ │ │ │ ├── AlertViews │ │ │ │ │ │ ├── AlertController │ │ │ │ │ │ │ ├── .DS_Store │ │ │ │ │ │ │ ├── Address │ │ │ │ │ │ │ │ ├── .DS_Store │ │ │ │ │ │ │ │ ├── DLAddressAlertController.h │ │ │ │ │ │ │ │ ├── DLAddressAlertController.m │ │ │ │ │ │ │ │ ├── DLAddressAnimation.h │ │ │ │ │ │ │ │ ├── DLAddressAnimation.m │ │ │ │ │ │ │ │ └── Views │ │ │ │ │ │ │ │ │ ├── DLAddressSelectCell.h │ │ │ │ │ │ │ │ │ ├── DLAddressSelectCell.m │ │ │ │ │ │ │ │ │ ├── DLNameLabelCell.h │ │ │ │ │ │ │ │ │ └── DLNameLabelCell.m │ │ │ │ │ │ │ ├── CustomAlert │ │ │ │ │ │ │ │ ├── DLCustomAlertController.h │ │ │ │ │ │ │ │ └── DLCustomAlertController.m │ │ │ │ │ │ │ ├── Date │ │ │ │ │ │ │ │ ├── DLDateAnimation.h │ │ │ │ │ │ │ │ ├── DLDateAnimation.m │ │ │ │ │ │ │ │ ├── DLDateSelectController.h │ │ │ │ │ │ │ │ └── DLDateSelectController.m │ │ │ │ │ │ │ ├── Input │ │ │ │ │ │ │ │ ├── DLInputViewController.h │ │ │ │ │ │ │ │ └── DLInputViewController.m │ │ │ │ │ │ │ └── Time │ │ │ │ │ │ │ │ ├── DLTimeSelectController.h │ │ │ │ │ │ │ │ └── DLTimeSelectController.m │ │ │ │ │ │ └── Animation │ │ │ │ │ │ │ ├── DLAnimationBottom.h │ │ │ │ │ │ │ ├── DLAnimationBottom.m │ │ │ │ │ │ │ ├── DLAnimationCenterFromBottom.h │ │ │ │ │ │ │ ├── DLAnimationCenterFromBottom.m │ │ │ │ │ │ │ ├── DLAnimationCenterFromTop.h │ │ │ │ │ │ │ ├── DLAnimationCenterFromTop.m │ │ │ │ │ │ │ ├── DLAnimationFading.h │ │ │ │ │ │ │ ├── DLAnimationFading.m │ │ │ │ │ │ │ ├── DLAnimationInput.h │ │ │ │ │ │ │ ├── DLAnimationInput.m │ │ │ │ │ │ │ ├── DLAnimationLeft.h │ │ │ │ │ │ │ ├── DLAnimationLeft.m │ │ │ │ │ │ │ ├── DLAnimationRight.h │ │ │ │ │ │ │ ├── DLAnimationRight.m │ │ │ │ │ │ │ ├── DLAnimationTop.h │ │ │ │ │ │ │ └── DLAnimationTop.m │ │ │ │ │ ├── DLAlertDemoController.h │ │ │ │ │ ├── DLAlertDemoController.m │ │ │ │ │ ├── DLBaseAnimation.h │ │ │ │ │ └── DLBaseAnimation.m │ │ │ │ ├── DLUIViewController.h │ │ │ │ ├── DLUIViewController.m │ │ │ │ ├── InputView │ │ │ │ │ ├── DLTextInputViewController.h │ │ │ │ │ └── DLTextInputViewController.m │ │ │ │ ├── Map │ │ │ │ │ ├── BaiduMap │ │ │ │ │ │ └── Controller │ │ │ │ │ │ │ ├── BMKMapShowViewController.h │ │ │ │ │ │ │ ├── BMKMapShowViewController.m │ │ │ │ │ │ │ ├── BMKScreeningViewController.h │ │ │ │ │ │ │ └── BMKScreeningViewController.m │ │ │ │ │ ├── DLMapListViewController.h │ │ │ │ │ └── DLMapListViewController.m │ │ │ │ └── webview │ │ │ │ │ ├── DLWebViewController.h │ │ │ │ │ ├── DLWebViewController.m │ │ │ │ │ └── index.html │ │ │ ├── Model │ │ │ │ ├── DLAlertDataModel.h │ │ │ │ └── DLAlertDataModel.m │ │ │ └── Views │ │ │ │ ├── DLMainTableViewCell.h │ │ │ │ ├── DLMainTableViewCell.m │ │ │ │ ├── DLPwdTextField.h │ │ │ │ └── DLPwdTextField.m │ │ └── Video │ │ │ ├── DLVideoViewController.h │ │ │ └── DLVideoViewController.m │ └── Others │ │ ├── .DS_Store │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── SimpleFactory.imageset │ │ │ ├── Contents.json │ │ │ └── SimpleFactory.png │ │ ├── back_black_icon.imageset │ │ │ ├── Contents.json │ │ │ ├── back_black_icon@2x.png │ │ │ └── back_black_icon@3x.png │ │ ├── back_white_icon.imageset │ │ │ ├── Contents.json │ │ │ ├── back_white_icon@2x.png │ │ │ └── back_white_icon@3x.png │ │ ├── select-dark.imageset │ │ │ ├── Contents.json │ │ │ ├── select-dark@2x.png │ │ │ └── select-dark@3x.png │ │ └── select-light.imageset │ │ │ ├── Contents.json │ │ │ ├── select-light@2x.png │ │ │ └── select-light@3x.png │ │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ │ ├── Const.h │ │ ├── Info.plist │ │ ├── PrefixHeader.pch │ │ ├── Resources │ │ ├── area.json │ │ ├── city.json │ │ ├── hotCity.json │ │ └── province.json │ │ ├── RouteConfig.plist │ │ ├── SceneDelegate.h │ │ ├── SceneDelegate.m │ │ └── main.m ├── MixTTests │ ├── DLAddressAlertControllerTest.m │ ├── DLAlertDemoControllerTest.m │ ├── DLBaseAnimationTest.m │ ├── DLBinaryTreeTest.m │ ├── DLColorTest.m │ ├── DLLinkListTest.m │ ├── DLQueueTest.m │ ├── DLStackTest.m │ ├── DLTreeSetTest.m │ ├── DesignPatterns │ │ └── DLCashFactoryTest.m │ ├── Info.plist │ ├── UIViewTest.m │ └── __Tests.m ├── MixTUITests │ ├── Info.plist │ └── __UITests.m ├── Podfile └── Podfile.lock └── README.md /.gitignore.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | Pods/ 49 | *.lock 50 | Carthage/Build/ 51 | 52 | # fastlane 53 | # 54 | # It is recommended to not store the screenshots in the git repo. 55 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 56 | # For more information about the recommended setup visit: 57 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 58 | 59 | fastlane/report.xml 60 | fastlane/Preview.html 61 | fastlane/screenshots/**/*.png 62 | fastlane/test_output 63 | 64 | # Code Injection 65 | # 66 | # After new code Injection tools there's a generated folder /iOSInjectionProject 67 | # https://github.com/johnno1962/injectionforxcode 68 | 69 | iOSInjectionProject/ 70 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode11.5 3 | xcode_destination: platform=iOS Simulator,OS=13.5,name=iPhone 11 4 | 5 | before_install: 6 | - env 7 | - cd MixT && pod install 8 | - xcodebuild -version 9 | - xcodebuild -showsdks 10 | - xcpretty --version 11 | - xcrun instruments -w 'iPhone 11' || sleep 15 12 | 13 | script: 14 | - set -o pipefail 15 | - xcodebuild clean build -workspace "MixT.xcworkspace" -scheme "MixT" | xcpretty 16 | 17 | - xcodebuild test -workspace "MixT.xcworkspace" -scheme "MixT" -destination "$TRAVIS_XCODE_DESTINATION" -enableCodeCoverage YES | xcpretty 18 | 19 | after_success: 20 | - bash <(curl -s https://codecov.io/bash) 21 | -------------------------------------------------------------------------------- /MixT/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MixT/MixT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MixT/MixT.xcodeproj/project.xcworkspace/xcuserdata/Devil.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT.xcodeproj/project.xcworkspace/xcuserdata/Devil.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /MixT/MixT.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MixT/MixT.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MixT/MixT.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MixT/MixT.xcworkspace/xcuserdata/Devil.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT.xcworkspace/xcuserdata/Devil.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIButton+DLAdaptiveButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+DLAdaptiveButton.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/5. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | typedef enum : NSUInteger { 13 | DirectOptionVerticalTopImageBottomText, // The picture is above of the text 14 | DirectOptionVerticalTopTextBottomImage, // The text is above of the picture 15 | DirectOptionHorizontalLeftTextRightImage, // The text is on the left of the picture 16 | DirectOptionHorizontalLeftImageRightText, // The picture is on the right of the text 17 | } DirectOption; 18 | 19 | @interface UIButton (DLAdaptiveButton) 20 | 21 | /// 自适应图片文字(横向,左图片右文字)按钮 22 | /// @param title 按钮文字 23 | /// @param image 按钮图片 24 | - (instancetype)initHorizontalWithTitle:(NSString *)title image:(UIImage *)image; 25 | 26 | /// 自适应图片文字(竖向)按钮 27 | /// @param title 按钮文字 28 | /// @param image 按钮图片 29 | - (instancetype)initVerticalWithTitle:(NSString *)title image:(UIImage *)image; 30 | 31 | /// 自适应图片文字按钮 32 | /// @param title 按钮文字 33 | /// @param titleFont 按钮文字字体样式 34 | /// @param titleColor 按钮文字颜色 35 | /// @param image 按钮图片 36 | /// @param spacing 文字图片的间隔 37 | /// @param directOption 摆放样式 38 | - (instancetype)initWithTitle:(NSString *)title 39 | titleFont:(nullable UIFont *)titleFont 40 | titleColor:(nullable UIColor *)titleColor 41 | image:(UIImage *)image 42 | spacing:(CGFloat)spacing 43 | directOption:(DirectOption)directOption; 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIColor+DLAddtion.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+DLAddtion.h 3 | // 回顾 4 | // 5 | // Created by 周冰烽 on 2017/11/28. 6 | // Copyright © 2017年 devil. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (DLAddtion) 12 | 13 | + (instancetype)ColorWithRed:(uint8_t)red green:(uint8_t)green blue:(uint8_t)blue alpha:(CGFloat)alpha; 14 | 15 | + (instancetype)ColorWithHex:(uint32_t)hex alpha:(CGFloat)alpha; 16 | 17 | +(instancetype)RandomColor; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIColor+DLAddtion.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+DLAddtion.m 3 | // 回顾 4 | // 5 | // Created by 周冰烽 on 2017/11/28. 6 | // Copyright © 2017年 devil. All rights reserved. 7 | // 8 | 9 | #import "UIColor+DLAddtion.h" 10 | 11 | @implementation UIColor (DLAddtion) 12 | 13 | + (instancetype)ColorWithRed:(uint8_t)red green:(uint8_t)green blue:(uint8_t)blue alpha:(CGFloat)alpha { 14 | return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:alpha]; 15 | } 16 | 17 | + (instancetype)ColorWithHex:(uint32_t)hex alpha:(CGFloat)alpha { 18 | uint8_t red = (hex & 0xff0000) >> 16; 19 | uint8_t green = (hex & 0x00ff00) >> 8; 20 | uint8_t blue = hex & 0x0000ff; 21 | return [self ColorWithRed:red green:green blue:blue alpha:alpha]; 22 | } 23 | 24 | + (instancetype)RandomColor { 25 | return [UIColor ColorWithRed:arc4random_uniform(256) green:arc4random_uniform(256) blue:arc4random_uniform(256) alpha:1.0]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIImage+DLRotate.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DLRotate.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIImage (DLRotate) 14 | 15 | - (UIImage *)imageRotatedByDegrees:(CGFloat)degrees; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIImage+DLRotate.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DLRotate.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "UIImage+DLRotate.h" 10 | 11 | @implementation UIImage (DLRotate) 12 | 13 | static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; 14 | 15 | - (UIImage *)imageRotatedByDegrees:(CGFloat)degrees { 16 | // calculate the size of the rotated view's containing box for our drawing space 17 | UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.size.width, self.size.height)]; 18 | CGAffineTransform t = CGAffineTransformMakeRotation(DegreesToRadians(degrees)); 19 | rotatedViewBox.transform = t; 20 | CGSize rotatedSize = rotatedViewBox.frame.size; 21 | 22 | // Create the bitmap context 23 | UIGraphicsBeginImageContext(rotatedSize); 24 | CGContextRef bitmap = UIGraphicsGetCurrentContext(); 25 | 26 | // Move the origin to the middle of the image so we will rotate and scale around the center. 27 | CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2); 28 | 29 | // // Rotate the image context 30 | CGContextRotateCTM(bitmap, DegreesToRadians(degrees)); 31 | 32 | // Now, draw the rotated/scaled image into the context 33 | CGContextScaleCTM(bitmap, 1.0, -1.0); 34 | CGContextDrawImage(bitmap, CGRectMake(-self.size.width / 2, -self.size.height / 2, self.size.width, self.size.height), [self CGImage]); 35 | 36 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 37 | UIGraphicsEndImageContext(); 38 | return newImage; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIView+DLSize.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DLSize.h 3 | // 回顾 4 | // 5 | // Created by 周冰烽 on 2017/11/28. 6 | // Copyright © 2017年 devil. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DLSize) 12 | 13 | @property (nonatomic, assign) CGFloat x; 14 | 15 | @property (nonatomic, assign) CGFloat y; 16 | 17 | @property (nonatomic, assign) CGFloat width; 18 | 19 | @property (nonatomic, assign) CGFloat height; 20 | 21 | @property (nonatomic, assign) CGSize dl_size; 22 | 23 | @property (nonatomic, assign) CGPoint dl_origin; 24 | 25 | @property (nonatomic,assign) CGFloat centerX; 26 | 27 | @property (nonatomic,assign) CGFloat centerY; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MixT/MixT/Categories/UIView+DLSize.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DLSize.m 3 | // 回顾 4 | // 5 | // Created by 周冰烽 on 2017/11/28. 6 | // Copyright © 2017年 devil. All rights reserved. 7 | // 8 | 9 | #import "UIView+DLSize.h" 10 | 11 | @implementation UIView (DLSize) 12 | 13 | - (void)setX:(CGFloat)x{ 14 | CGRect rect = self.frame; 15 | rect.origin.x = x; 16 | self.frame = rect; 17 | } 18 | 19 | - (CGFloat)x{ 20 | return self.frame.origin.x; 21 | } 22 | 23 | - (void)setY:(CGFloat)y{ 24 | CGRect rect = self.frame; 25 | rect.origin.y = y; 26 | self.frame = rect; 27 | } 28 | 29 | - (CGFloat)y{ 30 | return self.frame.origin.y; 31 | } 32 | 33 | - (void)setWidth:(CGFloat)width{ 34 | CGRect rect = self.frame; 35 | rect.size.width = width; 36 | self.frame = rect; 37 | } 38 | 39 | - (CGFloat)width{ 40 | return self.frame.size.width; 41 | } 42 | 43 | - (void)setHeight:(CGFloat)height{ 44 | CGRect rect = self.frame; 45 | rect.size.height = height; 46 | self.frame = rect; 47 | } 48 | 49 | - (CGFloat)height{ 50 | return self.frame.size.height; 51 | } 52 | 53 | - (void)setDl_size:(CGSize)dl_size { 54 | CGRect rect = self.frame; 55 | rect.size = dl_size; 56 | self.frame = rect; 57 | } 58 | 59 | - (CGSize)dl_size { 60 | return self.frame.size; 61 | } 62 | 63 | - (void)setDl_origin:(CGPoint)dl_origin { 64 | CGRect rect = self.frame; 65 | rect.origin = dl_origin; 66 | self.frame = rect; 67 | } 68 | 69 | - (CGPoint)dl_origin { 70 | return self.frame.origin; 71 | } 72 | 73 | - (void)setCenterX:(CGFloat)centerX{ 74 | CGPoint center = self.center; 75 | center.x = centerX; 76 | self.center = center; 77 | } 78 | 79 | - (CGFloat)centerX{ 80 | return self.center.x; 81 | } 82 | 83 | - (void)setCenterY:(CGFloat)centerY{ 84 | CGPoint center = self.center; 85 | center.y = centerY; 86 | self.center = center; 87 | } 88 | 89 | - (CGFloat)centerY{ 90 | return self.center.y; 91 | } 92 | @end 93 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/DLBaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLNavigationBar.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DLBaseViewController : UIViewController 15 | 16 | /// 默认初始化 17 | - (void)setupUI; 18 | 19 | /// 默认带标题的导航栏 20 | - (void)setupTitleNaviBar; 21 | 22 | /// 默认带返回按钮和标题的导航栏 23 | - (void)setupTitleAndBackNaviBar; 24 | 25 | /// 自定义导航栏 26 | /// @param leftView 导航栏左方视图 27 | /// @param centerView 导航栏中间视图 28 | /// @param rightView 导航栏右边视图 29 | - (void)customNaviBarWithLeftView:(UIView *)leftView centerView:(UIView *)centerView rightView:(UIView *)rightView; 30 | 31 | - (void)clickBack; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/DLBaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | #import "UIButton+DLAdaptiveButton.h" 11 | 12 | @interface DLBaseViewController () 13 | 14 | @property(nonatomic, weak) DLNavigationBar * naviBar; 15 | 16 | @end 17 | 18 | @implementation DLBaseViewController 19 | 20 | #pragma mark - LifeCircle 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | [self setupUI]; 25 | } 26 | 27 | 28 | 29 | #pragma mark - UI context 30 | 31 | - (void)setupUI { 32 | self.view.backgroundColor = [UIColor screenColor]; 33 | // 隐藏自带导航栏 34 | [self.navigationController setNavigationBarHidden:YES]; 35 | // 默认设置一个带标题的导航栏 36 | [self setupTitleNaviBar]; 37 | } 38 | 39 | // 设置自定义导航栏(只带标题) 40 | - (void)setupTitleNaviBar { 41 | DLNavigationBar *naviBar = [[DLNavigationBar alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavigationBarHeight + kTopUnSafeAreaHeight + 1)]; 42 | UILabel *titleLabel = [[UILabel alloc] init]; 43 | titleLabel.text = self.title; 44 | titleLabel.textAlignment = NSTextAlignmentCenter; 45 | titleLabel.font = [UIFont boldSystemFontOfSize:18.0f]; 46 | titleLabel.textColor = [UIColor normalTextColor]; 47 | naviBar.navigationCenterBar = titleLabel; 48 | [self.naviBar removeFromSuperview]; 49 | self.naviBar = naviBar; 50 | [self.view addSubview:self.naviBar]; 51 | } 52 | 53 | // 设置自定义导航栏(带标题和返回按钮) 54 | - (void)setupTitleAndBackNaviBar { 55 | DLNavigationBar *naviBar = [[DLNavigationBar alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavigationBarHeight + kTopUnSafeAreaHeight + 1)]; 56 | UILabel *titleLabel = [[UILabel alloc] init]; 57 | titleLabel.text = self.title; 58 | titleLabel.textAlignment = NSTextAlignmentCenter; 59 | titleLabel.font = [UIFont boldSystemFontOfSize:18.0f]; 60 | titleLabel.textColor = [UIColor normalTextColor]; 61 | naviBar.navigationCenterBar = titleLabel; 62 | UIButton *leftButton = [[UIButton alloc] initHorizontalWithTitle:@"返回" image:[UIImage backIcon]]; 63 | [leftButton addTarget:self action:@selector(clickBack) forControlEvents:UIControlEventTouchUpInside]; 64 | naviBar.navigationLeftBar = leftButton; 65 | [self.naviBar removeFromSuperview]; 66 | self.naviBar = naviBar; 67 | [self.view addSubview:self.naviBar]; 68 | } 69 | 70 | - (void)customNaviBarWithLeftView:(UIView *)leftView centerView:(UIView *)centerView rightView:(UIView *)rightView { 71 | DLNavigationBar *naviBar = [[DLNavigationBar alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavigationBarHeight + kTopUnSafeAreaHeight + 1)]; 72 | naviBar.navigationLeftBar = leftView; 73 | naviBar.navigationCenterBar = centerView; 74 | naviBar.navigationRightBar = rightView; 75 | [self.naviBar removeFromSuperview]; 76 | self.naviBar = naviBar; 77 | [self.view addSubview:self.naviBar]; 78 | } 79 | 80 | #pragma mark - ClickEvent 81 | 82 | - (void)clickBack { 83 | [self.navigationController popViewControllerAnimated:YES]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/DLCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCommon.h 3 | // MixT 4 | // 5 | // Created by zhoubingfeng on 6.1.22. 6 | // Copyright © 2022 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCommon : NSObject 14 | 15 | @property (nonatomic, strong) UIColor *themeColor; 16 | 17 | @property (nonatomic, strong) UIColor *screenColor; 18 | 19 | @property (nonatomic, strong) UIColor *boldBlackTextColor; 20 | 21 | @property (nonatomic, strong) UIColor *normalTextColor; 22 | 23 | @property (nonatomic, strong) UIColor *navigationColor; 24 | 25 | @property (nonatomic, strong) UIColor *lineColor; 26 | 27 | @property (nonatomic, strong) UIColor *detailTextColor; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/DLCommon.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLCommon.m 3 | // MixT 4 | // 5 | // Created by zhoubingfeng on 6.1.22. 6 | // Copyright © 2022 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCommon.h" 10 | 11 | @implementation DLCommon 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/View/DLBaseTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseTableViewCell.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/6. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLBaseTableViewCell : UITableViewCell 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/View/DLBaseTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseTableViewCell.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/6. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseTableViewCell.h" 10 | 11 | @implementation DLBaseTableViewCell 12 | 13 | // 分割线 14 | - (void)drawRect:(CGRect)rect { 15 | CGContextRef context = UIGraphicsGetCurrentContext(); 16 | CGContextSetFillColorWithColor(context, [UIColor screenColor].CGColor); 17 | CGContextFillRect(context, rect); 18 | 19 | CGContextSetStrokeColorWithColor(context, [UIColor lineColor].CGColor); 20 | CGContextStrokeRect(context, CGRectMake(10, rect.size.height - 1, kScreenWidth, 1.0)); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/View/DLNavigationBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLNavigationBar.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLNavigationBar : UIView 14 | 15 | @property(nonatomic, weak) UIView * navigationLeftBar; 16 | 17 | @property(nonatomic, weak) UIView * navigationCenterBar; 18 | 19 | @property(nonatomic, weak) UIView * navigationRightBar; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Base/View/DLNavigationBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLNavigationBar.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLNavigationBar.h" 10 | #import "UIColor+DLAddtion.h" 11 | @interface DLNavigationBar() 12 | 13 | @property(nonatomic, weak) UIView * unAreaView; 14 | 15 | @property(nonatomic, weak) UIView * navigationBar; 16 | 17 | @end 18 | 19 | @implementation DLNavigationBar 20 | 21 | - (instancetype)init { 22 | if (self = [super init]) { 23 | [self setupUI]; 24 | } 25 | return self; 26 | } 27 | 28 | - (instancetype)initWithFrame:(CGRect)frame { 29 | if (self = [super initWithFrame:frame]) { 30 | [self setupUI]; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)setupUI { 36 | // 安全区域 37 | UIView *unAreaView = [[UIView alloc] init]; 38 | unAreaView.backgroundColor = [UIColor navigationColor]; 39 | [self addSubview:unAreaView]; 40 | [unAreaView mas_makeConstraints:^(MASConstraintMaker *make) { 41 | make.left.right.top.equalTo(self); 42 | make.height.mas_equalTo(kTopUnSafeAreaHeight); 43 | }]; 44 | self.unAreaView = unAreaView; 45 | // 导航栏交互区 46 | UIView *navigationBar = [[UIView alloc] init]; 47 | navigationBar.backgroundColor = [UIColor navigationColor]; 48 | [self addSubview:navigationBar]; 49 | [navigationBar mas_makeConstraints:^(MASConstraintMaker *make) { 50 | make.left.right.equalTo(self); 51 | make.top.equalTo(unAreaView.mas_bottom); 52 | make.height.mas_equalTo(kNavigationBarHeight); 53 | }]; 54 | self.navigationBar = navigationBar; 55 | 56 | CALayer *bottomLayer = [CALayer layer]; 57 | bottomLayer.backgroundColor = [UIColor lineColor].CGColor; 58 | bottomLayer.frame = CGRectMake(0, kTopUnSafeAreaHeight + kNavigationBarHeight, kScreenWidth, 0.3); 59 | [self.layer addSublayer:bottomLayer]; 60 | 61 | } 62 | 63 | - (void)setNavigationLeftBar:(UIView *)navigationLeftBar { 64 | [self.navigationBar addSubview:navigationLeftBar]; 65 | [navigationLeftBar mas_makeConstraints:^(MASConstraintMaker *make) { 66 | make.left.equalTo(self.navigationBar).offset(10); 67 | make.centerY.equalTo(self.navigationBar); 68 | make.width.mas_equalTo(navigationLeftBar.width); 69 | make.height.mas_equalTo(navigationLeftBar.height); 70 | }]; 71 | } 72 | 73 | - (void)setNavigationRightBar:(UIView *)navigationRightBar { 74 | [self.navigationBar addSubview:navigationRightBar]; 75 | [navigationRightBar mas_makeConstraints:^(MASConstraintMaker *make) { 76 | make.left.equalTo(self.navigationBar).offset(10); 77 | make.centerY.equalTo(self.navigationBar); 78 | make.width.mas_equalTo(navigationRightBar.width); 79 | make.height.mas_equalTo(navigationRightBar.height); 80 | }]; 81 | } 82 | 83 | - (void)setNavigationCenterBar:(UIView *)navigationCenterBar { 84 | [self.navigationBar addSubview:navigationCenterBar]; 85 | [navigationCenterBar mas_makeConstraints:^(MASConstraintMaker *make) { 86 | make.centerX.equalTo(self.navigationBar); 87 | make.centerY.equalTo(self.navigationBar).offset(-2.5); 88 | }]; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/DLTestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTestViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTestViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/DLTestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTestViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTestViewController.h" 10 | 11 | @interface DLTestViewController () 12 | 13 | @end 14 | 15 | @implementation DLTestViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor screenColor]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/DLMainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLMainViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLMainViewController : UITabBarController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/DLMainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLMainViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLMainViewController.h" 10 | #import "DLBaseViewController.h" 11 | #import "DLNavigationController.h" 12 | #import "GKNavigationController.h" 13 | 14 | //#import 15 | 16 | @interface DLMainViewController () 17 | 18 | @end 19 | 20 | @implementation DLMainViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.view.backgroundColor = [UIColor whiteColor]; 25 | // [Platform sharedInstance]; 26 | [self addChildControllerWithTitle:@"UI" clsName:@"DLUIViewController"]; 27 | [self addChildControllerWithTitle:@"DSA" clsName:@"DLSystemViewController"]; 28 | [self addChildControllerWithTitle:@"Network" clsName:@"DLNetworkViewController"]; 29 | [self addChildControllerWithTitle:@"Video" clsName:@"DLVideoViewController"]; 30 | } 31 | 32 | - (void)addChildControllerWithTitle:(NSString *)title clsName:(NSString *)clsName { 33 | Class cls = NSClassFromString(clsName); 34 | DLBaseViewController *vc = [[cls alloc] init]; 35 | vc.title = title; 36 | // DLNavigationController *navi = [[DLNavigationController alloc] initWithRootViewController:vc]; 37 | GKNavigationController *navi = [[GKNavigationController alloc] initWithRootViewController:vc]; 38 | [self addChildViewController:navi]; 39 | } 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/DLNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLNavigationController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/12. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLNavigationController : UINavigationController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/DLNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLNavigationController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/12. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLNavigationController.h" 10 | 11 | @interface DLNavigationController () 12 | 13 | @end 14 | 15 | @implementation DLNavigationController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | } 20 | 21 | 22 | - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { 23 | if (self.viewControllers.count > 0) { 24 | viewController.hidesBottomBarWhenPushed = YES; 25 | } 26 | [super pushViewController:viewController animated:animated]; 27 | } 28 | 29 | 30 | 31 | #pragma mark - LazyLoad 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/Main/Navigation/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UIImage+GKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Category.h 3 | // GKNavigationController 4 | // 5 | // Created by QuintGao on 2017/6/20. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GKCategory) 12 | 13 | // 根据颜色创建UIImage 14 | + (UIImage *)imageWithColor:(UIColor *)color; 15 | 16 | + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UIImage+GKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Category.m 3 | // GKNavigationController 4 | // 5 | // Created by QuintGao on 2017/6/20. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import "UIImage+GKCategory.h" 10 | 11 | @implementation UIImage (GKCategory) 12 | 13 | // 根据颜色创建UIImage 14 | + (UIImage *)imageWithColor:(UIColor *)color { 15 | return [self imageWithColor:color size:CGSizeMake(1.0, 1.0)]; 16 | } 17 | 18 | + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size { 19 | CGRect rect = CGRectMake(0, 0, size.width, size.height); 20 | 21 | UIGraphicsBeginImageContext(size); 22 | 23 | CGContextRef context = UIGraphicsGetCurrentContext(); 24 | 25 | CGContextSetFillColorWithColor(context, color.CGColor); 26 | 27 | CGContextFillRect(context, rect); 28 | 29 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 30 | 31 | UIGraphicsEndImageContext(); 32 | 33 | return image; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UIScrollView+GKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+GKCategory.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/22. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 此类主要是用来处理UIScrollView与滑动返回手势的冲突问题 8 | 9 | #import 10 | 11 | @interface UIScrollView (GKCategory) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UIScrollView+GKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+GKCategory.m 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/22. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import "UIScrollView+GKCategory.h" 10 | 11 | @implementation UIScrollView (GKCategory) 12 | 13 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 14 | if ([self panBack:gestureRecognizer]) { 15 | return NO; 16 | } 17 | return YES; 18 | } 19 | 20 | 21 | -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 22 | { 23 | if ([self panBack:gestureRecognizer]) { 24 | return YES; 25 | } 26 | 27 | return NO; 28 | } 29 | 30 | - (BOOL)panBack:(UIGestureRecognizer *)gestureRecognizer { 31 | if (gestureRecognizer == self.panGestureRecognizer) { 32 | CGPoint point = [self.panGestureRecognizer translationInView:self]; 33 | UIGestureRecognizerState state = gestureRecognizer.state; 34 | 35 | // 设置手势滑动的位置距屏幕左边的区域 36 | CGFloat locationDistance = [UIScreen mainScreen].bounds.size.width; 37 | 38 | if (state == UIGestureRecognizerStateBegan || state == UIGestureRecognizerStatePossible) { 39 | CGPoint location = [gestureRecognizer locationInView:self]; 40 | if (point.x > 0 && location.x < locationDistance && self.contentOffset.x <= 0) { 41 | return YES; 42 | } 43 | } 44 | } 45 | return NO; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UITabBarController+GKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarController+GKCategory.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/25. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UITabBarController (GKCategory) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UITabBarController+GKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITabBarController+GKCategory.m 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/25. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import "UITabBarController+GKCategory.h" 10 | 11 | @implementation UITabBarController (GKCategory) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/UIViewController+GKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Category.h 3 | // GKNavigationController 4 | // 5 | // Created by QuintGao on 2017/6/20. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const GKViewControllerPropertyChangedNotification; 12 | 13 | @class GKNavigationController, GKWrapViewController; 14 | 15 | @protocol GKNavigationItemCustomProtocol 16 | 17 | @optional 18 | 19 | - (UIBarButtonItem *)gk_customBackItemWithTarget:(id)target action:(SEL)action; 20 | 21 | @end 22 | 23 | @interface UIViewController (GKCategory) 24 | 25 | /** 是否禁止当前控制器的滑动返回(包括全屏返回和边缘返回) */ 26 | @property (nonatomic, assign) BOOL gk_interactivePopDisabled; 27 | 28 | /** 是否禁止当前控制器的全屏滑动返回 */ 29 | @property (nonatomic, assign) BOOL gk_fullScreenPopDisabled; 30 | 31 | /** 全屏滑动时,滑动区域距离屏幕左边的最大位置,默认是0,表示全屏都可滑动 */ 32 | @property (nonatomic, assign) CGFloat gk_popMaxAllowedDistanceToLeftEdge; 33 | 34 | /** 设置导航栏的透明度 */ 35 | @property (nonatomic, assign) CGFloat gk_navBarAlpha; 36 | 37 | 38 | @end 39 | 40 | @interface UINavigationController (GKCategory) 41 | 42 | - (void)setNavBarAlpha:(CGFloat)alpha; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/btn_back_white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/Main/Navigation/Category/btn_back_white@2x.png -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/Category/btn_back_white@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/Main/Navigation/Category/btn_back_white@3x.png -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKNavigationController.h 3 | // GKNavigationController 4 | // 5 | // Created by QuintGao on 2017/6/20. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIViewController+GKCategory.h" 11 | 12 | /** 13 | 根导航控制器 14 | */ 15 | @interface GKNavigationController : UINavigationController 16 | 17 | /** 获取当前显示的控制器中的contentViewController */ 18 | @property (nonatomic, strong, readonly) UIViewController *gk_visibleViewController; 19 | 20 | /** 获取当前栈顶的控制器中的contentViewController */ 21 | @property (nonatomic, strong, readonly) UIViewController *gk_topViewController; 22 | 23 | /** 获取所有的contentViewController */ 24 | @property (nonatomic, strong, readonly) NSArray <__kindof UIViewController *> *gk_viewControllers; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKPanGestureHandler/GKFullScreenPanGestureRecognizerDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKFullScreenPanGestureRecognizerDelegate.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 这个类主要用来处理全屏滑动手势的代理方法 8 | 9 | #import 10 | 11 | @class GKNavigationController; 12 | 13 | @interface GKFullScreenPanGestureRecognizerDelegate : NSObject 14 | 15 | /** 16 | 根控制器 17 | */ 18 | @property (nonatomic, weak) GKNavigationController *navigationController; 19 | 20 | /** 21 | 系统返回手势的target 22 | */ 23 | @property (nonatomic, strong) id popGestureTarget; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKPanGestureHandler/GKFullScreenPanGestureRecognizerDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GKFullScreenPanGestureRecognizerDelegate.m 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import "GKFullScreenPanGestureRecognizerDelegate.h" 10 | #import "GKNavigationController.h" 11 | 12 | @implementation GKFullScreenPanGestureRecognizerDelegate 13 | 14 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 15 | // 获取当前控制器的导航栏的最顶层控制器的内容控制器 16 | UIViewController *topContentViewController = self.navigationController.gk_topViewController; 17 | // NSLog(@"%@-----%d", topContentViewController, topContentViewController.gk_interactivePopDisabled); 18 | // 获取系统手势的action 19 | SEL action = NSSelectorFromString(@"handleNavigationTransition:"); 20 | 21 | // 禁止手势滑动返回 22 | if (topContentViewController.gk_interactivePopDisabled) return NO; 23 | 24 | // 正在做过渡动画 25 | if ([[self.navigationController valueForKey:@"_isTransitioning"] boolValue]) return NO; 26 | 27 | // 自定义手势处理 28 | if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { 29 | UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gestureRecognizer; 30 | 31 | // 获取手势的速度位置 32 | CGPoint velocity = [panGesture velocityInView:panGesture.view]; 33 | if (velocity.x < 0) { // 向左滑动push操作 34 | 35 | }else { // 向右滑动pop操作,使用系统的pop方法 36 | // 首先处理禁止pop的操作--控制器设置的最大滑动距离 37 | CGPoint beginningLocation = [panGesture locationInView:panGesture.view]; 38 | CGFloat maxAllowDistance = topContentViewController.gk_popMaxAllowedDistanceToLeftEdge; 39 | 40 | if (maxAllowDistance > 0 && beginningLocation.x > maxAllowDistance && !topContentViewController.gk_fullScreenPopDisabled) { 41 | return NO; 42 | }else { 43 | // 添加系统的pop操作 44 | [gestureRecognizer addTarget:self.popGestureTarget action:action]; 45 | } 46 | } 47 | } 48 | return YES; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKWrapViewController/GKWrapNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKWrapNavigationController.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface GKWrapNavigationController : UINavigationController 13 | 14 | /** 15 | 用于包装导航控制器的控制器 16 | */ 17 | @property (nonatomic, strong) UIViewController *gk_wrapViewContorller; 18 | 19 | + (instancetype)wrapNavigationControllerWithViewController:(UIViewController *)viewController; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKWrapViewController/GKWrapViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GKWrapViewController.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | /* 说明:此类是用来将传入的UIViewController 包装一个导航控制器(GKWrapNavigationController),然后再包装一个 9 | UIViewController(GKWrapViewController),并将包装后的控制器返回 10 | */ 11 | 12 | #import 13 | 14 | @interface GKWrapViewController : UIViewController 15 | 16 | /** 17 | 这里用来记录包装前的控制器 18 | */ 19 | @property (nonatomic, strong, readonly) __kindof UIViewController *contentViewController; 20 | 21 | /** 22 | 包装控制器的方法 23 | 24 | @param viewController 将要包装的控制器 25 | @return 包装后的控制器 26 | */ 27 | + (instancetype)wrapViewControllerWithViewController:(UIViewController *)viewController; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKWrapViewController/UIViewController+GKNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+GKNavigationController.h 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 此类用户获取方便开发,用户不必关心 8 | 9 | #import 10 | 11 | @class GKWrapViewController, GKNavigationController; 12 | 13 | @interface UIViewController (GKNavigationController) 14 | 15 | /** 16 | 控制器对应的包装后的控制器 17 | */ 18 | @property (nonatomic, strong) GKWrapViewController *gk_wrapViewController; 19 | 20 | /** 21 | 控制器的根控制器 22 | */ 23 | @property (nonatomic, strong, readonly) GKNavigationController *gk_navigationController; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Main/Navigation/GKWrapViewController/UIViewController+GKNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+GKNavigationController.m 3 | // GKNavigationControllerDemo 4 | // 5 | // Created by QuintGao on 2017/6/23. 6 | // Copyright © 2017年 高坤. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+GKNavigationController.h" 10 | #import "GKNavigationController.h" 11 | #import 12 | 13 | static NSString *const GKWrapViewControllerKey = @"GKWrapViewControllerKey"; 14 | static NSString *const GKNavigationControllerKey = @"GKNavigationControllerKey"; 15 | 16 | @implementation UIViewController (GKNavigationController) 17 | 18 | 19 | - (GKWrapViewController *)gk_wrapViewController { 20 | return objc_getAssociatedObject(self, &GKWrapViewControllerKey); 21 | } 22 | 23 | - (void)setGk_wrapViewController:(GKWrapViewController *)gk_wrapViewController { 24 | objc_setAssociatedObject(self, &GKWrapViewControllerKey, gk_wrapViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 25 | } 26 | 27 | - (GKNavigationController *)gk_navigationController { 28 | UIViewController *vc = self; 29 | while (vc && ![vc isKindOfClass:[GKNavigationController class]]) { 30 | vc = vc.navigationController; 31 | } 32 | return (GKNavigationController *)vc; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Network/DLNetworkViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLNetworkViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLNetworkViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Network/DLNetworkViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLNetworkViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLNetworkViewController.h" 10 | 11 | @interface DLNetworkViewController () 12 | 13 | @end 14 | 15 | @implementation DLNetworkViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | /* 23 | #pragma mark - Navigation 24 | 25 | // In a storyboard-based application, you will often want to do a little preparation before navigation 26 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 27 | // Get the new view controller using [segue destinationViewController]. 28 | // Pass the selected object to the new view controller. 29 | } 30 | */ 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Resources/Color/UIColor+DLGlobalColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+DLGlobalColor.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/4. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (DLGlobalColor) 12 | 13 | + (UIColor *)themeColor; 14 | 15 | + (UIColor *)screenColor; 16 | 17 | + (UIColor *)boldBlackTextColor; 18 | 19 | + (UIColor *)normalTextColor; 20 | 21 | + (UIColor *)navigationColor; 22 | 23 | + (UIColor *)lineColor; 24 | 25 | + (UIColor *)detailTextColor; 26 | 27 | + (UIColor *)dl_redColor; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Resources/Image/UIImage+DLGlobalImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DLGlobalImage.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/5. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIImage (DLGlobalImage) 14 | 15 | + (instancetype)backIcon; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Resources/Image/UIImage+DLGlobalImage.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DLGlobalImage.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/5. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "UIImage+DLGlobalImage.h" 10 | 11 | @implementation UIImage (DLGlobalImage) 12 | 13 | + (instancetype)backIcon { 14 | if (@available(iOS 13.0, *)) { 15 | if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) { 16 | return [UIImage imageNamed:@"back_black_icon"]; 17 | } else { 18 | return [UIImage imageNamed:@"back_white_icon"]; 19 | } 20 | } else { 21 | return [UIImage imageNamed:@"back_black_icon"]; 22 | } 23 | } 24 | 25 | /// 重新绘制图片尺寸 26 | /// @param image 要绘制的图片 27 | /// @param size 绘制后的大小 28 | + (instancetype)scaleImage:(UIImage *)image toSize:(CGSize)size { 29 | UIImage *oldImage = image; 30 | UIImage *newImage = nil; 31 | 32 | UIGraphicsBeginImageContext(size); 33 | 34 | CGRect rect = CGRectZero; 35 | rect.origin = CGPointZero; 36 | rect.size.width = size.width; 37 | rect.size.height = size.height; 38 | 39 | [oldImage drawInRect:rect]; 40 | newImage = UIGraphicsGetImageFromCurrentImageContext(); 41 | UIGraphicsEndImageContext(); 42 | return newImage; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DLSystemViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLSystemViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLSystemViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DLUMLImageViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLUMLImageViewController.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLUMLImageViewController : UIViewController 14 | 15 | @property(nonatomic, copy) NSString * imageName; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DLUMLImageViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLUMLImageViewController.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLUMLImageViewController.h" 10 | #import "UIButton+DLAdaptiveButton.h" 11 | #import "UIImage+DLRotate.h" 12 | @interface DLUMLImageViewController () 13 | 14 | @end 15 | 16 | @implementation DLUMLImageViewController 17 | 18 | - (void)clickBack { 19 | [self dismissViewControllerAnimated:YES completion:nil]; 20 | } 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.view.backgroundColor = [UIColor screenColor]; 25 | UIButton *leftButton = [[UIButton alloc] initHorizontalWithTitle:@"返回" image:[UIImage backIcon]]; 26 | [leftButton addTarget:self action:@selector(clickBack) forControlEvents:UIControlEventTouchUpInside]; 27 | [self.view addSubview:leftButton]; 28 | [leftButton mas_makeConstraints:^(MASConstraintMaker *make) { 29 | make.left.equalTo(self.view).offset(20); 30 | make.top.equalTo(self.view).offset(40); 31 | make.width.mas_equalTo(@80); 32 | make.height.mas_equalTo(@40); 33 | }]; 34 | 35 | UIImageView *imageView = [[UIImageView alloc] init]; 36 | UIImage *image = [UIImage imageNamed:self.imageName]; 37 | imageView.image = [image imageRotatedByDegrees:90.0f]; 38 | [self.view addSubview:imageView]; 39 | [imageView mas_makeConstraints:^(MASConstraintMaker *make) { 40 | make.left.right.bottom.equalTo(self.view); 41 | make.top.equalTo(leftButton.mas_bottom); 42 | }]; 43 | 44 | 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LeetCode/二叉树/DLBinaryTreePractice.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBinaryTreePractice.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/31. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLBinaryTreePractice : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LeetCode/二叉树/DLTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTree : NSObject 14 | 15 | @property(nonatomic, assign) NSInteger val; 16 | 17 | @property(nonatomic, strong) NSMutableArray * children; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LeetCode/二叉树/DLTree.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTree.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTree.h" 10 | 11 | @implementation DLTree 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LeetCode/栈/DLStackPractice.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLStackPractice.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/13. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLStackPractice : NSObject 14 | 15 | - (void)test; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LeetCode/链表/DLLinkListPractice.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLLinkListPractice.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/12. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLLinkListPractice : NSObject 14 | 15 | - (void)test; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLCircleLinkList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCircleLinkList.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/12. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 双向环形链表 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCircleLinkList : NSObject 14 | 15 | /// 获取index位置的节点存储的元素 16 | /// @param index 位置 17 | - (id __nullable)getWithIndex:(NSInteger)index; 18 | 19 | /// 更改index位置节点存储的元素 20 | /// @param index 位置 21 | /// @param object 要存储的元素 22 | - (id __nullable)setWithIndex:(NSInteger)index object:(id __nullable)object; 23 | 24 | /// 在index位置添加object元素 25 | /// @param object 元素 26 | /// @param index 位置 27 | - (void)addObject:(id __nullable)object index:(NSInteger)index; 28 | 29 | /// 在链表最后位置添加元素 30 | /// @param object 元素 31 | - (void)addObject:(id __nullable)object; 32 | 33 | /// 删除index位置的元素 34 | /// @param index 位置 35 | - (id __nullable)removeWithIndex:(NSInteger)index; 36 | 37 | /// 查看object的位置 38 | /// @param object 元素 39 | - (NSInteger)indexOfObject:(id __nullable)object; 40 | 41 | /// 清空链表 42 | - (void)clear; 43 | 44 | /// 链表长度 45 | - (NSInteger)size; 46 | 47 | /// 链表是否为空 48 | - (BOOL)isEmpty; 49 | 50 | /// 链表是否包含object元素 51 | /// @param object 元素 52 | - (BOOL)containsObject:(id __nullable)object; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLLinkList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLLinkList.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 双向链表 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLLinkList : NSObject 14 | 15 | /// 获取index位置的节点存储的元素 16 | /// @param index 位置 17 | - (id __nullable)getWithIndex:(NSInteger)index; 18 | 19 | /// 更改index位置节点存储的元素 20 | /// @param index 位置 21 | /// @param object 要存储的元素 22 | - (id __nullable)setWithIndex:(NSInteger)index object:(id __nullable)object; 23 | 24 | /// 在index位置添加object元素 25 | /// @param object 元素 26 | /// @param index 位置 27 | - (void)addObject:(id __nullable)object index:(NSInteger)index; 28 | 29 | /// 在链表最后位置添加元素 30 | /// @param object 元素 31 | - (void)addObject:(id __nullable)object; 32 | 33 | /// 删除index位置的元素 34 | /// @param index 位置 35 | - (id __nullable)removeWithIndex:(NSInteger)index; 36 | 37 | /// 查看object的位置 38 | /// @param object 元素 39 | - (NSInteger)indexOfObject:(id __nullable)object; 40 | 41 | /// 清空链表 42 | - (void)clear; 43 | 44 | /// 链表长度 45 | - (NSInteger)size; 46 | 47 | /// 链表是否为空 48 | - (BOOL)isEmpty; 49 | 50 | /// 链表是否包含object元素 51 | /// @param object 元素 52 | - (BOOL)containsObject:(id __nullable)object; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLNode.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLNode : NSObject 14 | 15 | @property(nonatomic, strong) id object; 16 | 17 | @property(nonatomic, strong) DLNode * next; 18 | 19 | @property(nonatomic, strong) DLNode * prev; 20 | 21 | 22 | - (instancetype)initWithPrev:(DLNode * __nullable)prev Object:(id __nullable)object next:(DLNode * __nullable)next; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLNode.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLNode.h" 10 | 11 | @implementation DLNode 12 | 13 | - (instancetype)initWithPrev:(DLNode *)prev Object:(id)object next:(DLNode *)next { 14 | if (self = [super init]) { 15 | self.prev = prev; 16 | self.object = object; 17 | self.next = next; 18 | } 19 | return self; 20 | } 21 | 22 | - (void)dealloc { 23 | NSLog(@"DLNode 释放"); 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLSingleCircleList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLSingleCircleList.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/12. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 单向环形链表 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLSingleCircleList : NSObject 14 | 15 | /// 获取index位置的节点存储的元素 16 | /// @param index 位置 17 | - (id __nullable)getWithIndex:(NSInteger)index; 18 | 19 | /// 更改index位置节点存储的元素 20 | /// @param index 位置 21 | /// @param object 要存储的元素 22 | - (id __nullable)setWithIndex:(NSInteger)index object:(id __nullable)object; 23 | 24 | /// 在index位置添加object元素 25 | /// @param object 元素 26 | /// @param index 位置 27 | - (void)addObject:(id __nullable)object index:(NSInteger)index; 28 | 29 | /// 在链表最后位置添加元素 30 | /// @param object 元素 31 | - (void)addObject:(id __nullable)object; 32 | 33 | /// 删除index位置的元素 34 | /// @param index 位置 35 | - (id)removeWithIndex:(NSInteger)index; 36 | 37 | /// 查看object的位置 38 | /// @param object 元素 39 | - (NSInteger)indexOfObject:(id __nullable)object; 40 | 41 | /// 清空链表 42 | - (void)clear; 43 | 44 | /// 链表长度 45 | - (NSInteger)size; 46 | 47 | /// 链表是否为空 48 | - (BOOL)isEmpty; 49 | 50 | /// 链表是否包含object元素 51 | /// @param object 元素 52 | - (BOOL)containsObject:(id __nullable)object; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLSingleLinkList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLSingleLinkList.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/7. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 单向链表的简单实现 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLSingleLinkList : NSObject 14 | 15 | /// 获取index位置的节点存储的元素 16 | /// @param index 位置 17 | - (id __nullable)getWithIndex:(NSInteger)index; 18 | 19 | /// 更改index位置节点存储的元素 20 | /// @param index 位置 21 | /// @param object 要存储的元素 22 | - (id __nullable)setWithIndex:(NSInteger)index object:(id __nullable)object; 23 | 24 | /// 在index位置添加object元素 25 | /// @param object 元素 26 | /// @param index 位置 27 | - (void)addObject:(id __nullable)object index:(NSInteger)index; 28 | 29 | /// 在链表最后位置添加元素 30 | /// @param object 元素 31 | - (void)addObject:(id __nullable)object; 32 | 33 | /// 删除index位置的元素 34 | /// @param index 位置 35 | - (id)removeWithIndex:(NSInteger)index; 36 | 37 | /// 查看object的位置 38 | /// @param object 元素 39 | - (NSInteger)indexOfObject:(id __nullable)object; 40 | 41 | /// 清空链表 42 | - (void)clear; 43 | 44 | /// 链表长度 45 | - (NSInteger)size; 46 | 47 | /// 链表是否为空 48 | - (BOOL)isEmpty; 49 | 50 | /// 链表是否包含object元素 51 | /// @param object 元素 52 | - (BOOL)containsObject:(id __nullable)object; 53 | 54 | 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLSingleNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLSingleNode.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLSingleNode : NSObject 14 | 15 | @property(nonatomic, strong) id object; 16 | 17 | @property(nonatomic, strong) DLSingleNode * next; 18 | 19 | - (instancetype)initWithObject:(id __nullable)object next:(DLSingleNode * __nullable)next; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/LinkList/DLSingleNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLSingleNode.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/8/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLSingleNode.h" 10 | 11 | @implementation DLSingleNode 12 | 13 | - (instancetype)initWithObject:(id)object next:(DLSingleNode *)next { 14 | if (self = [super init]) { 15 | self.object = object; 16 | self.next = next; 17 | } 18 | return self; 19 | } 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Queue/DLDeque.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLDeque.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/14. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 双端队列 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLDeque : NSObject 14 | 15 | /// 队列长度 16 | - (NSInteger)size; 17 | 18 | /// 队列是否为空 19 | - (BOOL)isEmpty; 20 | 21 | /// 入队(队头) 22 | /// @param element 入队元素 23 | - (void)enQueueFront:(id __nullable)element; 24 | 25 | /// 入队(队尾) 26 | /// @param element 入队元素 27 | - (void)enQueueRear:(id __nullable)element; 28 | 29 | /// 出队(队头) 30 | - (id __nullable)deQueueFront; 31 | 32 | /// 出队(队尾) 33 | - (id __nullable)deQueueRear; 34 | 35 | /// 队头元素 36 | - (id __nullable)front; 37 | 38 | /// 队尾元素 39 | - (id __nullable)rear; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Queue/DLDeque.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLDeque.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/14. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLDeque.h" 10 | #import "DLLinkList.h" 11 | 12 | @interface DLDeque () 13 | 14 | @property(nonatomic, strong) DLLinkList * list; 15 | 16 | @end 17 | 18 | @implementation DLDeque 19 | 20 | - (instancetype)init { 21 | if (self = [super init]) { 22 | self.list = [[DLLinkList alloc] init]; 23 | } 24 | return self; 25 | } 26 | 27 | /// 队列长度 28 | - (NSInteger)size { 29 | return self.list.size; 30 | } 31 | 32 | /// 队列是否为空 33 | - (BOOL)isEmpty { 34 | return self.list.isEmpty; 35 | } 36 | 37 | /// 入队(队头) 38 | /// @param element 入队元素 39 | - (void)enQueueFront:(id __nullable)element { 40 | [self.list addObject:element index:0]; 41 | } 42 | 43 | /// 入队(队尾) 44 | /// @param element 入队元素 45 | - (void)enQueueRear:(id __nullable)element { 46 | [self.list addObject:element]; 47 | } 48 | 49 | /// 出队(队头) 50 | - (id __nullable)deQueueFront { 51 | return [self.list removeWithIndex:0]; 52 | } 53 | 54 | /// 出队(队尾) 55 | - (id __nullable)deQueueRear { 56 | return [self.list removeWithIndex:self.list.size - 1]; 57 | } 58 | 59 | /// 队头元素 60 | - (id __nullable)front { 61 | return [self.list getWithIndex:0];; 62 | } 63 | 64 | /// 队尾元素 65 | - (id __nullable)rear { 66 | return [self.list getWithIndex:self.list.size - 1]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Queue/DLQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLQueue.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/14. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 基础队列 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLQueue : NSObject 14 | 15 | /// 队列长度 16 | - (NSInteger)size; 17 | 18 | /// 队列是否为空 19 | - (BOOL)isEmpty; 20 | 21 | /// 入队 22 | /// @param element 入队元素 23 | - (void)enQueue:(id __nullable)element; 24 | 25 | /// 出队 26 | -(id __nullable)deQueue; 27 | 28 | /// 队头元素 29 | -(id __nullable)front; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Queue/DLQueue.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLQueue.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/14. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLQueue.h" 10 | #import "DLLinkList.h" 11 | 12 | 13 | @interface DLQueue() 14 | 15 | @property(nonatomic, strong) DLLinkList * list; 16 | 17 | @end 18 | 19 | @implementation DLQueue 20 | 21 | - (instancetype)init { 22 | if (self = [super init]) { 23 | self.list = [[DLLinkList alloc] init]; 24 | } 25 | return self; 26 | } 27 | 28 | /// 队列长度 29 | - (NSInteger)size { 30 | return self.list.size; 31 | } 32 | 33 | /// 队列是否为空 34 | - (BOOL)isEmpty { 35 | return self.list.isEmpty; 36 | } 37 | 38 | /// 入队 39 | /// @param element 入队元素 40 | - (void)enQueue:(id __nullable)element { 41 | [self.list addObject:element]; 42 | } 43 | 44 | /// 出队 45 | -(id __nullable)deQueue { 46 | return [self.list removeWithIndex:0]; 47 | } 48 | 49 | /// 队头元素 50 | -(id __nullable)front { 51 | return [self.list getWithIndex:0]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Set/DLTreeSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTreeSet.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/10/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLCompareProtocol.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTreeSet : NSObject 14 | 15 | + (instancetype)set; 16 | 17 | /// 传入比较器(遵循DLCompareProtocol协议的) 18 | /// @param comparator 比较器 19 | + (instancetype)setWithComparator:(_Nullable id)comparator; 20 | 21 | /// 集合大小 22 | - (NSInteger)size; 23 | 24 | /// 集合是否为空 25 | - (BOOL)isEmpty; 26 | 27 | /// 清空集合 28 | - (void)clear; 29 | 30 | /// 是否包含元素 31 | /// @param object 元素 32 | - (BOOL)containsObject:(NSObject *)object; 33 | 34 | /// 添加元素 35 | /// @param object 元素 36 | - (void)addObject:(NSObject *)object; 37 | 38 | /// 删除元素 39 | /// @param object 元素 40 | - (void)removeObject:(NSObject *)object; 41 | 42 | /// 遍历 43 | /// @param block 遍历结果 44 | - (void)traversalBlock:(void(^)(id object, BOOL *stop))block; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Set/DLTreeSet.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTreeSet.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/10/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTreeSet.h" 10 | #import "DLRedBlackTree.h" 11 | 12 | @interface DLTreeSet() 13 | 14 | @property(nonatomic, strong) DLRedBlackTree * tree; 15 | 16 | @end 17 | 18 | @implementation DLTreeSet 19 | 20 | #pragma mark - 初始化方法 21 | 22 | + (instancetype)set { 23 | return [self setWithComparator:nil]; 24 | } 25 | 26 | + (instancetype)setWithComparator:(id)comparator { 27 | DLTreeSet *set = [[self alloc] init]; 28 | set.tree = [DLRedBlackTree treeWithComparator:comparator]; 29 | return set; 30 | } 31 | 32 | #pragma mark - public 33 | 34 | - (NSInteger)size { 35 | return self.tree.size; 36 | } 37 | 38 | - (BOOL)isEmpty { 39 | return self.tree.isEmpty; 40 | } 41 | 42 | - (void)clear { 43 | [self.tree clear]; 44 | } 45 | 46 | - (BOOL)containsObject:(NSObject *)object { 47 | return [self.tree containsObject:object]; 48 | } 49 | 50 | - (void)addObject:(NSObject *)object { 51 | [self.tree addObject:object]; 52 | } 53 | 54 | - (void)removeObject:(NSObject *)object { 55 | [self.tree removeObject:object]; 56 | } 57 | 58 | - (void)traversalBlock:(void (^)(id _Nonnull, BOOL * _Nonnull))block { 59 | [self.tree inorderTraversalBlock:block]; 60 | } 61 | 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Stack/DLStack.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLStack.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/13. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLStack : NSObject 14 | 15 | /// 栈的长度 16 | - (NSInteger)size; 17 | 18 | /// 栈是否为空 19 | - (BOOL)isEmpty; 20 | 21 | /// 入栈 22 | /// @param object 入栈元素 23 | - (void)push:(id __nullable)object; 24 | 25 | /// 出栈,返回出栈元素 26 | - (id __nullable)pop; 27 | 28 | /// 查看栈顶元素 29 | - (id __nullable)peek; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Stack/DLStack.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLStack.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/13. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLStack.h" 10 | #import "DLLinkList.h" 11 | 12 | @interface DLStack () 13 | 14 | @property(nonatomic, strong) DLLinkList * list; 15 | 16 | @end 17 | 18 | @implementation DLStack 19 | 20 | - (instancetype)init { 21 | if (self = [super init]) { 22 | self.list = [[DLLinkList alloc] init]; 23 | } 24 | return self; 25 | } 26 | 27 | - (NSInteger)size { 28 | return self.list.size; 29 | } 30 | 31 | - (BOOL)isEmpty { 32 | return self.list.isEmpty; 33 | } 34 | 35 | - (void)push:(id __nullable)object { 36 | [self.list addObject:object]; 37 | } 38 | 39 | - (id __nullable)pop { 40 | return [self.list removeWithIndex:self.list.size - 1]; 41 | } 42 | 43 | - (id __nullable)peek { 44 | return [self.list getWithIndex:self.list.size - 1]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLAVLTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAVLTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/7. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // AVL树 8 | 9 | #import "DLBalanceBinarySearchTree.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAVLTree : DLBalanceBinarySearchTree 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLAVLTreeNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAVLTreeNode.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTreeNode.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAVLTreeNode : DLTreeNode 14 | 15 | @property(nonatomic, assign) NSInteger height; 16 | 17 | + (instancetype)AVLTreeWithObject:(id)object node:(DLTreeNode *)parent; 18 | 19 | - (NSInteger)balanceFactor; 20 | 21 | - (void)updateHeight; 22 | 23 | - (DLTreeNode *)tallerChild; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLAVLTreeNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAVLTreeNode.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAVLTreeNode.h" 10 | 11 | @implementation DLAVLTreeNode 12 | 13 | + (instancetype)AVLTreeWithObject:(id)object node:(DLTreeNode *)parent { 14 | DLAVLTreeNode *node = [super nodeWithObject:object parent:parent]; 15 | node.height = 1; 16 | return node; 17 | } 18 | 19 | - (DLTreeNode *)tallerChild { 20 | NSInteger leftHeight = self.left ? ((DLAVLTreeNode *)self.left).height : 0; 21 | NSInteger rightHeight = self.right ? ((DLAVLTreeNode *)self.right).height : 0; 22 | if (leftHeight > rightHeight) return self.left; 23 | if (leftHeight < rightHeight) return self.right; 24 | return [self isLeftChild] ? self.left : self.right; 25 | } 26 | 27 | - (NSInteger)balanceFactor { 28 | NSInteger leftHeight = self.left ? ((DLAVLTreeNode *)self.left).height : 0; 29 | NSInteger rightHeight = self.right ? ((DLAVLTreeNode *)self.right).height : 0; 30 | return leftHeight - rightHeight; 31 | } 32 | 33 | - (void)updateHeight { 34 | NSInteger leftHeight = self.left ? ((DLAVLTreeNode *)self.left).height : 0; 35 | NSInteger rightHeight = self.right ? ((DLAVLTreeNode *)self.right).height : 0; 36 | self.height = 1 + MAX(leftHeight, rightHeight); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLBalanceBinarySearchTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBalanceBinarySearchTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBinarySearchTree.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLBalanceBinarySearchTree : DLBinarySearchTree 14 | 15 | - (void)rotateRoot:(DLTreeNode *)r 16 | b:(DLTreeNode *)b c:(DLTreeNode *)c 17 | d:(DLTreeNode *)d 18 | e:(DLTreeNode *)e f:(DLTreeNode *)f; 19 | 20 | /// 对节点进行左旋转 21 | /// @param grand 节点 22 | - (void)rotateLeftNode:(DLTreeNode *)grand; 23 | 24 | /// 对节点进行右旋转 25 | /// @param grand 节点 26 | - (void)rotateRightNode:(DLTreeNode *)grand; 27 | 28 | 29 | - (void)afterRotateGrand:(DLTreeNode *)grand parent:(DLTreeNode *)parent child:(DLTreeNode *)child; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLBalanceBinarySearchTree.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLBalanceBinarySearchTree.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBalanceBinarySearchTree.h" 10 | 11 | @implementation DLBalanceBinarySearchTree 12 | 13 | - (void)rotateRoot:(DLTreeNode *)r 14 | b:(DLTreeNode *)b c:(DLTreeNode *)c 15 | d:(DLTreeNode *)d 16 | e:(DLTreeNode *)e f:(DLTreeNode *)f { 17 | d.parent = r.parent; 18 | if ([r isLeftChild]) r.parent.left = d; 19 | else if ([r isRightChild]) r.parent.right = d; 20 | else _root = d; 21 | 22 | b.right = c; 23 | if (!c) c.parent = b; 24 | 25 | f.left = e; 26 | if (!e) e.parent = f; 27 | 28 | d.left = b; 29 | b.parent = d; 30 | d.right = f; 31 | f.parent = d; 32 | } 33 | 34 | /// 对节点进行左旋转 35 | /// @param grand 节点 36 | - (void)rotateLeftNode:(DLTreeNode *)grand { 37 | DLTreeNode *parent = grand.right; 38 | DLTreeNode *child = parent.left; 39 | grand.right = child; 40 | parent.left = grand; 41 | [self afterRotateGrand:grand parent:parent child:child]; 42 | } 43 | 44 | /// 对节点进行右旋转 45 | /// @param grand 节点 46 | - (void)rotateRightNode:(DLTreeNode *)grand { 47 | DLTreeNode *parent = grand.left; 48 | DLTreeNode *child = parent.right; 49 | grand.left = child; 50 | parent.right = grand; 51 | [self afterRotateGrand:grand parent:parent child:child]; 52 | } 53 | 54 | - (void)afterRotateGrand:(DLTreeNode *)grand parent:(DLTreeNode *)parent child:(DLTreeNode *)child { 55 | // 更新parent的父节点 56 | parent.parent = grand.parent; 57 | if ([grand isLeftChild]) { 58 | grand.parent.left = parent; 59 | } else if ([grand isRightChild]) { 60 | grand.parent.right = parent; 61 | } else { 62 | _root = parent; 63 | } 64 | 65 | // 更新child的父节点 66 | if(child) child.parent = grand; 67 | 68 | // 更新grand的父节点 69 | grand.parent = parent; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLBinarySearchTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBinarySearchTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/18. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLCompareProtocol.h" 11 | 12 | #import "DLBinaryTree.h" 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface DLBinarySearchTree : DLBinaryTree 16 | 17 | + (instancetype)tree; 18 | 19 | /// 传入比较器(遵循DLCompareProtocol协议的) 20 | /// @param comparator 比较器 21 | + (instancetype)treeWithComparator:(_Nullable id)comparator; 22 | 23 | /// 实例方法 24 | /// @param compareBlock 重写object1和object2的比较方法 25 | + (instancetype)treeWithCompareBlock:(int(^)(id object1, id object2))compareBlock; 26 | 27 | - (DLTreeNode *)createNodeWithObject:(id)object parent:(DLTreeNode * _Nullable)parent; 28 | 29 | /// 添加树节点 30 | /// @param object 节点内容 31 | - (void)addObject:(id)object; 32 | 33 | /// 树是否包含某节点 34 | /// @param object 节点内容 35 | - (BOOL)containsObject:(id)object; 36 | 37 | /// 删除树节点 38 | /// @param object 节点内容 39 | - (void)removeObject:(id)object; 40 | 41 | #pragma mark - 提供给子类重写的方法 42 | 43 | /// 二叉搜索树添加完成之后所做的平衡操作 44 | - (void)afterAddObjectWithNode:(DLTreeNode *)node; 45 | 46 | /// 二叉树删除节点之后所做的平衡操作 47 | - (void)afterRemoveNode:(DLTreeNode *)node; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLBinaryTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBinaryTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLTreeNode.h" 11 | #import "MJBinaryTreeInfo.h" 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DLBinaryTree : NSObject { 15 | @protected 16 | DLTreeNode *_root; 17 | NSInteger _size; 18 | } 19 | 20 | + (instancetype)tree; 21 | 22 | /// 节点数量 23 | - (NSInteger)size; 24 | 25 | /// 树是否为空 26 | - (BOOL)isEmpty; 27 | 28 | /// 清空树 29 | - (void)clear; 30 | 31 | /// 树的高度(递归) 32 | - (NSInteger)treeHeight; 33 | 34 | /// 树的高度(迭代) 35 | - (NSInteger)treeHeight1; 36 | 37 | /// 是否为完全二叉树 38 | - (BOOL)isCompleteBinaryTree; 39 | 40 | /// 前驱节点 41 | /// @param node 当前节点 42 | - (DLTreeNode *)predecessor:(DLTreeNode *)node; 43 | 44 | /// 后继节点 45 | /// @param node 当前节点 46 | - (DLTreeNode *)successsor:(DLTreeNode *)node; 47 | 48 | 49 | 50 | /// 前序遍历 51 | /// @param block 遍历block 52 | - (void)preorderTraversalBlock:(void(^)(id object, BOOL *stop))block; 53 | 54 | /// 中序遍历 55 | /// @param block 遍历block 56 | - (void)inorderTraversalBlock:(void(^)(id object, BOOL *stop))block; 57 | 58 | /// 后序遍历 59 | /// @param block 遍历block 60 | - (void)postOrderTraversalBlock:(void(^)(id object, BOOL *stop))block; 61 | 62 | /// 层序遍历 63 | /// @param block 遍历block 64 | - (void)levelOrderTraversalBlock:(BOOL(^)(id object, BOOL *stop))block; 65 | 66 | @end 67 | 68 | NS_ASSUME_NONNULL_END 69 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLCompareProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCompareProtocol.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/24. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol DLCompareProtocol 14 | @required 15 | 16 | - (int)compareWithObject1:(id)object1 object2:(id)object2; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLRedBlackTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLRedBlackTree.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBalanceBinarySearchTree.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLRedBlackTree : DLBalanceBinarySearchTree 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLRedBlackTreeNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLRedBlackTreeNode.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTreeNode.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLRedBlackTreeNode : DLTreeNode 14 | 15 | @property(nonatomic, assign) BOOL color; 16 | 17 | + (instancetype)RBNodeWithObject:(id)object parent:(DLTreeNode *)parent; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLRedBlackTreeNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLRedBlackTreeNode.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/9/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLRedBlackTreeNode.h" 10 | 11 | @implementation DLRedBlackTreeNode 12 | 13 | + (instancetype)RBNodeWithObject:(id)object parent:(DLTreeNode *)parent { 14 | DLRedBlackTreeNode *node = [super nodeWithObject:object parent:parent]; 15 | node.color = NO; // 默认是红色 16 | return node; 17 | } 18 | 19 | - (NSString *)description { 20 | NSString *str = @""; 21 | if (!self.color) { 22 | str = @"R_"; 23 | } 24 | return [NSString stringWithFormat:@"%@%@",str, self.object]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLTreeNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTreeNode.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/18. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTreeNode : NSObject 14 | 15 | @property(nonatomic, strong) id object; 16 | 17 | @property(nonatomic, strong) DLTreeNode * _Nullable left; 18 | 19 | @property(nonatomic, strong) DLTreeNode * _Nullable right; 20 | 21 | @property(nonatomic, weak) DLTreeNode * _Nullable parent; 22 | // 兄弟节点 23 | @property(nonatomic, strong) DLTreeNode * sibling; 24 | 25 | /// 度为2的节点 26 | @property(nonatomic, assign) BOOL hasTwoChild; 27 | 28 | /// 是否为叶子节点 29 | @property(nonatomic, assign) BOOL isLeaf; 30 | 31 | /// 是否为父节点的左子树 32 | - (BOOL)isLeftChild; 33 | 34 | /// 是否为父节点的右子树 35 | - (BOOL)isRightChild; 36 | 37 | + (instancetype)nodeWithObject:(id)object parent:(DLTreeNode * _Nullable)parent; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/DLTreeNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTreeNode.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/8/18. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTreeNode.h" 10 | 11 | @implementation DLTreeNode 12 | 13 | + (instancetype)nodeWithObject:(id)object parent:(DLTreeNode * _Nullable)parent { 14 | DLTreeNode *node = [[self alloc] init]; 15 | node.object = object; 16 | node.parent = parent; 17 | return node; 18 | } 19 | 20 | - (DLTreeNode *)sibling { 21 | if ([self isLeftChild]) return self.parent.right; 22 | if ([self isRightChild]) return self.parent.left; 23 | return nil; 24 | } 25 | 26 | - (BOOL)hasTwoChild { 27 | return self.left && self.right; 28 | } 29 | 30 | - (BOOL)isLeaf { 31 | return !self.left && !self.right; 32 | } 33 | 34 | - (BOOL)isLeftChild { 35 | return (self.parent) && (self == self.parent.left); 36 | } 37 | 38 | - (BOOL)isRightChild { 39 | return (self.parent) && (self == self.parent.right); 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJBinaryTrees.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJBinaryTrees.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MJBinaryTreeInfo.h" 11 | #import "MJLevelOrderPrinter.h" 12 | #import "MJInorderPrinter.h" 13 | 14 | typedef NS_ENUM(NSInteger, MJPrintStyle) { 15 | MJPrintStyleLevelOrder, 16 | MJPrintStyleInorder 17 | }; 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | @interface MJBinaryTrees : NSObject 22 | + (void)println:(id)tree style:(MJPrintStyle)style; 23 | + (void)println:(id)tree; 24 | 25 | + (void)print:(id)tree style:(MJPrintStyle)style; 26 | + (void)print:(id)tree; 27 | 28 | + (NSString *)printString:(id)tree style:(MJPrintStyle)style; 29 | + (NSString *)printString:(id)tree; 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJBinaryTrees.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJBinaryTrees.m 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "MJBinaryTrees.h" 10 | 11 | @implementation MJBinaryTrees 12 | 13 | + (void)println:(id)tree style:(MJPrintStyle)style { 14 | [[self _printerWithTree:tree style:style] println]; 15 | } 16 | 17 | + (void)println:(id)tree { 18 | [self println:tree style:MJPrintStyleLevelOrder]; 19 | } 20 | 21 | + (void)print:(id)tree style:(MJPrintStyle)style { 22 | [[self _printerWithTree:tree style:style] print]; 23 | } 24 | 25 | + (void)print:(id)tree { 26 | [self print:tree style:MJPrintStyleLevelOrder]; 27 | } 28 | 29 | + (NSString *)printString:(id)tree style:(MJPrintStyle)style { 30 | return [self _printerWithTree:tree style:style].printString; 31 | } 32 | 33 | + (NSString *)printString:(id)tree { 34 | return [self printString:tree style:MJPrintStyleLevelOrder]; 35 | } 36 | 37 | + (MJPrinter *)_printerWithTree:(id)tree style:(MJPrintStyle)style { 38 | if (!tree) return nil; 39 | if (style == MJPrintStyleLevelOrder) { 40 | return [MJLevelOrderPrinter printerWithTree:tree]; 41 | } 42 | return [MJInorderPrinter printerWithTree:tree]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJBinaryTreeInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJBinaryTreeInfo.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol MJBinaryTreeInfo 14 | @required 15 | /** 16 | * who is the root node 17 | */ 18 | - (id)root; 19 | /** 20 | * how to get the left child of the node 21 | */ 22 | - (id)left:(id)node; 23 | /** 24 | * how to get the right child of the node 25 | */ 26 | - (id)right:(id)node; 27 | /** 28 | * how to print the node 29 | */ 30 | - (id)string:(id)node; 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJInorderPrinter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJInorderPrinter.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "MJPrinter.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | /* 14 | ┌──100 15 | ┌──85 16 | │ └──71 17 | ┌──69 18 | 38 19 | │ ┌──36 20 | │ ┌──34 21 | │ │ └──29 22 | └──18 23 | └──4 24 | */ 25 | @interface MJInorderPrinter : MJPrinter 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJInorderPrinter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJInorderPrinter.m 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "MJInorderPrinter.h" 10 | #import "NSString+Trees.h" 11 | 12 | @implementation MJInorderPrinter 13 | 14 | static NSString *rightAppend; 15 | static NSString *leftAppend; 16 | static NSString *blankAppend; 17 | static NSString *lineAppend; 18 | 19 | + (void)initialize { 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | int length = 2; 23 | rightAppend = [NSString stringWithFormat:@"┌%@", [@"─" mj_repeat:length]]; 24 | leftAppend = [NSString stringWithFormat:@"└%@", [@"─" mj_repeat:length]]; 25 | blankAppend = [NSString mj_blank:length + 1]; 26 | lineAppend = [NSString stringWithFormat:@"│%@", [NSString mj_blank:length]]; 27 | }); 28 | } 29 | 30 | /** 31 | * 生成node节点的字符串 32 | * nodePrefix node那一行的前缀字符串 33 | * leftPrefix node整棵左子树的前缀字符串 34 | * rightPrefix node整棵右子树的前缀字符串 35 | */ 36 | - (NSString *)_printString:(id)node 37 | nodePrefix:(NSMutableString *)nodePrefix 38 | leftPrefix:(NSMutableString *)leftPrefix 39 | rightPrefix:(NSMutableString *)rightPrefix { 40 | id left = [self.tree left:node]; 41 | id right = [self.tree right:node]; 42 | NSString *string = [[self.tree string:node] description]; 43 | 44 | NSUInteger length = string.length; 45 | if (length % 2 == 0) { 46 | length--; 47 | } 48 | length >>= 1; 49 | 50 | NSMutableString *nodeString = [NSMutableString string]; 51 | if (right) { 52 | [rightPrefix appendString:[NSString mj_blank:length]]; 53 | [nodeString appendString:[self _printString:right 54 | nodePrefix:[NSMutableString stringWithFormat:@"%@%@", rightPrefix, rightAppend] 55 | leftPrefix:[NSMutableString stringWithFormat:@"%@%@", rightPrefix, lineAppend] 56 | rightPrefix:[NSMutableString stringWithFormat:@"%@%@", rightPrefix, blankAppend]]]; 57 | } 58 | [nodeString appendString:nodePrefix]; 59 | [nodeString appendString:string]; 60 | [nodeString appendString:@"\n"]; 61 | if (left) { 62 | [leftPrefix appendString:[NSString mj_blank:length]]; 63 | [nodeString appendString:[self _printString:left 64 | nodePrefix:[NSMutableString stringWithFormat:@"%@%@", leftPrefix, leftAppend] 65 | leftPrefix:[NSMutableString stringWithFormat:@"%@%@", leftPrefix, blankAppend] 66 | rightPrefix:[NSMutableString stringWithFormat:@"%@%@", leftPrefix, lineAppend]]]; 67 | } 68 | return nodeString; 69 | } 70 | 71 | - (NSString *)printString { 72 | NSMutableString *string = [NSMutableString string]; 73 | [string appendString:[self _printString:[self.tree root] 74 | nodePrefix:[NSMutableString string] 75 | leftPrefix:[NSMutableString string] 76 | rightPrefix:[NSMutableString string]]]; 77 | [string deleteCharactersInRange:NSMakeRange(string.length - 1, 1)]; 78 | return string; 79 | } 80 | @end 81 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJLevelOrderPrinter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJLevelOrderPrinter.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "MJPrinter.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | /* 14 | ┌───38──┐ 15 | │ │ 16 | ┌─18─┐ 69─┐ 17 | │ │ │ 18 | 4 ┌─34─┐ ┌─85─┐ 19 | │ │ │ │ 20 | 29 36 71 100 21 | */ 22 | @interface MJLevelOrderPrinter : MJPrinter 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJPrinter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJPrinter.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MJBinaryTreeInfo.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface MJPrinter : NSObject 15 | @property (nonatomic, strong) id tree; 16 | + (instancetype)printerWithTree:(id)tree; 17 | - (void)println; 18 | - (void)print; 19 | - (NSString *)printString; 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/MJPrinter/MJPrinter.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJPrinter.m 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "MJPrinter.h" 10 | 11 | @interface MJPrinter() 12 | @end 13 | 14 | @implementation MJPrinter 15 | 16 | + (instancetype)printerWithTree:(id)tree { 17 | MJPrinter *printer = [[self alloc] init]; 18 | printer.tree = tree; 19 | return printer; 20 | } 21 | 22 | - (void)println { 23 | [self print]; 24 | printf("\n"); 25 | } 26 | 27 | - (void)print { 28 | printf("%s", self.printString.UTF8String); 29 | } 30 | 31 | - (NSString *)printString { 32 | return nil; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/NSString+Trees.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Trees.h 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSString (Trees) 14 | + (NSString *)mj_blank:(NSUInteger)count; 15 | - (NSString *)mj_repeat:(NSUInteger)count; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DataStructure/Tree/MJBinaryTrees/NSString+Trees.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Trees.m 3 | // BinaryTreePrinterOC 4 | // 5 | // Created by MJ Lee on 2019/5/1. 6 | // Copyright © 2019 MJ Lee. All rights reserved. 7 | // 8 | 9 | #import "NSString+Trees.h" 10 | 11 | @implementation NSString (Trees) 12 | 13 | - (NSString *)mj_repeat:(NSUInteger)count { 14 | NSMutableString *string = [NSMutableString string]; 15 | while (count-- > 0) { 16 | [string appendString:self]; 17 | } 18 | return string; 19 | } 20 | 21 | + (NSString *)mj_blank:(NSUInteger)count { 22 | return [@" " mj_repeat:count]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/DLDesignMainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLDesignMainViewController.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLDesignMainViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/DLDesignMainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLDesignMainViewController.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLDesignMainViewController.h" 10 | #import "DLMainTableViewCell.h" 11 | 12 | #define CellID @"DesignTableViewCellID" 13 | 14 | @interface DLDesignMainViewController () 15 | 16 | @property(nonatomic, weak) UITableView * tableView; 17 | 18 | @property(nonatomic, strong) NSArray * dataSource; 19 | 20 | @end 21 | 22 | @implementation DLDesignMainViewController 23 | 24 | - (void)setupUI { 25 | [super setupUI]; 26 | self.title = @"设计模式"; 27 | [super setupTitleAndBackNaviBar]; 28 | self.dataSource = @[@"简单工厂模式", @"策略模式", @"单一职责原则", @"开放-封闭原则", @"依赖倒转原则", @"装饰模式", @"代理模式", @"工厂方法模式", @"原型模式", 29 | @"模板方法模式", @"迪米特法则", @"外观模式", @"建造者模式", @"观察者模式", @"抽象工厂模式", @"状态模式", @"适配器模式", @"备忘录模式", 30 | @"组合模式", @"迭代器模式", @"单例模式", @"桥接模式", @"命令模式", @"职责链模式", @"中介者模式", @"享元模式", @"解释器模式", @"访问者模式"]; 31 | UITableView *tableView = [[UITableView alloc] init]; 32 | tableView.frame = CGRectMake(0, kNavigationBarHeight + kTopUnSafeAreaHeight, kScreenWidth, kScreenHeight - kNavigationBarHeight - kTabbarHeight - kBottomUnSafeAreaHeight); 33 | tableView.delegate = self; 34 | tableView.dataSource = self; 35 | tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 36 | [tableView registerClass:[DLMainTableViewCell class] forCellReuseIdentifier:CellID]; 37 | [self.view insertSubview:tableView atIndex:0]; 38 | } 39 | 40 | #pragma mark - UITableViewDelegate && dataSource 41 | 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 43 | return self.dataSource.count; 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 47 | DLMainTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID]; 48 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 49 | cell.titleText = self.dataSource[indexPath.row]; 50 | return cell; 51 | } 52 | 53 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 54 | DLBaseViewController *vc = nil; 55 | switch (indexPath.row) { 56 | case 0: 57 | vc = [[NSClassFromString(@"DLCalculateViewController") alloc] init]; 58 | break; 59 | case 1: 60 | vc = [[NSClassFromString(@"DLStrategyPatternViewController") alloc] init]; 61 | break; 62 | default: 63 | vc = [[NSClassFromString(@"DLCalculateViewController") alloc] init]; 64 | break; 65 | 66 | } 67 | [self.navigationController pushViewController:vc animated:YES]; 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/NumberTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // NumberTextField.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/20. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface NumberTextField : UIView 13 | 14 | @property(nonatomic, assign) CGFloat res; 15 | 16 | @property(nonatomic, copy) NSString * placeholder; 17 | 18 | @property(nonatomic, copy) NSString * text; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateAdd.h: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateAdd.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import "CalculateTool.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateAdd : CalculateTool 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateAdd.m: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateAdd.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 加法类 7 | 8 | #import "CalculateAdd.h" 9 | 10 | @implementation CalculateAdd 11 | 12 | - (CGFloat)calculateToolResult { 13 | return self.num1 + self.num2; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateDivide.h: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateDivide.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import "CalculateTool.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateDivide : CalculateTool 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateDivide.m: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateDivide.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 除法类 7 | 8 | #import "CalculateDivide.h" 9 | 10 | @implementation CalculateDivide 11 | 12 | - (CGFloat)calculateToolResult { 13 | if (self.num2 == 0) { 14 | NSLog(@"除数不能为0"); 15 | return 0; 16 | } 17 | return self.num1 / self.num2; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateFactory.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import 9 | #import "CalculateTool.h" 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateFactory : NSObject 13 | 14 | - (CalculateTool *)calculateWithOperation:(NSString *)operation; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateFactory.m: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateFactory.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import "CalculateFactory.h" 9 | #import "CalculateAdd.h" 10 | #import "CalculateReduce.h" 11 | #import "CalculateTake.h" 12 | #import "CalculateDivide.h" 13 | @implementation CalculateFactory 14 | 15 | - (CalculateTool *)calculateWithOperation:(NSString *)operation { 16 | if ([operation isEqualToString:@"+"]) { 17 | return [[CalculateAdd alloc] init]; 18 | } else if ([operation isEqualToString:@"-"]) { 19 | return [[CalculateReduce alloc] init]; 20 | } else if ([operation isEqualToString:@"*"]) { 21 | return [[CalculateTake alloc] init]; 22 | } else if ([operation isEqualToString:@"/"]) { 23 | return [[CalculateDivide alloc] init]; 24 | } else { 25 | NSLog(@"输入运算符不合法"); 26 | return nil; 27 | } 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateReduce.h: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateReduce.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import "CalculateTool.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateReduce : CalculateTool 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateReduce.m: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateReduce.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 减法类 7 | 8 | #import "CalculateReduce.h" 9 | 10 | @implementation CalculateReduce 11 | 12 | - (CGFloat)calculateToolResult { 13 | return self.num1 - self.num2; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateTake.h: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateTake.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 7 | 8 | #import "CalculateTool.h" 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateTake : CalculateTool 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateTake.m: -------------------------------------------------------------------------------- 1 | // 2 | // CalculateTake.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/22. 6 | // 乘法类 7 | 8 | #import "CalculateTake.h" 9 | 10 | @implementation CalculateTake 11 | 12 | - (CGFloat)calculateToolResult { 13 | return self.num1 * self.num2; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // CaculateTool.h 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/20. 6 | // 计算类 7 | 8 | #import 9 | #import 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface CalculateTool : NSObject 13 | 14 | @property(nonatomic, assign) CGFloat num1; 15 | 16 | @property(nonatomic, assign) CGFloat num2; 17 | 18 | - (CGFloat)calculateToolResult; 19 | 20 | //+ (NSString *)getResultWithNum1:(CGFloat)num1 num2:(CGFloat)num2 operation:(NSString *)operation; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/Caculate业务类/CalculateTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // CaculateTool.m 3 | // 设计模式-01 4 | // 5 | // Created by 周冰烽 on 2020/12/20. 6 | // 7 | 8 | #import "CalculateTool.h" 9 | 10 | @implementation CalculateTool 11 | 12 | - (CGFloat)calculateToolResult { 13 | return 0; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/SimpleFactoryModel/DLCalculateViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCalculateViewController.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCalculateViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashContext.h 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/7. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCashContext : NSObject 14 | 15 | - (instancetype)initWithType:(NSString *)type; 16 | 17 | - (CGFloat)getResultWithAmount:(CGFloat)amount; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashContext.m 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/7. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashContext.h" 10 | #import "DLCashSuper.h" 11 | #import "DLCashNormal.h" 12 | #import "DLCashReturn.h" 13 | #import "DLCashRebate.h" 14 | @implementation DLCashContext{ 15 | DLCashSuper *_cs; 16 | } 17 | 18 | // 满减活动和打折活动有bug,暂时想不到如何修复 19 | - (instancetype)initWithType:(NSString *)type { 20 | if (self = [super init]) { 21 | DLCashSuper *cash = nil; 22 | if ([type isEqualToString:@"正常收费"]) { 23 | 24 | cash = [[DLCashNormal alloc] init]; 25 | 26 | } else if ([type hasPrefix:@"满"]) { 27 | 28 | // 满减活动 29 | NSArray *arr = [type componentsSeparatedByString:@"减"]; 30 | CGFloat amount = [self extractNumberFromString:arr[0]]; 31 | CGFloat reduce = [self extractNumberFromString:arr[1]]; 32 | cash = [[DLCashReturn alloc] initWithAmount:amount reduce:reduce]; 33 | 34 | } else if ([type hasPrefix:@"打"]) { 35 | 36 | // 打折活动 37 | CGFloat rebate = [self extractNumberFromString:type]; 38 | cash = [[DLCashRebate alloc] initWithRebate:rebate]; 39 | 40 | } else { 41 | 42 | // 错误类型, 比如直接调用传入随机的字符串 43 | NSLog(@"选择了未知的折扣类型"); 44 | 45 | } 46 | 47 | _cs = cash; 48 | } 49 | return self; 50 | } 51 | 52 | - (CGFloat)getResultWithAmount:(CGFloat)amount { 53 | return [_cs acceptCashWithAmount:amount]; 54 | } 55 | 56 | /// 提取字符串中的数字 57 | /// @param string 字符串 58 | - (double)extractNumberFromString:(NSString *)string { 59 | NSScanner *scanner = [NSScanner scannerWithString:string]; 60 | [scanner scanUpToCharactersFromSet:[NSCharacterSet decimalDigitCharacterSet] intoString:nil]; 61 | double number; 62 | [scanner scanDouble:&number]; 63 | return number; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashNormal.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashNormal.h 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashSuper.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCashNormal : DLCashSuper 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashNormal.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashNormal.m 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashNormal.h" 10 | 11 | @implementation DLCashNormal 12 | 13 | // Override 14 | - (CGFloat)acceptCashWithAmount:(CGFloat)amount { 15 | // 原价返回 16 | return amount; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashRebate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLRebate.h 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashSuper.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCashRebate : DLCashSuper 14 | 15 | - (instancetype)initWithRebate:(CGFloat)rebate; 16 | 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashRebate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLRebate.m 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashRebate.h" 10 | 11 | @implementation DLCashRebate { 12 | float _rebate; 13 | } 14 | 15 | - (instancetype)initWithRebate:(CGFloat)rebate { 16 | if (self = [super init]) { 17 | _rebate = rebate / 10.0; 18 | } 19 | return self; 20 | } 21 | // Override 22 | - (CGFloat)acceptCashWithAmount:(CGFloat)amount { 23 | return amount * _rebate; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashReturn.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashReturn.h 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashSuper.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCashReturn : DLCashSuper 14 | 15 | - (instancetype)initWithAmount:(CGFloat)amount reduce:(CGFloat)reduce; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashReturn.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashReturn.m 3 | // MixT 4 | // 5 | // Created by mintai on 2021/2/5. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashReturn.h" 10 | 11 | @implementation DLCashReturn { 12 | CGFloat _amount; // 满金额 13 | CGFloat _reduce; // 减金额 14 | } 15 | 16 | - (instancetype)initWithAmount:(CGFloat)amount reduce:(CGFloat)reduce { 17 | if (self = [super init]) { 18 | _amount = amount; 19 | _reduce = reduce; 20 | } 21 | return self; 22 | } 23 | 24 | // Override 25 | - (CGFloat)acceptCashWithAmount:(CGFloat)amount { 26 | CGFloat totalReduce = (int)(amount / _amount) * _reduce; 27 | return amount - totalReduce; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashSuper.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashSuper.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2021/2/3. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCashSuper : NSObject 14 | 15 | - (CGFloat)acceptCashWithAmount:(CGFloat)amount; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/CashTool/DLCashSuper.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLCashSuper.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2021/2/3. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLCashSuper.h" 10 | 11 | @implementation DLCashSuper 12 | 13 | - (CGFloat)acceptCashWithAmount:(CGFloat)amount { 14 | return 0; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/System/DesignPatterns/StrategyPattern/DLStrategyPatternViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLStrategyPatternViewController.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/12/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLStrategyPatternViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertTools/DLCustomPresentationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCustomPresentationController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLBaseAnimation.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLCustomPresentationController : UIPresentationController 14 | // 指定转场动画 15 | @property(nonatomic, strong) DLBaseAnimation * animation; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertTools/UIViewController+DLPresent.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+DLPresent.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/27. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLBaseAnimation.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIViewController (DLPresent) 14 | 15 | - (void)presentViewController:(UIViewController *)viewControllerToPresent animation:(DLBaseAnimation *)animation completion:(void (^ __nullable)(void))completion; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertTools/UIViewController+DLPresent.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+DLPresent.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/27. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+DLPresent.h" 10 | #import "DLCustomPresentationController.h" 11 | 12 | @implementation UIViewController (DLPresent) 13 | 14 | - (void)presentViewController:(UIViewController *)viewControllerToPresent animation:(DLBaseAnimation *)animation completion:(void (^)(void))completion { 15 | dispatch_async(dispatch_get_main_queue(), ^{ 16 | DLCustomPresentationController *presentingVC = [[DLCustomPresentationController alloc] initWithPresentedViewController:viewControllerToPresent presentingViewController:self]; 17 | viewControllerToPresent.transitioningDelegate = presentingVC; 18 | presentingVC.animation = animation; 19 | [self presentViewController:viewControllerToPresent animated:YES completion:nil]; 20 | }); 21 | } 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/DLAddressAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressAlertController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/21. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAddressAlertController : UIViewController 14 | 15 | @property(nonatomic, copy) void(^selectValues)(NSArray *addressArray); 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/DLAddressAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressAnimation.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/21. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAddressAnimation : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/DLAddressAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressAnimation.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/21. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAddressAnimation.h" 10 | 11 | @implementation DLAddressAnimation 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.55 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | BOOL isPresenting = (fromVC == self.presentingViewController); 20 | 21 | UIView *fromV = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | UIView *toV = [transitionContext viewForKey:UITransitionContextToViewKey]; 23 | UIView *containerV = [transitionContext containerView]; 24 | [containerV addSubview:toV]; 25 | 26 | CGFloat screenH = CGRectGetHeight(containerV.bounds); 27 | CGFloat screenW = CGRectGetWidth(containerV.bounds); 28 | CGFloat x = 0; 29 | CGFloat height = screenH * 0.8; 30 | CGFloat y = screenH - height; 31 | CGFloat width = screenW; 32 | CGRect showFrame = CGRectMake(x, y, width, height); 33 | CGRect hiddenFrame = CGRectMake(x, screenH, width, height); 34 | 35 | if (isPresenting) toV.frame = hiddenFrame; 36 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 37 | [UIView animateWithDuration:duration animations:^{ 38 | if (isPresenting) { 39 | toV.frame = showFrame; 40 | } else { 41 | fromV.frame = hiddenFrame; 42 | } 43 | } completion:^(BOOL finished) { 44 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 45 | [transitionContext completeTransition:!wasCancelled]; 46 | }]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/Views/DLAddressSelectCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressSelectCell.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/22. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseTableViewCell.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAddressSelectCell : UITableViewCell 14 | 15 | //@property(nonatomic, assign) BOOL isSelect; 16 | 17 | @property(nonatomic, copy) NSString * addressName; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/Views/DLAddressSelectCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressSelectCell.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/22. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 地区选择自定义Cell 8 | 9 | #import "DLAddressSelectCell.h" 10 | 11 | @interface DLAddressSelectCell () 12 | 13 | @property(nonatomic, weak) UILabel * nameLabel; 14 | 15 | @property(nonatomic, weak) UIImageView * selectImageView; 16 | 17 | @end 18 | 19 | @implementation DLAddressSelectCell 20 | 21 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 22 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 23 | [self setupUI]; 24 | self.selectionStyle = UITableViewCellSelectionStyleNone; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)setupUI { 30 | UILabel *nameLabel = [[UILabel alloc] init]; 31 | nameLabel.textColor = [UIColor normalTextColor]; 32 | nameLabel.font = [UIFont systemFontOfSize:14.0f]; 33 | [self addSubview:nameLabel]; 34 | [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { 35 | make.left.equalTo(self).offset(20); 36 | make.centerY.equalTo(self); 37 | }]; 38 | self.nameLabel = nameLabel; 39 | 40 | UIImageView *selectImage = [[UIImageView alloc] init]; 41 | if (@available(iOS 13.0, *)) { 42 | if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) { 43 | selectImage.image = [UIImage imageNamed:@"select-light"]; 44 | } else { 45 | selectImage.image = [UIImage imageNamed:@"select-dark"]; 46 | } 47 | } else { 48 | selectImage.image = [UIImage imageNamed:@"select-light"]; 49 | } 50 | [self addSubview:selectImage]; 51 | [selectImage mas_makeConstraints:^(MASConstraintMaker *make) { 52 | make.right.equalTo(self).offset(-40); 53 | make.centerY.equalTo(self); 54 | }]; 55 | selectImage.hidden = YES; 56 | self.selectImageView = selectImage; 57 | 58 | } 59 | 60 | - (void)setAddressName:(NSString *)addressName { 61 | self.nameLabel.text = addressName; 62 | } 63 | 64 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 65 | [super setSelected:selected animated:animated]; 66 | self.selectImageView.hidden = !selected; 67 | if (selected) { 68 | self.nameLabel.textColor = [UIColor themeColor]; 69 | } 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/Views/DLNameLabelCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLNameLabelCell.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/24. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLNameLabelCell : UICollectionViewCell 14 | 15 | @property(nonatomic, copy) NSString * nameText; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Address/Views/DLNameLabelCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLNameLabelCell.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/24. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLNameLabelCell.h" 10 | 11 | @interface DLNameLabelCell() 12 | 13 | @property(nonatomic, weak) UILabel * nameLabel; 14 | 15 | @end 16 | 17 | @implementation DLNameLabelCell 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame { 20 | if (self = [super initWithFrame:frame]) { 21 | [self setupUI]; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)setupUI { 27 | UILabel *nameLabel = [[UILabel alloc] init]; 28 | nameLabel.textColor = [UIColor normalTextColor]; 29 | nameLabel.font = [UIFont systemFontOfSize:14.0f]; 30 | nameLabel.userInteractionEnabled = YES; 31 | [self addSubview:nameLabel]; 32 | [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { 33 | [make edges]; 34 | }]; 35 | self.nameLabel = nameLabel; 36 | } 37 | 38 | - (void)setNameText:(NSString *)nameText { 39 | self.nameLabel.text = nameText; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/CustomAlert/DLCustomAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLCustomAlertController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/20. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | // 该类适合已经固定的选择数据,如果是变动的数据比如网络请求的数据需要自定义,不联动 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface DLCustomAlertController : UIViewController 15 | 16 | /// 弹出框数据,以[[]]的格式传入 17 | @property(nonatomic, strong) NSArray * pickerDatas; 18 | 19 | @property(nonatomic, copy) void(^selectValues)(NSArray *selectValues); 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Date/DLDateAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTimeAnimation.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/15. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLDateAnimation : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Date/DLDateAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTimeAnimation.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/15. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLDateAnimation.h" 10 | 11 | @implementation DLDateAnimation 12 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 13 | return [transitionContext isAnimated] ? 0.55 : 0; 14 | } 15 | 16 | - (void)animateTransition:(id)transitionContext { 17 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 18 | BOOL isPresenting = (fromVC == self.presentingViewController); 19 | 20 | UIView *fromV = [transitionContext viewForKey:UITransitionContextFromViewKey]; 21 | UIView *toV = [transitionContext viewForKey:UITransitionContextToViewKey]; 22 | UIView *containerV = [transitionContext containerView]; 23 | [containerV addSubview:toV]; 24 | 25 | CGFloat screenH = CGRectGetHeight(containerV.bounds); 26 | CGFloat screenW = CGRectGetWidth(containerV.bounds); 27 | CGFloat x = 30; 28 | CGFloat height = 300; 29 | CGFloat y = screenH - height; 30 | CGFloat width = screenW - 2 * x; 31 | CGRect showFrame = CGRectMake(x, y, width, height - kBottomUnSafeAreaHeight); 32 | CGRect hiddenFrame = CGRectMake(x, screenH, width, height - kBottomUnSafeAreaHeight); 33 | 34 | if (isPresenting) toV.frame = hiddenFrame; 35 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 36 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 37 | if (isPresenting) { 38 | toV.frame = showFrame; 39 | } else { 40 | fromV.frame = hiddenFrame; 41 | } 42 | } completion:^(BOOL finished) { 43 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 44 | [transitionContext completeTransition:!wasCancelled]; 45 | }]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Date/DLDateSelectController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTimeSelectController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/13. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLDateSelectController : UIViewController 14 | 15 | @property(nonatomic, copy) void(^selectDate)(NSArray *dateArray); 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Input/DLInputViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLInputViewController.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/10/26. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLInputViewController : UIViewController 14 | 15 | @property(nonatomic, copy) void(^pinValue)(NSString *pinValue); 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/AlertController/Time/DLTimeSelectController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLTimeSelectController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/16. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTimeSelectController : UIViewController 14 | 15 | @property(nonatomic, copy) void(^selectValue)(NSArray *timeArray); 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationBottom.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationBottom.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationBottom : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationBottom.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationBottom.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationBottom.h" 10 | 11 | @implementation DLAnimationBottom 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.55 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | BOOL isPresenting = (fromVC == self.presentingViewController); 20 | 21 | UIView *fromV = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | UIView *toV = [transitionContext viewForKey:UITransitionContextToViewKey]; 23 | UIView *containerV = [transitionContext containerView]; 24 | [containerV addSubview:toV]; 25 | 26 | CGFloat screenH = CGRectGetHeight(containerV.bounds); 27 | CGFloat screenW = CGRectGetWidth(containerV.bounds); 28 | CGFloat height = kBottomUnSafeAreaHeight + 344; 29 | CGRect showFrame = CGRectMake(0, screenH - height, screenW, height - kBottomUnSafeAreaHeight); 30 | CGRect hiddenFrame = CGRectMake(0, screenH, screenW, height); 31 | 32 | if (isPresenting) toV.frame = hiddenFrame; 33 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 34 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 35 | if (isPresenting) { 36 | toV.frame = showFrame; 37 | } else { 38 | fromV.frame = hiddenFrame; 39 | } 40 | } completion:^(BOOL finished) { 41 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 42 | [transitionContext completeTransition:!wasCancelled]; 43 | }]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationCenterFromBottom.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationCenterFromBottom.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationCenterFromBottom : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationCenterFromBottom.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationCenterFromBottom.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationCenterFromBottom.h" 10 | 11 | @implementation DLAnimationCenterFromBottom 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.55 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | 19 | // 1.获取源控制器、目标控制器、动画容器View 20 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 21 | 22 | UIView *containerView = transitionContext.containerView; 23 | 24 | // 2. 获取源控制器、目标控制器 的View,但是注意二者在开始动画,消失动画,身份是不一样的: 25 | // 也可以直接通过上面获取控制器获取,比如:toViewController.view 26 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 27 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 28 | [containerView addSubview:toView]; //必须添加到动画容器View上。 29 | 30 | BOOL isPresenting = (fromViewController == self.presentingViewController); 31 | 32 | CGFloat screenW = CGRectGetWidth(containerView.bounds); 33 | CGFloat screenH = CGRectGetHeight(containerView.bounds); 34 | CGFloat x = 35.f; 35 | CGFloat y = -1 * screenH; 36 | CGFloat w = screenW - x * 2; 37 | CGFloat h = screenH - 120.f * 2; 38 | // 屏幕顶部 39 | CGRect beginFrame = CGRectMake(x, screenH, w, h); 40 | // 屏幕中间: 41 | CGRect showFrame = CGRectMake(x, 120.0, w, h); 42 | // 屏幕底部 43 | CGRect endFrame = CGRectMake(x, y, w, h); 44 | 45 | if (isPresenting) toView.frame = beginFrame; 46 | 47 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 48 | 49 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:0.3f options:UIViewAnimationOptionCurveEaseInOut animations:^{ 50 | if (isPresenting) 51 | toView.frame = showFrame; 52 | else 53 | fromView.frame = endFrame; 54 | } completion:^(BOOL finished) { 55 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 56 | [transitionContext completeTransition:!wasCancelled]; 57 | }]; 58 | 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationCenterFromTop.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationCenterFromTop.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationCenterFromTop : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationCenterFromTop.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationCenterFromTop.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationCenterFromTop.h" 10 | 11 | @implementation DLAnimationCenterFromTop 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.55 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | UIView *containerView = transitionContext.containerView; 20 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 21 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | [containerView addSubview:toView]; //必须添加到动画容器View上。 23 | 24 | BOOL isPresenting = (fromViewController == self.presentingViewController); 25 | 26 | CGFloat screenW = CGRectGetWidth(containerView.bounds); 27 | CGFloat screenH = CGRectGetHeight(containerView.bounds); 28 | CGFloat x = 35.f; 29 | CGFloat y = -1 * screenH; 30 | CGFloat w = screenW - x * 2; 31 | CGFloat h = screenH - 120.f * 2; 32 | // 屏幕顶部 33 | CGRect beginFrame = CGRectMake(x, y, w, h); 34 | // 屏幕中间: 35 | CGRect showFrame = CGRectMake(x, 120.0, w, h); 36 | // 屏幕底部 37 | CGRect endFrame = CGRectMake(x, screenH, w, h); 38 | 39 | if (isPresenting) toView.frame = beginFrame; 40 | 41 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 42 | 43 | // duration: 动画时长 44 | // delay: 决定了动画在延迟多久之后执行 45 | // damping:速度衰减比例。取值范围0 ~ 1,值越低震动越强 46 | // velocity:初始化速度,值越高则物品的速度越快 47 | // UIViewAnimationOptionCurveEaseInOut 加速,后减速 48 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:0.3f options:UIViewAnimationOptionCurveEaseInOut animations:^{ 49 | if (isPresenting) 50 | toView.frame = showFrame; 51 | else 52 | fromView.frame = endFrame; 53 | } completion:^(BOOL finished) { 54 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 55 | [transitionContext completeTransition:!wasCancelled]; 56 | }]; 57 | 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationFading.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationFade.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationFading : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationFading.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationFade.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationFading.h" 10 | 11 | @implementation DLAnimationFading 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.35 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | 19 | // 1.获取源控制器、目标控制器、动画容器View 20 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 21 | 22 | UIView *containerView = transitionContext.containerView; 23 | 24 | // 2. 获取源控制器、目标控制器 的View,但是注意二者在开始动画,消失动画,身份是不一样的: 25 | // 也可以直接通过上面获取控制器获取,比如:toViewController.view 26 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 27 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 28 | [containerView addSubview:toView]; //必须添加到动画容器View上。 29 | // 判断是present 还是 dismiss 30 | BOOL isPresenting = (fromViewController == self.presentingViewController); 31 | 32 | CGFloat screenW = CGRectGetWidth(containerView.bounds); 33 | CGFloat screenH = CGRectGetHeight(containerView.bounds); 34 | 35 | // 如果是淡入淡出的效果则单独设置,并不执行下面的语句 36 | CGFloat x = 40.0f; 37 | CGFloat y = screenH / 8.0 * 3.0; 38 | CGFloat width = screenW - 2 * x; 39 | CGFloat height = screenH / 4.0; 40 | CGRect frame = CGRectMake(x, y, width, height); 41 | if (isPresenting) toView.frame = frame; 42 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 43 | [UIView animateWithDuration:duration animations:^{ 44 | if (isPresenting) { 45 | toView.alpha = 1.0f; 46 | } else { 47 | fromView.alpha = 0.0f; 48 | } 49 | } completion:^(BOOL finished) { 50 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 51 | [transitionContext completeTransition:!wasCancelled]; 52 | }]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationInput.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationInput.h 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/10/26. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationInput : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationInput.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationInput.m 3 | // MixT 4 | // 5 | // Created by 周冰烽 on 2020/10/26. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationInput.h" 10 | 11 | @implementation DLAnimationInput 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.55 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | UIView *containerView = transitionContext.containerView; 20 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 21 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | [containerView addSubview:toView]; //必须添加到动画容器View上。 23 | 24 | BOOL isPresenting = (fromViewController == self.presentingViewController); 25 | 26 | CGFloat screenW = CGRectGetWidth(containerView.bounds); 27 | CGFloat screenH = CGRectGetHeight(containerView.bounds); 28 | CGFloat x = 35.f; 29 | CGFloat y = -1 * screenH; 30 | CGFloat w = screenW - x * 2; 31 | CGFloat h = screenH - screenH * 3 / 4.0; 32 | // 屏幕顶部 33 | CGRect beginFrame = CGRectMake(x, y, w, h); 34 | // 屏幕中间: 35 | CGRect showFrame = CGRectMake(x, screenH * 3 / 8.0, w, h); 36 | // 屏幕底部 37 | CGRect endFrame = CGRectMake(x, screenH, w, h); 38 | 39 | if (isPresenting) toView.frame = beginFrame; 40 | 41 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 42 | 43 | // duration: 动画时长 44 | // delay: 决定了动画在延迟多久之后执行 45 | // damping:速度衰减比例。取值范围0 ~ 1,值越低震动越强 46 | // velocity:初始化速度,值越高则物品的速度越快 47 | // UIViewAnimationOptionCurveEaseInOut 加速,后减速 48 | [UIView animateWithDuration:duration delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:0.3f options:UIViewAnimationOptionCurveEaseInOut animations:^{ 49 | if (isPresenting) 50 | toView.frame = showFrame; 51 | else 52 | fromView.frame = endFrame; 53 | } completion:^(BOOL finished) { 54 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 55 | [transitionContext completeTransition:!wasCancelled]; 56 | }]; 57 | 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationLeft.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationLeft.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationLeft : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationLeft.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationLeft.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationLeft.h" 10 | 11 | @implementation DLAnimationLeft 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.35 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | BOOL isPresenting = (fromController == self.presentingViewController); 20 | 21 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 22 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 23 | UIView *containerView = [transitionContext containerView]; 24 | [containerView addSubview:toView]; 25 | 26 | CGFloat screenWidth = CGRectGetWidth(containerView.bounds); 27 | CGFloat screenHeight = CGRectGetHeight(containerView.bounds); 28 | CGFloat width = screenWidth / 2.0; 29 | CGRect hiddenFrame = CGRectMake(-width, 0, width, screenHeight); 30 | CGRect showFrame = CGRectMake(0, 0, width, screenHeight); 31 | if (isPresenting) toView.frame = hiddenFrame; 32 | 33 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 34 | [UIView animateWithDuration:duration animations:^{ 35 | if (isPresenting) { 36 | toView.frame = showFrame; 37 | } else { 38 | fromView.frame = hiddenFrame; 39 | } 40 | } completion:^(BOOL finished) { 41 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 42 | [transitionContext completeTransition:!wasCancelled]; 43 | }]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationRight.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationRight.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationRight : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationRight.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationRight.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationRight.h" 10 | 11 | @implementation DLAnimationRight 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.35 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | BOOL isPresenting = (fromVC == self.presentingViewController); 20 | 21 | UIView *fromV = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | UIView *toV = [transitionContext viewForKey:UITransitionContextToViewKey]; 23 | UIView *contrainerV = [transitionContext containerView]; 24 | [contrainerV addSubview:toV]; 25 | 26 | CGFloat screenWidth = CGRectGetWidth(contrainerV.bounds); 27 | CGFloat screenHeight = CGRectGetHeight(contrainerV.bounds); 28 | CGFloat width = screenWidth / 2.0; 29 | CGRect hiddenFrame = CGRectMake(screenWidth, 0, width, screenHeight); 30 | CGRect showFrame = CGRectMake(width, 0, width, screenHeight); 31 | 32 | if (isPresenting) toV.frame = hiddenFrame; 33 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 34 | [UIView animateWithDuration:duration animations:^{ 35 | if (isPresenting) { 36 | toV.frame = showFrame; 37 | } else { 38 | fromV.frame = hiddenFrame; 39 | } 40 | } completion:^(BOOL finished) { 41 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 42 | [transitionContext completeTransition:!wasCancelled]; 43 | }]; 44 | 45 | 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationTop.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationTop.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAnimationTop : DLBaseAnimation 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/AlertViews/Animation/DLAnimationTop.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAnimationTop.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAnimationTop.h" 10 | 11 | @implementation DLAnimationTop 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.35 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 19 | BOOL isPresenting = (fromVC == self.presentingViewController); 20 | 21 | UIView *fromV = [transitionContext viewForKey:UITransitionContextFromViewKey]; 22 | UIView *toV = [transitionContext viewForKey:UITransitionContextToViewKey]; 23 | UIView *containerV = [transitionContext containerView]; 24 | [containerV addSubview:toV]; 25 | 26 | CGFloat screenW = CGRectGetWidth(containerV.bounds); 27 | CGFloat height = kNavigationBarHeight + kTopUnSafeAreaHeight; 28 | CGRect showFrame = CGRectMake(0, 0, screenW, height); 29 | CGRect hiddenFrame = CGRectMake(0, -height, screenW, height); 30 | 31 | if (isPresenting) toV.frame = hiddenFrame; 32 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 33 | [UIView animateWithDuration:duration animations:^{ 34 | if (isPresenting) { 35 | toV.frame = showFrame; 36 | } else { 37 | fromV.frame = hiddenFrame; 38 | } 39 | } completion:^(BOOL finished) { 40 | BOOL wasCancelled = [transitionContext transitionWasCancelled]; 41 | [transitionContext completeTransition:!wasCancelled]; 42 | }]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/DLAlertDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAlertDemoController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/3. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAlertDemoController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/DLBaseAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseAnimation.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLBaseAnimation : NSObject 14 | 15 | @property(nonatomic, strong) UIViewController * presentingViewController; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Alert/DLBaseAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLBaseAnimation.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/10. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseAnimation.h" 10 | 11 | @implementation DLBaseAnimation 12 | 13 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 14 | return [transitionContext isAnimated] ? 0.35 : 0; 15 | } 16 | 17 | - (void)animateTransition:(id)transitionContext { 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/DLUIViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLUIViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLUIViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/DLUIViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLUIViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLUIViewController.h" 10 | #import "DLMainTableViewCell.h" 11 | 12 | #define CellID @"UITableViewCellID" 13 | @interface DLUIViewController () 14 | 15 | @property(nonatomic, weak) UITableView * tableView; 16 | 17 | @property(nonatomic, strong) NSArray * dataSource; 18 | 19 | @end 20 | 21 | @implementation DLUIViewController 22 | 23 | - (void)setupUI { 24 | [super setupUI]; 25 | self.dataSource = @[@"弹出框相关", @"地图相关", @"webview", @"inputView"]; 26 | UITableView *tableView = [[UITableView alloc] init]; 27 | tableView.frame = CGRectMake(0, kNavigationBarHeight + kTopUnSafeAreaHeight, kScreenWidth, kScreenHeight - kNavigationBarHeight - kTabbarHeight - kBottomUnSafeAreaHeight); 28 | tableView.delegate = self; 29 | tableView.dataSource = self; 30 | tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 31 | [tableView registerClass:[DLMainTableViewCell class] forCellReuseIdentifier:CellID]; 32 | [self.view insertSubview:tableView atIndex:0]; 33 | } 34 | 35 | #pragma mark - UITableViewDelegate && dataSource 36 | 37 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 38 | return self.dataSource.count; 39 | } 40 | 41 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 42 | DLMainTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID]; 43 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 44 | cell.titleText = self.dataSource[indexPath.row]; 45 | return cell; 46 | } 47 | 48 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 49 | DLBaseViewController *vc = nil; 50 | switch (indexPath.row) { 51 | case 0: 52 | vc = [[NSClassFromString(@"DLAlertDemoController") alloc] init]; 53 | break; 54 | case 1: 55 | vc = [[NSClassFromString(@"DLMapListViewController") alloc] init]; 56 | break; 57 | case 2: 58 | vc = [[NSClassFromString(@"DLWebViewController") alloc] init]; 59 | break; 60 | case 3: 61 | vc = [[NSClassFromString(@"DLTextInputViewController") alloc] init]; 62 | break; 63 | default: 64 | vc = [[NSClassFromString(@"DLAlertDemoController") alloc] init]; 65 | break; 66 | } 67 | [self.navigationController pushViewController:vc animated:YES]; 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/InputView/DLTextInputViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLInputViewController.h 3 | // MixT 4 | // 5 | // Created by Aurora on 2023/9/9. 6 | // Copyright © 2023 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLTextInputViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/InputView/DLTextInputViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLInputViewController.m 3 | // MixT 4 | // 5 | // Created by Aurora on 2023/9/9. 6 | // Copyright © 2023 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLTextInputViewController.h" 10 | #import "DLPwdTextField.h" 11 | @interface DLTextInputViewController () 12 | 13 | @end 14 | 15 | @implementation DLTextInputViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | - (void)setupUI { 23 | [super setupUI]; 24 | self.title = @"输入框"; 25 | CGFloat width = self.view.frame.size.width - 80; 26 | CGFloat height = 60; 27 | DLPwdTextField *pwdTextField = [[DLPwdTextField alloc] initWithFrame:CGRectMake(40, 120, width, height) gridCount:6]; 28 | pwdTextField.pwdDelegate = self; 29 | [self.view addSubview:pwdTextField]; 30 | } 31 | 32 | - (void)textFieldDidFinishEditing:(DLPwdTextField *)textField { 33 | // [textField clear]; 34 | NSLog(@"textField text is:%@", textField.text); 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Map/BaiduMap/Controller/BMKMapShowViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BMKMapShowViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BMKMapShowViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Map/BaiduMap/Controller/BMKMapShowViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BMKMapShowViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "BMKMapShowViewController.h" 10 | 11 | #import "UIButton+DLAdaptiveButton.h" 12 | 13 | //#import 14 | //#import 15 | 16 | @interface BMKMapShowViewController ()// 17 | 18 | //@property(nonatomic, strong) BMKMapView * mapView; 19 | 20 | 21 | @end 22 | 23 | @implementation BMKMapShowViewController 24 | 25 | - (void)changeControl:(UISegmentedControl *)control { 26 | // NSInteger index = control.selectedSegmentIndex; 27 | // switch (index) { 28 | // case 0: 29 | // [self.mapView setMapType:BMKMapTypeStandard]; 30 | // break; 31 | // case 1: 32 | // [self.mapView setMapType:BMKMapTypeSatellite]; 33 | // break; 34 | // default: 35 | // [self.mapView setMapType:BMKMapTypeNone]; 36 | // break; 37 | // } 38 | } 39 | 40 | #pragma mark - Life Circle 41 | 42 | - (void)viewWillAppear:(BOOL)animated { 43 | [super viewWillAppear:animated]; 44 | // [self.mapView viewWillAppear]; 45 | } 46 | 47 | - (void)viewWillDisappear:(BOOL)animated { 48 | [super viewWillDisappear:animated]; 49 | // [self.mapView viewWillDisappear]; 50 | } 51 | 52 | #pragma mark - UI 53 | 54 | - (void)setupUI { 55 | [super setupUI]; 56 | self.title = @"地图创建"; 57 | UIButton *leftButton = [[UIButton alloc] initHorizontalWithTitle:@"返回" image:[UIImage backIcon]]; 58 | [leftButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; 59 | UILabel *titleLabel = [[UILabel alloc] init]; 60 | titleLabel.font = [UIFont systemFontOfSize:18.0f]; 61 | titleLabel.textColor = [UIColor boldBlackTextColor]; 62 | titleLabel.text = @"地图创建"; 63 | UIButton *rightBtn = [[UIButton alloc] init]; 64 | [rightBtn setTitle:@"筛选" forState:UIControlStateNormal]; 65 | [rightBtn setTitleColor:[UIColor themeColor] forState:UIControlStateNormal]; 66 | rightBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f]; 67 | [super customNaviBarWithLeftView:leftButton centerView:titleLabel rightView:rightBtn]; 68 | 69 | UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems: [NSArray arrayWithObjects:@"标准地图", @"卫星地图", @"空白地图", nil]]; 70 | segmentControl.frame = CGRectMake(20, kNavigationBarHeight + kTopUnSafeAreaHeight + 10, kScreenWidth - 40, 40); 71 | segmentControl.selectedSegmentIndex = 0; 72 | [segmentControl addTarget:self action:@selector(changeControl:) forControlEvents:UIControlEventValueChanged]; 73 | [self.view addSubview:segmentControl]; 74 | 75 | // self.mapView = [[BMKMapView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(segmentControl.frame) + 10, kScreenWidth, kScreenHeight - CGRectGetMaxY(segmentControl.frame) - 10)]; 76 | // self.mapView.delegate = self; 77 | // 显示比例尺 78 | // self.mapView.showMapScaleBar = YES; 79 | // 打开实时路况 80 | // [self.mapView setTrafficEnabled:YES]; 81 | // 82 | // [self.mapView setBaiduHeatMapEnabled:YES]; 83 | // [self.view addSubview:self.mapView]; 84 | 85 | } 86 | 87 | - (void)back { 88 | [self dismissViewControllerAnimated:YES completion:nil]; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Map/BaiduMap/Controller/BMKScreeningViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BMKScreeningViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BMKScreeningViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Map/BaiduMap/Controller/BMKScreeningViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BMKScreeningViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/29. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "BMKScreeningViewController.h" 10 | 11 | @interface BMKScreeningViewController () 12 | 13 | @end 14 | 15 | @implementation BMKScreeningViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | /* 23 | #pragma mark - Navigation 24 | 25 | // In a storyboard-based application, you will often want to do a little preparation before navigation 26 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 27 | // Get the new view controller using [segue destinationViewController]. 28 | // Pass the selected object to the new view controller. 29 | } 30 | */ 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/Map/DLMapListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLMapListViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/27. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLMapListViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/webview/DLWebViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLWebViewController.h 3 | // MixT 4 | // 5 | // Created by zhoubingfeng on 23.7.21. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLWebViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Controllers/webview/index.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 |

hello world

21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Model/DLAlertDataModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLAlertDataModel.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLAlertDataModel : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Model/DLAlertDataModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAlertDataModel.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLAlertDataModel.h" 10 | 11 | @implementation DLAlertDataModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Views/DLMainTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLMainTableViewCell.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/7. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseTableViewCell.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLMainTableViewCell : DLBaseTableViewCell 14 | 15 | @property(nonatomic, copy) NSString * titleText; 16 | 17 | @property(nonatomic, copy) NSString * detailText; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Views/DLMainTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLMainTableViewCell.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/7/7. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLMainTableViewCell.h" 10 | 11 | @interface DLMainTableViewCell () 12 | 13 | @property(nonatomic, weak) UILabel * dl_textLabel; 14 | 15 | @property(nonatomic, weak) UILabel * dl_detailTextLabel; 16 | 17 | @end 18 | 19 | @implementation DLMainTableViewCell 20 | 21 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 22 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 23 | [self setupUI]; 24 | } 25 | return self; 26 | } 27 | 28 | - (void)setupUI { 29 | // text 30 | UILabel *textLabel = [[UILabel alloc] init]; 31 | textLabel.font = [UIFont systemFontOfSize:16.0f]; 32 | textLabel.textColor = [UIColor normalTextColor]; 33 | [self addSubview:textLabel]; 34 | [textLabel mas_makeConstraints:^(MASConstraintMaker *make) { 35 | make.left.equalTo(self).offset(20); 36 | make.centerY.equalTo(self); 37 | }]; 38 | self.dl_textLabel = textLabel; 39 | 40 | // detailText 41 | UILabel *detailTextLabel = [[UILabel alloc] init]; 42 | detailTextLabel.font = [UIFont systemFontOfSize:14.0f]; 43 | detailTextLabel.textColor = [UIColor detailTextColor]; 44 | [self addSubview:detailTextLabel]; 45 | [detailTextLabel mas_makeConstraints:^(MASConstraintMaker *make) { 46 | make.left.equalTo(self).offset(20); 47 | make.centerY.equalTo(self); 48 | }]; 49 | self.dl_textLabel = textLabel; 50 | 51 | // 设置两个控件隐藏,设置值后才显示,防止显示错误信息 52 | self.dl_textLabel.hidden = YES; 53 | self.dl_detailTextLabel.hidden = YES; 54 | } 55 | 56 | - (void)setTitleText:(NSString *)titleText { 57 | if (titleText && ![titleText isEqualToString:@"(null)"]) { 58 | self.dl_textLabel.hidden = NO; 59 | self.dl_textLabel.text = titleText; 60 | } 61 | } 62 | 63 | - (void)setDetailText:(NSString *)detailText { 64 | if (detailText && ![detailText isEqualToString:@"(null)"]) { 65 | self.dl_detailTextLabel.hidden = NO; 66 | self.dl_detailTextLabel.text = detailText; 67 | } 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/UI/Views/DLPwdTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLPwdTextField.h 3 | // MixT 4 | // 5 | // Created by Aurora on 2023/9/9. 6 | // Copyright © 2023 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol DLPwdTextFieldDelegate; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface DLPwdTextField : UITextField 16 | 17 | @property(nonatomic, weak)id pwdDelegate; 18 | 19 | @property (nonatomic, assign) BOOL isFinish; 20 | 21 | /// 定义位数的初始化方法 22 | /// - Parameters: 23 | /// - frame: frame 24 | /// - gridCount: 设定密码位数 25 | - (instancetype) initWithFrame:(CGRect)frame gridCount:(NSInteger)gridCount; 26 | 27 | - (void)clear; 28 | 29 | @end 30 | 31 | @protocol DLPwdTextFieldDelegate 32 | 33 | @required 34 | - (void)textFieldDidFinishEditing:(DLPwdTextField *)textField; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Video/DLVideoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DLVideoViewController.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLBaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface DLVideoViewController : DLBaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /MixT/MixT/Classes/Video/DLVideoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLVideoViewController.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/2. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "DLVideoViewController.h" 10 | 11 | @interface DLVideoViewController () 12 | 13 | @end 14 | 15 | @implementation DLVideoViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | /* 23 | #pragma mark - Navigation 24 | 25 | // In a storyboard-based application, you will often want to do a little preparation before navigation 26 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 27 | // Get the new view controller using [segue destinationViewController]. 28 | // Pass the selected object to the new view controller. 29 | } 30 | */ 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MixT/MixT/Others/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/.DS_Store -------------------------------------------------------------------------------- /MixT/MixT/Others/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /MixT/MixT/Others/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DLMainViewController.h" 11 | //#import 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | #pragma mark - map init 19 | //- (void)initMap { 20 | // // BaiduMapManager initialize 21 | // BMKMapManager *mapManager = [[BMKMapManager alloc] init]; 22 | // BOOL ret = [mapManager start:@"VVC1RE6x40vH7F6fM5Sd8OmwDNMZZ5lI" generalDelegate:nil]; 23 | // if (!ret) { 24 | // NSLog(@"启动失败"); 25 | // } 26 | // // 设置全局坐标系 27 | // [BMKMapManager setCoordinateTypeUsedInBaiduMapSDK:BMK_COORDTYPE_COMMON]; 28 | //} 29 | 30 | 31 | 32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 33 | // [self initMap]; 34 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 35 | DLMainViewController *main = [[DLMainViewController alloc] init]; 36 | self.window.rootViewController = main; 37 | [self.window makeKeyAndVisible]; 38 | return YES; 39 | } 40 | 41 | 42 | #pragma mark - UISceneSession lifecycle 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/SimpleFactory.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "SimpleFactory.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/SimpleFactory.imageset/SimpleFactory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/SimpleFactory.imageset/SimpleFactory.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_black_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "back_black_icon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "back_black_icon@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_black_icon.imageset/back_black_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/back_black_icon.imageset/back_black_icon@2x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_black_icon.imageset/back_black_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/back_black_icon.imageset/back_black_icon@3x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_white_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "back_white_icon@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "back_white_icon@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_white_icon.imageset/back_white_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/back_white_icon.imageset/back_white_icon@2x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/back_white_icon.imageset/back_white_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/back_white_icon.imageset/back_white_icon@3x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-dark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "select-dark@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "select-dark@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-dark.imageset/select-dark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/select-dark.imageset/select-dark@2x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-dark.imageset/select-dark@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/select-dark.imageset/select-dark@3x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-light.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "select-light@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "select-light@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-light.imageset/select-light@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/select-light.imageset/select-light@2x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Assets.xcassets/select-light.imageset/select-light@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alreadyRight/MixT/133d01d667b9865e1fe43ea3b57cc832b7afc784/MixT/MixT/Others/Assets.xcassets/select-light.imageset/select-light@3x.png -------------------------------------------------------------------------------- /MixT/MixT/Others/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Const.h: -------------------------------------------------------------------------------- 1 | // 2 | // Const.h 3 | // 常用宏定义 4 | // 整理 5 | // 6 | // Created by 周冰烽 on 2020/6/1. 7 | // Copyright © 2020 周冰烽. All rights reserved. 8 | // 9 | 10 | // 屏幕宽度 11 | #define kScreenWidth [UIScreen mainScreen].bounds.size.width 12 | // 屏幕高度 13 | #define kScreenHeight [UIScreen mainScreen].bounds.size.height 14 | // 判断是否为刘海屏 15 | #define kIPHONE_X \ 16 | ({BOOL isPhoneX = NO;\ 17 | if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {\ 18 | isPhoneX = NO;\ 19 | }\ 20 | CGSize size = [UIScreen mainScreen].bounds.size;\ 21 | NSInteger notchValue = size.width / size.height * 100;\ 22 | if (216 == notchValue || 46 == notchValue) {\ 23 | isPhoneX = YES;\ 24 | }\ 25 | (isPhoneX);}) 26 | // 非安全区域头部高度 27 | #define kTopUnSafeAreaHeight ({(kIPHONE_X) ? 40.0f : 20.0f;}) 28 | // 非安全区域底部高度 29 | #define kBottomUnSafeAreaHeight ({(kIPHONE_X) ? 34.0f : 0.0f;}) 30 | // 导航栏交互区高度 31 | #define kNavigationBarHeight 44.0f 32 | 33 | #define kTabbarHeight 49.0f 34 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | MixT 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSApplicationQueriesSchemes 24 | 25 | baidumap 26 | 27 | LSRequiresIPhoneOS 28 | 29 | NSAppTransportSecurity 30 | 31 | NSAllowsArbitraryLoads 32 | 33 | 34 | NSPhotoLibraryAddUsageDescription 35 | 请允许访问您的相册,用于上传照片 36 | NSPhotoLibraryUsageDescription 37 | 需要访问你的相册,用于上传照片 38 | UIApplicationSceneManifest 39 | 40 | UIApplicationSupportsMultipleScenes 41 | 42 | UISceneConfigurations 43 | 44 | UIWindowSceneSessionRoleApplication 45 | 46 | 47 | UISceneConfigurationName 48 | Default Configuration 49 | UISceneDelegateClassName 50 | SceneDelegate 51 | 52 | 53 | 54 | 55 | UILaunchStoryboardName 56 | LaunchScreen 57 | UIRequiredDeviceCapabilities 58 | 59 | armv7 60 | 61 | UISupportedInterfaceOrientations 62 | 63 | UIInterfaceOrientationPortrait 64 | 65 | UISupportedInterfaceOrientations~ipad 66 | 67 | UIInterfaceOrientationPortrait 68 | UIInterfaceOrientationPortraitUpsideDown 69 | UIInterfaceOrientationLandscapeLeft 70 | UIInterfaceOrientationLandscapeRight 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /MixT/MixT/Others/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import "Const.h" 10 | #import "UIView+DLSize.h" 11 | #import "UIImage+DLGlobalImage.h" 12 | #import "UIColor+DLGlobalColor.h" 13 | #import "UIColor+DLAddtion.h" 14 | 15 | 16 | #import 17 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Resources/hotCity.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"provinceCode":"110000","provinceName":"北京市","cityCode":"110100","cityName":"北京市"}, 3 | {"provinceCode":"310000","provinceName":"上海市","cityCode":"310100","cityName":"上海市"}, 4 | {"provinceCode":"440000","provinceName":"广东省","cityCode":"440100","cityName":"广州市"}, 5 | {"provinceCode":"440000","provinceName":"广东省","cityCode":"440300","cityName":"深圳市"}, 6 | {"provinceCode":"330000","provinceName":"浙江省","cityCode":"330100","cityName":"杭州市"}, 7 | {"provinceCode":"320000","provinceName":"江苏省","cityCode":"320100","cityName":"南京市"}, 8 | {"provinceCode":"320000","provinceName":"江苏省","cityCode":"320500","cityName":"苏州市"}, 9 | {"provinceCode":"120000","provinceName":"天津市","cityCode":"120100","cityName":"天津市"}, 10 | {"provinceCode":"420000","provinceName":"湖北省","cityCode":"420100","cityName":"武汉市"}, 11 | {"provinceCode":"430000","provinceName":"湖南省","cityCode":"430100","cityName":"长沙市"}, 12 | {"provinceCode":"500000","provinceName":"重庆市","cityCode":"500100","cityName":"重庆市"}, 13 | {"provinceCode":"510000","provinceName":"四川省","cityCode":"510100","cityName":"成都市"} 14 | ] 15 | -------------------------------------------------------------------------------- /MixT/MixT/Others/Resources/province.json: -------------------------------------------------------------------------------- 1 | [{"code":"110000","name":"北京市"},{"code":"120000","name":"天津市"},{"code":"130000","name":"河北省"},{"code":"140000","name":"山西省"},{"code":"150000","name":"内蒙古自治区"},{"code":"210000","name":"辽宁省"},{"code":"220000","name":"吉林省"},{"code":"230000","name":"黑龙江省"},{"code":"310000","name":"上海市"},{"code":"320000","name":"江苏省"},{"code":"330000","name":"浙江省"},{"code":"340000","name":"安徽省"},{"code":"350000","name":"福建省"},{"code":"360000","name":"江西省"},{"code":"370000","name":"山东省"},{"code":"410000","name":"河南省"},{"code":"420000","name":"湖北省"},{"code":"430000","name":"湖南省"},{"code":"440000","name":"广东省"},{"code":"450000","name":"广西壮族自治区"},{"code":"460000","name":"海南省"},{"code":"500000","name":"重庆市"},{"code":"510000","name":"四川省"},{"code":"520000","name":"贵州省"},{"code":"530000","name":"云南省"},{"code":"540000","name":"西藏自治区"},{"code":"610000","name":"陕西省"},{"code":"620000","name":"甘肃省"},{"code":"630000","name":"青海省"},{"code":"640000","name":"宁夏回族自治区"},{"code":"650000","name":"新疆维吾尔自治区"}] -------------------------------------------------------------------------------- /MixT/MixT/Others/RouteConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TabConfig 6 | 7 | Home 8 | Todo 9 | Message 10 | Mine 11 | 12 | HomeConfig 13 | 14 | Menu 15 | 16 | 17 | menu_key 18 | dl_test 19 | menu_name 20 | 测试 21 | menu_normal_img 22 | 23 | menu_highlight_img 24 | 25 | 26 | 27 | menu_key 28 | dl_test 29 | menu_name 30 | 测试 31 | menu_normal_img 32 | 33 | menu_highlight_img 34 | 35 | 36 | 37 | menu_key 38 | dl_test 39 | menu_name 40 | 测试 41 | menu_normal_img 42 | 43 | menu_highlight_img 44 | 45 | 46 | 47 | menu_key 48 | dl_test 49 | menu_name 50 | 测试 51 | menu_normal_img 52 | 53 | menu_highlight_img 54 | 55 | 56 | 57 | menu_key 58 | dl_test 59 | menu_name 60 | 测试 61 | menu_normal_img 62 | 63 | menu_highlight_img 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /MixT/MixT/Others/SceneDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.h 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SceneDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /MixT/MixT/Others/SceneDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SceneDelegate.h" 2 | #import "DLMainViewController.h" 3 | @interface SceneDelegate () 4 | 5 | @end 6 | 7 | @implementation SceneDelegate 8 | 9 | 10 | - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLE(ios(13.0)){ 11 | if (@available(iOS 13.0, *)) { 12 | self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene]; 13 | } else { 14 | // Fallback on earlier versions 15 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 16 | } 17 | DLMainViewController *main = [[DLMainViewController alloc] init]; 18 | self.window.rootViewController = main; 19 | [self.window makeKeyAndVisible]; 20 | } 21 | 22 | 23 | - (void)sceneDidDisconnect:(UIScene *)scene API_AVAILABLE(ios(13.0)){ 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | 31 | - (void)sceneDidBecomeActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ 32 | // Called when the scene has moved from an inactive state to an active state. 33 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 34 | } 35 | 36 | 37 | - (void)sceneWillResignActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ 38 | // Called when the scene will move from an active state to an inactive state. 39 | // This may occur due to temporary interruptions (ex. an incoming phone call). 40 | } 41 | 42 | 43 | - (void)sceneWillEnterForeground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ 44 | // Called as the scene transitions from the background to the foreground. 45 | // Use this method to undo the changes made on entering the background. 46 | } 47 | 48 | 49 | - (void)sceneDidEnterBackground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ 50 | // Called as the scene transitions from the foreground to the background. 51 | // Use this method to save data, release shared resources, and store enough scene-specific state information 52 | // to restore the scene back to its current state. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /MixT/MixT/Others/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 整理 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLAddressAlertControllerTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAddressAlertControllerTest.m 3 | // 整理Tests 4 | // 5 | // Created by 周冰烽 on 2020/7/22. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLAddressAlertController.h" 11 | @interface DLAddressAlertControllerTest : XCTestCase 12 | 13 | @end 14 | 15 | @interface DLAddressAlertController (DLAddressAlertControllerTest) 16 | // 私有方法测试 17 | - (id)getDataFromPathName:(NSString *)pathName; 18 | 19 | @end 20 | 21 | @implementation DLAddressAlertControllerTest 22 | 23 | - (void)setUp { 24 | // Put setup code here. This method is called before the invocation of each test method in the class. 25 | } 26 | 27 | - (void)tearDown { 28 | // Put teardown code here. This method is called after the invocation of each test method in the class. 29 | } 30 | 31 | - (void)testGetDataFromPathName { 32 | DLAddressAlertController *addAlertC = [[DLAddressAlertController alloc] init]; 33 | XCTAssertNotNil([addAlertC getDataFromPathName:@"area"], @"area.json数据获取失败"); 34 | XCTAssertNotNil([addAlertC getDataFromPathName:@"city"], @"city.json数据获取失败"); 35 | XCTAssertNotNil([addAlertC getDataFromPathName:@"province"], @"province.json数据获取失败"); 36 | XCTAssertNotNil([addAlertC getDataFromPathName:@"hotCity"], @"hotCity.json数据获取失败"); 37 | XCTAssertNil([addAlertC getDataFromPathName:@"xxzasd"], @"不存在的json文件测试失败"); 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLAlertDemoControllerTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLAlertDemoControllerTest.m 3 | // 整理Tests 4 | // 5 | // Created by 周冰烽 on 2020/7/23. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLAlertDemoController.h" 11 | @interface DLAlertDemoControllerTest : XCTestCase 12 | 13 | @end 14 | 15 | @interface DLAlertDemoController (Test) 16 | 17 | - (void)setupUI; 18 | 19 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 20 | 21 | 22 | @end 23 | 24 | @implementation DLAlertDemoControllerTest 25 | 26 | - (void)setUp { 27 | // Put setup code here. This method is called before the invocation of each test method in the class. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | } 33 | 34 | - (void)testSetupUI { 35 | DLAlertDemoController *alertVC = [[DLAlertDemoController alloc] init]; 36 | for (int i = 0; i < 100; i++) { 37 | XCTAssertNoThrow([alertVC setupUI]); 38 | } 39 | } 40 | 41 | - (void)testTableViewDidSelectRow { 42 | NSIndexPath *indexPath = nil; 43 | DLAlertDemoController *alertDemoVC = [[DLAlertDemoController alloc] init]; 44 | for (int i = 0; i < 10; i++) { 45 | for (int j = 0; j < 10; j++) { 46 | indexPath = [NSIndexPath indexPathForRow:j inSection:i]; 47 | UITableView *tableView = [[UITableView alloc] init]; 48 | XCTAssertNoThrow([alertDemoVC tableView:tableView didSelectRowAtIndexPath:indexPath]); 49 | } 50 | } 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLBinaryTreeTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLBinaryTreeTest.m 3 | // MixTTests 4 | // 5 | // Created by 周冰烽 on 2020/8/26. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MJBinaryTrees.h" 11 | #import "DLBinarySearchTree.h" 12 | #import "DLAVLTree.h" 13 | #import "DLRedBlackTree.h" 14 | @interface DLBinaryTreeTest : XCTestCase 15 | 16 | @end 17 | 18 | @implementation DLBinaryTreeTest 19 | 20 | - (void)setUp { 21 | // DLBinarySearchTree *bst = [DLBinarySearchTree tree]; 22 | // NSArray *arr = [NSArray arrayWithObjects:@11, @32, @7, @33, @2, @88, @23, @45, @42, @65, nil]; 23 | // for (NSString *str in arr) { 24 | // [bst addObject:str]; 25 | // } 26 | // [MJBinaryTrees println:bst]; 27 | // [bst removeObject:@65]; 28 | // [MJBinaryTrees println:bst]; 29 | // [bst removeObject:@11]; 30 | // [MJBinaryTrees println:bst]; 31 | // [bst removeObject:@88]; 32 | // [MJBinaryTrees println:bst]; 33 | // NSLog(@"============="); 34 | // DLAVLTree *avlTree = [DLAVLTree tree]; 35 | DLRedBlackTree *rbTree = [DLRedBlackTree tree]; 36 | NSArray *arr = [NSArray arrayWithObjects:@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, nil]; 37 | for (NSString *str in arr) { 38 | [rbTree addObject:str]; 39 | [MJBinaryTrees println:rbTree]; 40 | } 41 | // for (NSString *str in arr) { 42 | // [rbTree removeObject:str]; 43 | // if (rbTree.root) { 44 | // [MJBinaryTrees println:rbTree]; 45 | // } 46 | // } 47 | } 48 | 49 | - (void)tearDown { 50 | // Put teardown code here. This method is called after the invocation of each test method in the class. 51 | } 52 | 53 | - (void)testExample { 54 | // This is an example of a functional test case. 55 | // Use XCTAssert and related functions to verify your tests produce the correct results. 56 | } 57 | 58 | - (void)testPerformanceExample { 59 | // This is an example of a performance test case. 60 | [self measureBlock:^{ 61 | // Put the code you want to measure the time of here. 62 | }]; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLColorTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLColorTest.m 3 | // 整理Tests 4 | // 5 | // Created by 周冰烽 on 2020/7/23. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIColor+DLAddtion.h" 11 | @interface DLColorTest : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DLColorTest 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testRandomColor { 26 | for (int i = 0; i < 100; i++) { 27 | XCTAssertNotNil([UIColor RandomColor], @"UIColor+DLAddition的randomColor为空,测试失败"); 28 | } 29 | 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLQueueTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLQueueTest.m 3 | // MixTTests 4 | // 5 | // Created by 周冰烽 on 2020/8/14. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLQueue.h" 11 | #import "DLDeque.h" 12 | @interface DLQueueTest : XCTestCase 13 | 14 | @property(nonatomic, strong) DLQueue * queue1; 15 | 16 | @property(nonatomic, strong) DLDeque * queue2; 17 | 18 | @end 19 | 20 | @implementation DLQueueTest 21 | 22 | - (void)setUp { 23 | self.queue1 = [[DLQueue alloc] init]; 24 | for (int i = 0; i < 10; i++) { 25 | [self.queue1 enQueue:@(i)]; 26 | } 27 | // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 28 | self.queue2 = [[DLDeque alloc] init]; 29 | for (int i = 0; i < 10; i++) { 30 | [self.queue2 enQueueRear:@(i)]; 31 | } 32 | } 33 | 34 | - (void)tearDown { 35 | // Put teardown code here. This method is called after the invocation of each test method in the class. 36 | } 37 | 38 | - (void)testSize { 39 | XCTAssertEqual(self.queue1.size, 10); 40 | XCTAssertEqual(self.queue2.size, 10); 41 | } 42 | 43 | - (void)testIsEmpty { 44 | XCTAssertFalse(self.queue1.isEmpty); 45 | XCTAssertFalse(self.queue2.isEmpty); 46 | } 47 | 48 | - (void)testEnQueue { 49 | XCTAssertNoThrow([self.queue1 enQueue:@(11)]); 50 | XCTAssertNoThrow([self.queue2 enQueueFront:@(11)]); 51 | } 52 | 53 | - (void)testDequeue { 54 | for (int i = 0; i < 10; i++) { 55 | XCTAssertTrue([[self.queue1 deQueue] isEqual:@(i)]); 56 | XCTAssertTrue([[self.queue2 deQueueFront] isEqual:@(i)]); 57 | } 58 | } 59 | 60 | - (void)testDequeueRear { 61 | for (int i = 0; i < 10; i++) { 62 | XCTAssertTrue([[self.queue2 deQueueRear] isEqual:@(9 - i)]); 63 | } 64 | } 65 | 66 | - (void)testFront { 67 | XCTAssertTrue([[self.queue1 front] isEqual:@0]); 68 | XCTAssertTrue([[self.queue2 front] isEqual:@0]); 69 | } 70 | 71 | - (void)testRear { 72 | XCTAssertTrue([[self.queue2 rear] isEqual:@9]); 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLStackTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLStackTest.m 3 | // MixTTests 4 | // 5 | // Created by 周冰烽 on 2020/8/13. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLStack.h" 11 | @interface DLStackTest : XCTestCase 12 | 13 | @property(nonatomic, strong) DLStack * stack; 14 | 15 | @end 16 | 17 | @implementation DLStackTest 18 | 19 | - (void)setUp { 20 | self.stack = [[DLStack alloc] init]; 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | } 26 | 27 | 28 | - (void)testSize { 29 | for (NSInteger i = 0; i < 5; i++) { 30 | [self.stack push:@(i)]; 31 | } 32 | XCTAssertEqual(self.stack.size, 5); 33 | } 34 | 35 | - (void)testIsEmpty { 36 | for (NSInteger i = 0; i < 5; i++) { 37 | [self.stack push:@(i)]; 38 | } 39 | XCTAssertFalse(self.stack.isEmpty); 40 | } 41 | 42 | - (void)testPush { 43 | for (NSInteger i = 0; i < 5; i++) { 44 | XCTAssertNoThrow([self.stack push:@(i)]); 45 | } 46 | } 47 | 48 | - (void)testPop { 49 | for (NSInteger i = 0; i < 5; i++) { 50 | [self.stack push:@(i)]; 51 | } 52 | for (NSInteger i = 4; i >= 0; i--) { 53 | XCTAssertTrue([self.stack.pop isEqual:@(i)]); 54 | } 55 | } 56 | 57 | - (void)testPeek { 58 | for (NSInteger i = 0; i < 5; i++) { 59 | [self.stack push:@(i)]; 60 | } 61 | XCTAssertTrue([self.stack.peek isEqual:@4]); 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /MixT/MixTTests/DLTreeSetTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLTreeSetTest.m 3 | // MixTTests 4 | // 5 | // Created by 周冰烽 on 2020/10/9. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DLTreeSetTest : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DLTreeSetTest 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | - (void)testSet { 38 | NSString *path = @"/Users/Devil/Desktop/personal/Git/practice/MixT"; 39 | NSFileManager *fileManager = [NSFileManager defaultManager]; 40 | NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path]; 41 | BOOL isDir = NO; 42 | BOOL isExist = NO; 43 | 44 | //列举目录内容,可以遍历子目录 45 | for (NSString *subPath in directoryEnumerator.allObjects) { 46 | NSLog(@"%@", subPath); // 所有路径 47 | isExist = [fileManager fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", path, subPath] isDirectory:&isDir]; 48 | if (isDir) { 49 | NSLog(@"%@", subPath); // 目录路径 50 | } else { 51 | // 文件绝对路径 52 | NSString *fileFullPath = [NSString stringWithFormat:@"%@/%@", path, subPath]; 53 | NSString *content = [NSString stringWithContentsOfFile:fileFullPath encoding:NSUTF8StringEncoding error:nil]; 54 | NSMutableArray *words = [NSMutableArray array]; 55 | [content enumerateSubstringsInRange:NSMakeRange(0, content.length) options:NSStringEnumerationByWords usingBlock:^(NSString * _Nullable substring, NSRange substringRange, NSRange enclosingRange, BOOL * _Nonnull stop) { 56 | [words addObject:substring]; 57 | }]; 58 | NSLog(@"%ld", words.count); 59 | } 60 | } 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /MixT/MixTTests/DesignPatterns/DLCashFactoryTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // DLDLCashFactoryTest.m 3 | // MixTTests 4 | // 5 | // Created by mintai on 2021/2/7. 6 | // Copyright © 2021 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DLCashContext.h" 11 | #import "DLCashNormal.h" 12 | #import "DLCashRebate.h" 13 | #import "DLCashReturn.h" 14 | @interface DLCashFactoryTest : XCTestCase 15 | 16 | @end 17 | 18 | @implementation DLCashFactoryTest 19 | 20 | - (void)setUp { 21 | // Put setup code here. This method is called before the invocation of each test method in the class. 22 | } 23 | 24 | - (void)tearDown { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | } 27 | 28 | - (void)testCreateCashWithType { 29 | NSString *res1 = [self cashWithType:@"打8折" amount:100]; 30 | XCTAssertTrue([res1 isEqualToString:@"80.00"]); 31 | 32 | NSString *res2 = [self cashWithType:@"满100减30" amount:100]; 33 | XCTAssertTrue([res2 isEqualToString:@"70.00"]); 34 | 35 | NSString *res3 = [self cashWithType:@"正常收费" amount:100]; 36 | XCTAssertTrue([res3 isEqualToString:@"100.00"]); 37 | 38 | NSString *res4 = [self cashWithType:@"打9.9折" amount:100]; 39 | XCTAssertTrue([res4 isEqualToString:@"99.00"]); 40 | 41 | NSString *res5 = [self cashWithType:@"满500减100" amount:100]; 42 | XCTAssertTrue([res5 isEqualToString:@"100.00"]); 43 | 44 | NSString *res6 = [self cashWithType:@"大家都去我家大气哦及" amount:100]; 45 | XCTAssertTrue([res6 isEqualToString:@"0.00"]); 46 | 47 | NSString *res7 = [self cashWithType:@"打8的折" amount:100]; 48 | XCTAssertTrue([res7 isEqualToString:@"80.00"]); 49 | 50 | } 51 | 52 | - (NSString *)cashWithType:(NSString *)type amount:(CGFloat)amount { 53 | DLCashContext *cc = [[DLCashContext alloc] initWithType:type]; 54 | NSString *res = [NSString stringWithFormat:@"%.2f",[cc getResultWithAmount:amount]]; 55 | return res; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /MixT/MixTTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MixT/MixTTests/__Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // __Tests.m 3 | // 整理Tests 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface __Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation __Tests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /MixT/MixTUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MixT/MixTUITests/__UITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // __UITests.m 3 | // 整理UITests 4 | // 5 | // Created by 周冰烽 on 2020/6/1. 6 | // Copyright © 2020 周冰烽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface __UITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation __UITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | } 29 | 30 | - (void)testExample { 31 | // UI tests must launch the application that they test. 32 | if (@available(iOS 9.0, *)) { 33 | XCUIApplication *app = [[XCUIApplication alloc] init]; 34 | [app launch]; 35 | } else { 36 | // Fallback on earlier versions 37 | } 38 | 39 | // Use recording to get started writing UI tests. 40 | // Use XCTAssert and related functions to verify your tests produce the correct results. 41 | } 42 | 43 | - (void)testLaunchPerformance { 44 | if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { 45 | // This measures how long it takes to launch your application. 46 | // [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{ 47 | // [[[XCUIApplication alloc] init] launch]; 48 | // }]; 49 | } 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /MixT/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'MixT' do 5 | pod 'Masonry' 6 | pod 'YYModel' 7 | pod 'SDWebImage' 8 | pod 'AFNetworking' 9 | pod 'MJExtension' 10 | #pod 'BaiduMapKit' 11 | #pod 'DL_Platfrom', :path => '../../dependency/DL_Platfrom' 12 | 13 | end 14 | -------------------------------------------------------------------------------- /MixT/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (3.2.1): 3 | - AFNetworking/NSURLSession (= 3.2.1) 4 | - AFNetworking/Reachability (= 3.2.1) 5 | - AFNetworking/Security (= 3.2.1) 6 | - AFNetworking/Serialization (= 3.2.1) 7 | - AFNetworking/UIKit (= 3.2.1) 8 | - AFNetworking/NSURLSession (3.2.1): 9 | - AFNetworking/Reachability 10 | - AFNetworking/Security 11 | - AFNetworking/Serialization 12 | - AFNetworking/Reachability (3.2.1) 13 | - AFNetworking/Security (3.2.1) 14 | - AFNetworking/Serialization (3.2.1) 15 | - AFNetworking/UIKit (3.2.1): 16 | - AFNetworking/NSURLSession 17 | - Masonry (1.1.0) 18 | - MJExtension (3.3.0) 19 | - SDWebImage (5.6.0): 20 | - SDWebImage/Core (= 5.6.0) 21 | - SDWebImage/Core (5.6.0) 22 | - YYModel (1.0.4) 23 | 24 | DEPENDENCIES: 25 | - AFNetworking 26 | - Masonry 27 | - MJExtension 28 | - SDWebImage 29 | - YYModel 30 | 31 | SPEC REPOS: 32 | trunk: 33 | - AFNetworking 34 | - Masonry 35 | - MJExtension 36 | - SDWebImage 37 | - YYModel 38 | 39 | SPEC CHECKSUMS: 40 | AFNetworking: cb604b1c2bded0871f5f61f5d53653739e841d6b 41 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 42 | MJExtension: 01704cca2b60a214c10761b6491eab74069d68a9 43 | SDWebImage: 21b19f56b4226cdfe3aefe4e6848dc43ed129a86 44 | YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30 45 | 46 | PODFILE CHECKSUM: 27967a6301304dabedbf65fa5d629ad636448cf1 47 | 48 | COCOAPODS: 1.12.1 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # practice 2 | 3 | [![Build Status](https://travis-ci.org/alreadyRight/MixT.svg?branch=master)](https://travis-ci.org/alreadyRight/MixT) 4 | 5 | ### 感谢大佬们 6 | 本项目内部使用的 7 | * [GKNavigationController](https://github.com/QuintGao/GKNavigationController) 8 | * [自定义转场动画](https://www.jianshu.com/p/a7335474651c) 9 | * [二叉树](https://github.com/CoderMJLee/BinaryTrees) 10 | 11 | ### P.S. 12 | 13 | 最近在学习数据结构的一些知识,项目中会写到一些(非线程安全, 只是记录一下,大佬们如果在意的话可以fork一份, 在增删操作中自行添加线程锁) 14 | 15 | 目录: 16 | * 链表: Classes/System/LinkList 17 | * 栈:Classes/System/Stack 18 | * 队列:Classes/System/Queue 19 | * 二叉树:Classes/System/Tree 20 | --------------------------------------------------------------------------------