├── .gitignore
├── LFKit.podspec
├── LFKit.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ ├── LFKit.xcscheme
│ └── LFKitTests.xcscheme
├── LFKit.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── LFKit
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Demo
│ ├── Base
│ │ ├── BaseViewController.h
│ │ └── BaseViewController.m
│ ├── Component
│ │ ├── ComponentListController.h
│ │ ├── ComponentListController.m
│ │ ├── LFAlertViewTestVC.h
│ │ ├── LFAlertViewTestVC.m
│ │ ├── LFAlertViewTestVC.xib
│ │ ├── LFBadgeViewController.h
│ │ ├── LFBadgeViewController.m
│ │ ├── LFBadgeViewController.xib
│ │ ├── LFBubbleViewTestVC.h
│ │ ├── LFBubbleViewTestVC.m
│ │ ├── LFCameraResultViewController.h
│ │ ├── LFCameraResultViewController.m
│ │ ├── LFCameraResultViewController.xib
│ │ ├── LFCameraViewController.h
│ │ ├── LFCameraViewController.m
│ │ ├── LFCameraViewController.xib
│ │ ├── LFPhotoBrowserTest
│ │ │ ├── HPImageCell.h
│ │ │ ├── HPImageCell.m
│ │ │ ├── HPImageCell.xib
│ │ │ ├── LFPhotoBrowserTest.h
│ │ │ └── LFPhotoBrowserTest.m
│ │ ├── LFPopupMenuTestVC.h
│ │ ├── LFPopupMenuTestVC.m
│ │ ├── LFPopupMenuTestVC.xib
│ │ ├── LFSegmentTest
│ │ │ ├── LFSegmentExample.h
│ │ │ ├── LFSegmentExample.m
│ │ │ ├── LFSegmentTestVC.h
│ │ │ ├── LFSegmentTestVC.m
│ │ │ ├── LFSegmentTestVC2.h
│ │ │ ├── LFSegmentTestVC2.m
│ │ │ ├── LFTableViewExample.h
│ │ │ └── LFTableViewExample.m
│ │ ├── LFStarsViewVC.h
│ │ ├── LFStarsViewVC.m
│ │ ├── LFStarsViewVC.xib
│ │ ├── LFTextViewExampleVC.h
│ │ └── LFTextViewExampleVC.m
│ └── Module
│ │ ├── ToolListController.h
│ │ └── ToolListController.m
├── Info.plist
├── LFKit
│ ├── Category
│ │ ├── NSDate+LF
│ │ │ ├── NSDate+LF.h
│ │ │ └── NSDate+LF.m
│ │ ├── NSLayoutConstraint+LFXIB
│ │ │ ├── NSLayoutConstraint+LFXIB.h
│ │ │ └── NSLayoutConstraint+LFXIB.m
│ │ ├── NSString+LF
│ │ │ ├── NSString+LF.h
│ │ │ └── NSString+LF.m
│ │ ├── NSTimer+LF
│ │ │ ├── NSTimer+LF.h
│ │ │ └── NSTimer+LF.m
│ │ ├── SafeValue
│ │ │ ├── NSArray+LF.h
│ │ │ ├── NSArray+LF.m
│ │ │ ├── NSDictionary+LF.h
│ │ │ ├── NSDictionary+LF.m
│ │ │ ├── NSMutableArray+LF.h
│ │ │ ├── NSMutableArray+LF.m
│ │ │ ├── NSMutableDictionary+LF.h
│ │ │ └── NSMutableDictionary+LF.m
│ │ ├── UIBarButtonItem+LF
│ │ │ ├── UIBarButtonItem+LF.h
│ │ │ └── UIBarButtonItem+LF.m
│ │ ├── UIButton+LF
│ │ │ ├── UIButton+LF.h
│ │ │ └── UIButton+LF.m
│ │ ├── UIColor+LF
│ │ │ ├── UIColor+LF.h
│ │ │ └── UIColor+LF.m
│ │ ├── UIImage+LF
│ │ │ ├── UIImage+LF.h
│ │ │ └── UIImage+LF.m
│ │ ├── UIImageView+LF
│ │ │ ├── UIImageView+LF.h
│ │ │ └── UIImageView+LF.m
│ │ ├── UILabel+LF
│ │ │ ├── UILabel+LF.h
│ │ │ └── UILabel+LF.m
│ │ ├── UITabBarController+HideTabBar
│ │ │ ├── UITabBarController+HideTabBar.h
│ │ │ └── UITabBarController+HideTabBar.m
│ │ ├── UITextField+LF
│ │ │ ├── UITextField+LF.h
│ │ │ └── UITextField+LF.m
│ │ ├── UITextView+LF
│ │ │ ├── UITextView+LF.h
│ │ │ └── UITextView+LF.m
│ │ ├── UIView+LF
│ │ │ ├── UIView+LF.h
│ │ │ └── UIView+LF.m
│ │ ├── UIView+LFXIB
│ │ │ ├── UIView+LFXIB.h
│ │ │ └── UIView+LFXIB.m
│ │ ├── UIViewController+FullScreenScroll
│ │ │ ├── UIViewController+FullScreenScroll.h
│ │ │ └── UIViewController+FullScreenScroll.m
│ │ └── UIViewController+LF
│ │ │ ├── UIViewController+LF.h
│ │ │ └── UIViewController+LF.m
│ ├── Component
│ │ ├── LFAlignCollectionViewFlowLayout
│ │ │ ├── LFAlignCollectionViewFlowLayout.h
│ │ │ └── LFAlignCollectionViewFlowLayout.m
│ │ ├── LFAnnulusProgress
│ │ │ ├── LFAnnulusProgress.h
│ │ │ └── LFAnnulusProgress.m
│ │ ├── LFBadge
│ │ │ ├── LFBadge.h
│ │ │ └── LFBadge.m
│ │ ├── LFBaseCardView
│ │ │ ├── LFAlertView.h
│ │ │ ├── LFAlertView.m
│ │ │ ├── LFBaseCardView.h
│ │ │ └── LFBaseCardView.m
│ │ ├── LFBubbleView
│ │ │ ├── LFBubbleView.h
│ │ │ ├── LFBubbleView.m
│ │ │ ├── LFBubbleViewDefaultConfig.h
│ │ │ └── LFBubbleViewDefaultConfig.m
│ │ ├── LFCamera
│ │ │ ├── LFCamera.h
│ │ │ └── LFCamera.m
│ │ ├── LFCycleScrollView
│ │ │ ├── LFCycleScrollView.h
│ │ │ └── LFCycleScrollView.m
│ │ ├── LFErrorView
│ │ │ ├── LFEmptyIcon@2x.png
│ │ │ ├── LFEmptyIcon@3x.png
│ │ │ ├── LFErrorCell.h
│ │ │ ├── LFErrorCell.m
│ │ │ ├── LFErrorIcon@2x.png
│ │ │ ├── LFErrorIcon@3x.png
│ │ │ ├── LFErrorView.h
│ │ │ └── LFErrorView.m
│ │ ├── LFFMDB
│ │ │ ├── FMDatabase+LF.h
│ │ │ ├── FMDatabase+LF.m
│ │ │ ├── LFModel.h
│ │ │ └── LFModel.m
│ │ ├── LFImagePicker
│ │ │ ├── Images
│ │ │ │ ├── Photo_video@2x.png
│ │ │ │ ├── Photo_video@3x.png
│ │ │ │ ├── photo_radio_normal@2x.png
│ │ │ │ ├── photo_radio_normal@3x.png
│ │ │ │ ├── photo_radio_pressed@2x.png
│ │ │ │ ├── photo_radio_pressed@3x.png
│ │ │ │ ├── photo_video_play_normal@2x.png
│ │ │ │ └── photo_video_play_normal@3x.png
│ │ │ ├── LFAlbumModel.h
│ │ │ ├── LFAlbumModel.m
│ │ │ ├── LFBigImageBrowser.h
│ │ │ ├── LFBigImageBrowser.m
│ │ │ ├── LFBigVideoController.h
│ │ │ ├── LFBigVideoController.m
│ │ │ ├── LFImagePicker.h
│ │ │ ├── LFImagePicker.m
│ │ │ ├── LFPhotoAlbumCell.h
│ │ │ ├── LFPhotoAlbumCell.m
│ │ │ ├── LFPhotoAlbumController.h
│ │ │ ├── LFPhotoAlbumController.m
│ │ │ ├── LFPhotoCollectionCell.h
│ │ │ ├── LFPhotoCollectionCell.m
│ │ │ ├── LFPhotoNavController.h
│ │ │ ├── LFPhotoNavController.m
│ │ │ ├── LFThumbnailViewController.h
│ │ │ └── LFThumbnailViewController.m
│ │ ├── LFLocalMusicPicker
│ │ │ ├── LFLocalMusicPicker.h
│ │ │ └── LFLocalMusicPicker.m
│ │ ├── LFLogManager
│ │ │ ├── LFLogDetailController.h
│ │ │ ├── LFLogDetailController.m
│ │ │ ├── LFLogListController.h
│ │ │ ├── LFLogListController.m
│ │ │ ├── LFLogManager.h
│ │ │ ├── LFLogManager.m
│ │ │ ├── LFSelectLogLevelVC.h
│ │ │ └── LFSelectLogLevelVC.m
│ │ ├── LFOptionTableView
│ │ │ ├── LFOptionTableView.h
│ │ │ └── LFOptionTableView.m
│ │ ├── LFPhotoBrowser
│ │ │ ├── LFBigImageCell.h
│ │ │ ├── LFBigImageCell.m
│ │ │ ├── LFPhotoBrowser.h
│ │ │ ├── LFPhotoBrowser.m
│ │ │ ├── LFPhotoModel.h
│ │ │ └── LFPhotoModel.m
│ │ ├── LFPickerView
│ │ │ ├── LFPickerView.h
│ │ │ └── LFPickerView.m
│ │ ├── LFPicturesCollectionView
│ │ │ ├── LFEditPicsCollectionView.h
│ │ │ ├── LFEditPicsCollectionView.m
│ │ │ ├── LFPicCollectionCell.h
│ │ │ ├── LFPicCollectionCell.m
│ │ │ ├── LFPicturesCollectionView.h
│ │ │ ├── LFPicturesCollectionView.m
│ │ │ ├── lf_addPhoto@2x.png
│ │ │ ├── lf_addPhoto@3x.png
│ │ │ ├── lf_close@2x.png
│ │ │ └── lf_close@3x.png
│ │ ├── LFPopupMenu
│ │ │ ├── LFPopupMenu.h
│ │ │ ├── LFPopupMenu.m
│ │ │ ├── LFPopupMenuDefaultConfig.h
│ │ │ └── LFPopupMenuDefaultConfig.m
│ │ ├── LFQRCode
│ │ │ ├── LFQRCodeScanner.h
│ │ │ ├── LFQRCodeScanner.m
│ │ │ ├── LFQRCodeUtil.h
│ │ │ └── LFQRCodeUtil.m
│ │ ├── LFSegment
│ │ │ ├── LFNestPageContainer.h
│ │ │ ├── LFNestPageContainer.m
│ │ │ ├── LFNestPageController.h
│ │ │ ├── LFNestPageController.m
│ │ │ ├── LFNestedPageScroll.h
│ │ │ ├── LFNestedPageScroll.m
│ │ │ ├── LFNestedScrollContainer.h
│ │ │ ├── LFNestedScrollContainer.m
│ │ │ ├── LFSegmentView.h
│ │ │ └── LFSegmentView.m
│ │ ├── LFStarsView
│ │ │ ├── LFStarsView.h
│ │ │ └── LFStarsView.m
│ │ └── RotationMenu
│ │ │ ├── RotationMenu.h
│ │ │ └── RotationMenu.m
│ └── Util
│ │ ├── LFDeviceInfo
│ │ ├── LFDeviceInfo.h
│ │ └── LFDeviceInfo.m
│ │ ├── LFEncryptDecryptUtil
│ │ ├── LFEncryptDecryptUtil.h
│ │ └── LFEncryptDecryptUtil.m
│ │ ├── LFFileUtil
│ │ ├── LFFileUtil.h
│ │ └── LFFileUtil.m
│ │ ├── LFJsonUtil
│ │ ├── LFJsonUtil.h
│ │ └── LFJsonUtil.m
│ │ └── LFTimeUtil
│ │ ├── LFTimeUtil.h
│ │ └── LFTimeUtil.m
├── PrefixHeader.pch
├── Resource
│ ├── icon_menu_album_normal@2x.png
│ ├── icon_menu_album_normal@3x.png
│ ├── icon_menu_live_normal@2x.png
│ ├── icon_menu_live_normal@3x.png
│ ├── icon_menu_record_normal@2x.png
│ ├── icon_menu_record_normal@3x.png
│ ├── icon_menu_shoot_normal@2x.png
│ ├── icon_menu_shoot_normal@3x.png
│ ├── img_menu_frame_bg@2x.png
│ ├── img_menu_frame_bg@3x.png
│ ├── star_gray.png
│ └── star_highlight.png
└── main.m
├── LFKitTests
├── Info.plist
└── LFKitTests.m
├── LFKitUITests
├── Info.plist
└── LFKitUITests.m
├── LICENSE
├── Podfile
└── README.md
/LFKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LFKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LFKit.xcodeproj/xcshareddata/xcschemes/LFKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
45 |
51 |
52 |
53 |
54 |
60 |
62 |
68 |
69 |
70 |
71 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/LFKit.xcodeproj/xcshareddata/xcschemes/LFKitTests.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
14 |
15 |
17 |
23 |
24 |
25 |
26 |
27 |
37 |
38 |
44 |
45 |
47 |
48 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/LFKit.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/LFKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LFKit/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/LFKit/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "LFLogManager.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 |
19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
20 |
21 | [LFLogManager shareInstance].maximumFileSize = 100;
22 |
23 | // [[LFLogManager shareInstance] install];
24 |
25 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
26 | NSString *baseDir = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
27 | NSString *filePath = [baseDir stringByAppendingPathComponent:@"Logs/LFLog"];
28 | [[LFLogManager shareInstance] installWithLevels:@[@(LFLOG_LEVEL1),@(LFLOG_LEVEL2)] path:filePath];
29 |
30 | NSArray *paths2 = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
31 | NSString *baseDir2 = ([paths2 count] > 0) ? [paths2 objectAtIndex:0] : nil;
32 | NSString *filePath2 = [baseDir2 stringByAppendingPathComponent:@"Logs/LFLog2"];
33 | [[LFLogManager shareInstance] installWithLevels:@[@(XXLOG_LEVEL1),@(XXLOG_LEVEL2)] path:filePath2];
34 |
35 | return YES;
36 | }
37 |
38 |
39 | - (void)applicationWillResignActive:(UIApplication *)application {
40 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
41 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
42 | }
43 |
44 |
45 | - (void)applicationDidEnterBackground:(UIApplication *)application {
46 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
47 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
48 | }
49 |
50 |
51 | - (void)applicationWillEnterForeground:(UIApplication *)application {
52 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
53 | }
54 |
55 |
56 | - (void)applicationDidBecomeActive:(UIApplication *)application {
57 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
58 | }
59 |
60 |
61 | - (void)applicationWillTerminate:(UIApplication *)application {
62 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
63 | }
64 |
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/LFKit/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 | }
--------------------------------------------------------------------------------
/LFKit/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 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/LFKit/Demo/Base/BaseViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BaseViewController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BaseViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Base/BaseViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BaseViewController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "BaseViewController.h"
10 |
11 | @interface BaseViewController ()
12 |
13 | @end
14 |
15 | @implementation BaseViewController
16 |
17 | - (id)init {
18 | self = [super init];
19 | self.hidesBottomBarWhenPushed = YES;
20 | return self;
21 | }
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 | self.view.backgroundColor = [UIColor whiteColor];
26 | }
27 |
28 | - (void)didReceiveMemoryWarning {
29 | [super didReceiveMemoryWarning];
30 | // Dispose of any resources that can be recreated.
31 | }
32 |
33 | /*
34 | #pragma mark - Navigation
35 |
36 | // In a storyboard-based application, you will often want to do a little preparation before navigation
37 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
38 | // Get the new view controller using [segue destinationViewController].
39 | // Pass the selected object to the new view controller.
40 | }
41 | */
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/ComponentListController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ComponentListController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**UI组件*/
12 | @interface ComponentListController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFAlertViewTestVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFAlertViewTestVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/2/23.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LFAlertViewTestVC : UIViewController
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFBadgeViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBadgeViewController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/24.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFBadgeViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFBadgeViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFBadgeViewController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/24.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFBadgeViewController.h"
10 | #import "LFBadge.h"
11 |
12 | @interface LFBadgeViewController ()
13 | @property (strong, nonatomic) IBOutlet UIView *view1;
14 | @property (strong, nonatomic) IBOutlet UITextField *tf;
15 | @property (strong, nonatomic) LFBadge *badge1;
16 | @property (strong, nonatomic) LFBadge *badge2;
17 | @property (strong, nonatomic) LFBadge *badge3;
18 | @property (strong, nonatomic) IBOutlet LFBadge *badge4;//在xib上,0行代码即可接入使用,请忽视xib上的约束错误,因为在内部用代码加过约束
19 |
20 | @end
21 |
22 | @implementation LFBadgeViewController
23 |
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | // Do any additional setup after loading the view from its nib.
27 | _badge1 = [[LFBadge alloc] init];
28 | [_badge1 addToView:self.view1];
29 | _badge1.type = LFBadgeType_RightTop;
30 | _badge1.clearBlock = ^{
31 | NSLog(@"清除未读消息角标");
32 | };
33 |
34 | UIBarButtonItem *barItem = [[UIBarButtonItem alloc] initWithTitle:@"设置" style:UIBarButtonItemStylePlain target:self action:@selector(setCount)];
35 | self.navigationItem.rightBarButtonItem = barItem;
36 |
37 | //延时一会才能拿到barItem
38 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
39 | _badge2 = [[LFBadge alloc] init];
40 | _badge2.type = LFBadgeType_RightTop;
41 | [_badge2 addToBarButtonItem:barItem];
42 |
43 | });
44 |
45 | _badge3 = [[LFBadge alloc] init];
46 | [_badge3 addToTabBarItem:self.navigationController.tabBarItem];
47 |
48 | _badge4.clearBlock = ^{
49 | NSLog(@"清除未读消息角标");
50 | };
51 |
52 | }
53 |
54 | - (void)viewDidAppear:(BOOL)animated {
55 | [super viewDidAppear:animated];
56 | }
57 |
58 | - (void)didReceiveMemoryWarning {
59 | [super didReceiveMemoryWarning];
60 | // Dispose of any resources that can be recreated.
61 | }
62 |
63 | - (void)setCount {
64 |
65 | }
66 | - (IBAction)ok:(id)sender {
67 | _badge1.count = _tf.text;
68 | _badge2.count = _tf.text;
69 | _badge3.count = _tf.text;
70 | _badge4.count = _tf.text;
71 | [self.view endEditing:YES];
72 |
73 | if ([_tf.text isEqualToString:@""]) {//红点
74 | _badge2.edgeInsets = UIEdgeInsetsMake(5, 0, 0, 2);
75 | } else {//数字
76 | _badge2.edgeInsets = UIEdgeInsetsZero;
77 | }
78 | }
79 |
80 |
81 |
82 | @end
83 |
84 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFBubbleViewTestVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBubbleViewTestVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/22.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "BaseViewController.h"
10 |
11 | @interface LFBubbleViewTestVC : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFBubbleViewTestVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFBubbleViewTestVC.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/22.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFBubbleViewTestVC.h"
10 | #import "LFBubbleView.h"
11 | #import "LFBaseCardView.h"
12 |
13 | @interface LFBubbleViewTestVC ()
14 |
15 | @property (strong, nonatomic) UIView *viewTarget;
16 | @property (nonatomic, strong) LFBubbleView *bubbleView;
17 |
18 | @end
19 |
20 | @implementation LFBubbleViewTestVC
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.view.backgroundColor = [UIColor whiteColor];
25 | NSArray *array = @[@"箭头上",@"箭头左",@"箭头下",@"箭头右"];
26 | for (NSInteger i = 0; i < array.count; i++) {
27 | UIButton *bt = [[UIButton alloc] initWithFrame:CGRectMake(0, 100+i*50, 90, 40)];
28 | bt.tag = i;
29 | [bt setTitle:array[i] forState:UIControlStateNormal];
30 | bt.backgroundColor = [UIColor redColor];
31 | [bt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
32 | [bt addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
33 | [self.view addSubview:bt];
34 | }
35 |
36 | _viewTarget = [[UIView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 30)/2, self.view.frame.size.height/2, 30, 30)];
37 | _viewTarget.backgroundColor = [UIColor redColor];
38 | [self.view addSubview:_viewTarget];
39 |
40 | }
41 |
42 | - (void)buttonClick:(UIButton *)button {
43 | if (button.tag == 0) {
44 | [self up:button];
45 | } else if (button.tag == 1) {
46 | [self left:button];
47 | } else if (button.tag == 2) {
48 | [self down:button];
49 | } else if (button.tag == 3) {
50 | [self right:button];
51 | }
52 | }
53 |
54 | - (void)up:(id)sender {
55 | NSString *strTip = @"可设置边框线,三角大小,三角位置,圆角大小,背景色";
56 | [_bubbleView removeFromSuperview];
57 | _bubbleView = [[LFBubbleView alloc] initWithFrame:CGRectMake(0, 0, 200, 160)];
58 | _bubbleView.direction = LFTriangleDirection_Up;
59 | _bubbleView.lbTitle.text = strTip;
60 | _bubbleView.borderColor = [UIColor grayColor];
61 | _bubbleView.borderWidth = 1;
62 | _bubbleView.triangleH = 20;
63 | _bubbleView.triangleW = 20;
64 | _bubbleView.triangleXY = 40;
65 | _bubbleView.cornerRadius = 20;
66 | _bubbleView.color = [UIColor orangeColor];
67 | [self.view addSubview:_bubbleView];
68 | [_bubbleView showInPoint:CGPointMake(_viewTarget.center.x, CGRectGetMaxY(_viewTarget.frame))];
69 | // [_bubbleView doTranslationAnimate];
70 |
71 | }
72 | - (void)down:(id)sender {
73 | NSString *strTip = @"什么都不设置的气泡";
74 | [_bubbleView removeFromSuperview];
75 | _bubbleView = [[LFBubbleView alloc] initWithFrame:CGRectMake(0, 0, 160, 80)];
76 | _bubbleView.lbTitle.text = strTip;
77 | [self.view addSubview:_bubbleView];
78 | [_bubbleView showInPoint:CGPointMake(_viewTarget.center.x,CGRectGetMinY(_viewTarget.frame))];
79 | }
80 |
81 | - (void)left:(id)sender {
82 | NSString *strTip = @"三角距上30";
83 | [_bubbleView removeFromSuperview];
84 | _bubbleView = [[LFBubbleView alloc] initWithFrame:CGRectMake(0, 0, 120, 160)];
85 | _bubbleView.direction = LFTriangleDirection_Left;
86 | _bubbleView.lbTitle.text = strTip;
87 | _bubbleView.triangleXY = 20;
88 | [self.view addSubview:_bubbleView];
89 | [_bubbleView showInPoint:CGPointMake(CGRectGetMaxX(_viewTarget.frame), _viewTarget.center.y)];
90 | [_bubbleView doSpringAnimate];
91 | }
92 | - (void)right:(id)sender {
93 | NSString *strTip = @"三角在1/4位置";
94 | [_bubbleView removeFromSuperview];
95 | _bubbleView = [[LFBubbleView alloc] initWithFrame:CGRectMake(0, 0, 100, 160)];
96 | _bubbleView.direction = LFTriangleDirection_Right;
97 | _bubbleView.lbTitle.text = strTip;
98 | _bubbleView.triangleXYScale = 1.0f/3.0f;
99 | _bubbleView.dismissAfterSecond = 5;
100 | [self.view addSubview:_bubbleView];
101 | [_bubbleView showInPoint:CGPointMake(CGRectGetMinX(_viewTarget.frame), _viewTarget.center.y)];
102 | }
103 |
104 | @end
105 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFCameraResultViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFCameraResultViewController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 | @interface LFCameraResultViewController : BaseViewController
12 | @property (strong, nonatomic) UIImage *image;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFCameraResultViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFCameraResultViewController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFCameraResultViewController.h"
10 |
11 | @interface LFCameraResultViewController ()
12 | @property (strong, nonatomic) IBOutlet UIImageView *imageView;
13 |
14 | @end
15 |
16 | @implementation LFCameraResultViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view from its nib.
21 | self.imageView.image = self.image;
22 | }
23 |
24 | - (void)didReceiveMemoryWarning {
25 | [super didReceiveMemoryWarning];
26 | // Dispose of any resources that can be recreated.
27 | }
28 |
29 | /*
30 | #pragma mark - Navigation
31 |
32 | // In a storyboard-based application, you will often want to do a little preparation before navigation
33 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
34 | // Get the new view controller using [segue destinationViewController].
35 | // Pass the selected object to the new view controller.
36 | }
37 | */
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFCameraResultViewController.xib:
--------------------------------------------------------------------------------
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 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFCameraViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFCameraViewController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 | @interface LFCameraViewController : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFCameraViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFCameraViewController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/3.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 | #import "LFCamera.h"
9 | #import "LFCameraViewController.h"
10 | #import "LFCameraResultViewController.h"
11 |
12 | @interface LFCameraViewController ()
13 |
14 | @property (strong, nonatomic) IBOutlet LFCamera *camera;
15 |
16 | @end
17 |
18 | @implementation LFCameraViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 | self.camera.effectiveRect = CGRectMake(0, 64, 100, 100);
23 | }
24 |
25 | - (void)viewWillAppear:(BOOL)animated {
26 | [super viewWillAppear:animated];
27 | [self.camera restart];
28 | }
29 | - (IBAction)changeCamera:(id)sender {
30 | [self.camera switchCamera:![self.camera isCameraFront]];
31 | }
32 |
33 | - (IBAction)takePhoto:(id)sender {
34 | __weak typeof(self) weakSelf = self;
35 | [self.camera takePhoto:^(UIImage *img) {
36 | LFCameraResultViewController *vc = [[LFCameraResultViewController alloc] init];
37 | vc.image = img;
38 | [weakSelf.navigationController pushViewController:vc animated:YES];
39 | }];
40 | }
41 |
42 | /*
43 | #pragma mark - Navigation
44 |
45 | // In a storyboard-based application, you will often want to do a little preparation before navigation
46 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
47 | // Get the new view controller using [segue destinationViewController].
48 | // Pass the selected object to the new view controller.
49 | }
50 | */
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFPhotoBrowserTest/HPImageCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // HPImageCell.h
3 | // HavePictures
4 | //
5 | // Created by 张林峰 on 2018/5/26.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HPImageCell : UICollectionViewCell
12 | @property (strong, nonatomic) IBOutlet UIImageView *ivPicture;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFPhotoBrowserTest/HPImageCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // HPImageCell.m
3 | // HavePictures
4 | //
5 | // Created by 张林峰 on 2018/5/26.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "HPImageCell.h"
10 |
11 | @implementation HPImageCell
12 |
13 | - (void)awakeFromNib {
14 | [super awakeFromNib];
15 | // Initialization code
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFPhotoBrowserTest/HPImageCell.xib:
--------------------------------------------------------------------------------
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 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFPhotoBrowserTest/LFPhotoBrowserTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoBrowserTest.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "BaseViewController.h"
10 |
11 | @interface LFPhotoBrowserTest : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFPopupMenuTestVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPopupMenuTestVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/9.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 | @interface LFPopupMenuTestVC : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentExample.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentExample.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LFSegmentExample : BaseViewController
15 |
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentExample.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentExample.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFSegmentExample.h"
10 | #import "LFSegmentTestVC.h"
11 | #import "LFSegmentTestVC2.h"
12 |
13 | @interface LFSegmentExample ()
14 |
15 | @property (strong, nonatomic) UITableView *tableView;
16 | @property (nonatomic, strong) NSArray *arrayData;
17 |
18 | @end
19 |
20 | @implementation LFSegmentExample
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
25 | self.tableView.delegate = self;
26 | self.tableView.dataSource = self;
27 | [self.view addSubview:self.tableView];
28 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"myCell"];
29 | [self loadData];
30 |
31 | }
32 |
33 | - (void)didReceiveMemoryWarning {
34 | [super didReceiveMemoryWarning];
35 | // Dispose of any resources that can be recreated.
36 | }
37 |
38 | -(void)viewWillAppear:(BOOL)animated {
39 | [super viewWillAppear:animated];
40 |
41 | }
42 |
43 | -(void)viewWillDisappear:(BOOL)animated {
44 | [super viewWillDisappear:animated];
45 |
46 | }
47 |
48 | #pragma mark - 数据
49 |
50 | - (void)loadData {
51 | _arrayData = [[NSArray alloc] init];
52 | _arrayData = @[
53 | @{@"title":@"LFSegmentTestVC",@"action":^{
54 | LFSegmentTestVC *vc = [[LFSegmentTestVC alloc] init];
55 | [self.navigationController pushViewController:vc animated:YES];
56 | }},
57 | @{@"title":@"LFSegmentTestVC2",@"action":^{
58 | LFSegmentTestVC2 *vc = [[LFSegmentTestVC2 alloc] init];
59 | [self.navigationController pushViewController:vc animated:YES];
60 | }}
61 | ];
62 | [_tableView reloadData];
63 | }
64 |
65 | #pragma mark - UITableView
66 |
67 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
68 | return _arrayData.count;
69 | }
70 |
71 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
72 | return 44;
73 | }
74 |
75 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
76 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell" forIndexPath:indexPath];
77 | NSDictionary *dic = _arrayData[indexPath.row];
78 | cell.textLabel.text = dic[@"title"];
79 | return cell;
80 | }
81 |
82 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
83 | NSDictionary *dic = _arrayData[indexPath.row];
84 | void(^actionBlock)(void) = dic[@"action"];
85 | if (actionBlock) {
86 | actionBlock();
87 | }
88 | }
89 |
90 | @end
91 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentTestVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentTestVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/21.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "BaseViewController.h"
10 |
11 | @interface LFSegmentTestVC : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentTestVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentTestVC.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/21.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFSegmentTestVC.h"
10 | #import "LFSegmentView.h"
11 | #import "LFNestedPageScroll.h"
12 | #import "LFTableViewExample.h"
13 |
14 | @interface LFSegmentTestVC ()
15 |
16 | @property (nonatomic, strong) LFSegmentView *segmentView;
17 | @property (nonatomic, strong) LFNestedPageScroll *nestedPageScroll;
18 |
19 | @end
20 |
21 | @implementation LFSegmentTestVC
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 | self.view.backgroundColor = [UIColor whiteColor];
26 |
27 | NSArray *items = @[@"热门",@"推荐",@"精品系列",@"搞笑",@"娱乐",@"问答",@"财经",@"科技",@"教育",@"动漫"];
28 |
29 | self.segmentView = [[LFSegmentView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 44) titles:items];
30 | [self.view addSubview:self.segmentView];
31 |
32 | NSMutableArray *tables = [[NSMutableArray alloc] init];
33 | for (NSString *s in items) {
34 | NSMutableArray *arrayData = [NSMutableArray new];
35 | for (NSInteger i = 0; i < 50; i ++) {
36 | NSString *title = [NSString stringWithFormat:@"%@_%@",s,@(i)];
37 | [arrayData addObject:title];
38 | }
39 |
40 | LFTableViewExample *tableView = [[LFTableViewExample alloc] init];
41 | tableView.arrayData = arrayData;
42 | [tables addObject:tableView];
43 | }
44 |
45 | self.nestedPageScroll = [[LFNestedPageScroll alloc] initWithFrame:CGRectMake(0, 64+44, self.view.frame.size.width, self.view.frame.size.height - 44 - 64)];
46 | self.nestedPageScroll.tableViews = tables;
47 | self.nestedPageScroll.segmentView = self.segmentView;
48 | [self.view addSubview:self.nestedPageScroll];
49 | [self.nestedPageScroll setSelectedAtIndex:0 animated:NO];
50 | NSLog(@"大视图1%@",self.view);
51 | }
52 |
53 | -(void)viewDidLayoutSubviews {
54 | [super viewDidLayoutSubviews];
55 | if (@available(iOS 11.0, *)) {
56 | self.segmentView.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, 44);
57 | self.nestedPageScroll.frame = CGRectMake(0, self.view.safeAreaInsets.top + self.segmentView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - (self.view.safeAreaInsets.top + self.segmentView.frame.size.height));
58 | } else {
59 | self.segmentView.frame = CGRectMake(0, 64, self.view.frame.size.width, 44);
60 | self.nestedPageScroll.frame = CGRectMake(0, 64 + self.segmentView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - (64 + self.segmentView.frame.size.height));
61 | }
62 | }
63 |
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentTestVC2.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentTestVC2.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LFSegmentTestVC2 : BaseViewController
15 |
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFSegmentTestVC2.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentTestVC2.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFSegmentTestVC2.h"
10 | #import "LFSegmentView.h"
11 | #import "LFNestedPageScroll.h"
12 | #import "LFTableViewExample.h"
13 | #import "LFNestedScrollContainer.h"
14 |
15 | @interface LFSegmentTestVC2 ()
16 |
17 | @property (nonatomic, strong) LFNestedScrollContainer *container;
18 | @property (nonatomic, strong) LFSegmentView *segmentView;
19 | @property (nonatomic, strong) LFNestedPageScroll *nestedPageScroll;
20 |
21 | @end
22 |
23 | @implementation LFSegmentTestVC2
24 |
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 | self.view.backgroundColor = [UIColor whiteColor];
28 |
29 | UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
30 | header.backgroundColor = [UIColor redColor];
31 |
32 | NSArray *items = @[@"热门",@"推荐",@"精品系列",@"搞笑",@"娱乐",@"问答",@"财经",@"科技",@"教育",@"动漫"];
33 |
34 | self.segmentView = [[LFSegmentView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 44) titles:items];
35 |
36 | NSMutableArray *tables = [[NSMutableArray alloc] init];
37 | for (NSString *s in items) {
38 | NSMutableArray *arrayData = [NSMutableArray new];
39 | for (NSInteger i = 0; i < 50; i ++) {
40 | NSString *title = [NSString stringWithFormat:@"%@_%@",s,@(i)];
41 | [arrayData addObject:title];
42 | }
43 |
44 | LFTableViewExample *tableView = [[LFTableViewExample alloc] init];
45 | tableView.arrayData = arrayData;
46 | [tables addObject:tableView];
47 | }
48 |
49 | self.nestedPageScroll = [[LFNestedPageScroll alloc] initWithFrame:CGRectMake(0, 64+44, self.view.frame.size.width, self.view.frame.size.height - 44 - 64)];
50 | self.nestedPageScroll.tableViews = tables;
51 | self.nestedPageScroll.segmentView = self.segmentView;
52 | [self.nestedPageScroll setSelectedAtIndex:0 animated:NO];
53 |
54 | self.container = [[LFNestedScrollContainer alloc] init];
55 | [self.container setupHeader:header];
56 | [self.container setupSegment:self.segmentView];
57 | [self.container setupPageScroll:self.nestedPageScroll];
58 |
59 | [self.view addSubview:self.container];
60 | }
61 |
62 | -(void)viewDidLayoutSubviews {
63 | [super viewDidLayoutSubviews];
64 | if (@available(iOS 11.0, *)) {
65 | self.container.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, self.view.frame.size.height - self.view.safeAreaInsets.top);
66 |
67 | } else {
68 | self.container.frame = CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64);
69 | }
70 | }
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFTableViewExample.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFTableViewExample.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LFTableViewExample : UITableView
14 |
15 | @property (nonatomic, strong) NSMutableArray *arrayData;
16 |
17 | @end
18 |
19 | NS_ASSUME_NONNULL_END
20 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFSegmentTest/LFTableViewExample.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFTableViewExample.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFTableViewExample.h"
10 |
11 | @interface LFTableViewExample ()
12 |
13 | @end
14 |
15 | @implementation LFTableViewExample
16 |
17 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
18 | self = [super initWithFrame:frame style:style];
19 | self.dataSource = self;
20 | self.delegate = self;
21 | [self registerClass:[UITableViewCell class] forCellReuseIdentifier:@"myCell"];
22 | return self;
23 | }
24 |
25 | - (void)setArrayData:(NSMutableArray *)arrayData {
26 | _arrayData = arrayData;
27 | [self reloadData];
28 | }
29 |
30 |
31 | #pragma mark - UITableView
32 |
33 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
34 | return _arrayData.count;
35 | }
36 |
37 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
38 | return 44;
39 | }
40 |
41 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
42 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell" forIndexPath:indexPath];
43 | NSString *title = _arrayData[indexPath.row];
44 | cell.textLabel.text = title;
45 | return cell;
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFStarsViewVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFStarsViewVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BaseViewController.h"
11 | @interface LFStarsViewVC : BaseViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFStarsViewVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFStarsViewVC.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFStarsViewVC.h"
10 | #import "LFStarsView.h"
11 |
12 | @interface LFStarsViewVC ()
13 |
14 | @property (nonatomic, strong) LFStarsView *starsView;
15 | @property (strong, nonatomic) IBOutlet LFStarsView *starsView2;
16 | @property (strong, nonatomic) IBOutlet UITextField *tf;
17 |
18 | @end
19 |
20 | @implementation LFStarsViewVC
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | _starsView = [[LFStarsView alloc] initWithFrame:CGRectMake(20, 100, 100, 20)];
25 | [_starsView configWithStarNumber:5 image:[UIImage imageNamed:@"star_gray"] highlightImage:[UIImage imageNamed:@"star_highlight"]];
26 | [self.view addSubview:_starsView];
27 |
28 | [_starsView2 configWithStarNumber:5 image:[UIImage imageNamed:@"star_gray"] highlightImage:[UIImage imageNamed:@"star_highlight"]];
29 | }
30 |
31 | //是否允许用户点击、滑动星星
32 | - (IBAction)change:(id)sender {
33 | UISwitch *sw = (UISwitch *)sender;
34 | if (sw.isOn) {//给selectBlock则允许点击滑动
35 | __weak typeof(self) weakSelf = self;
36 | _starsView.selectBlock = ^(CGFloat value) {
37 | weakSelf.tf.text = [NSString stringWithFormat:@"%f",value];
38 | };
39 | _starsView2.selectBlock = ^(CGFloat value) {
40 | weakSelf.tf.text = [NSString stringWithFormat:@"%f",value];
41 | };
42 | } else {//selectBlock = nil则不允许
43 | _starsView.selectBlock = nil;
44 | _starsView2.selectBlock = nil;
45 | }
46 | }
47 |
48 | - (IBAction)OK:(id)sender {
49 | [self.view endEditing:YES];
50 | _starsView.value = _tf.text.floatValue;
51 | _starsView2.value = _tf.text.floatValue;
52 | }
53 |
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFTextViewExampleVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFTextViewExampleVC.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/3.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "BaseViewController.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface LFTextViewExampleVC : BaseViewController
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LFKit/Demo/Component/LFTextViewExampleVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFTextViewExampleVC.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/3.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFTextViewExampleVC.h"
10 | #import "UITextView+LF.h"
11 |
12 | @interface LFTextViewExampleVC ()
13 |
14 | @end
15 |
16 | @implementation LFTextViewExampleVC
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | UITextView *tv = [[UITextView alloc] initWithFrame:CGRectMake(20, 100, self.view.frame.size.width - 40, 300)];
22 | tv.backgroundColor = [UIColor groupTableViewBackgroundColor];
23 | tv.font = [UIFont systemFontOfSize:13];
24 |
25 | // tv.placeholderColor = [UIColor redColor];
26 | tv.placeholderFont = [UIFont systemFontOfSize:16];
27 | // tv.countColor = [UIColor greenColor];
28 | tv.countFont = [UIFont systemFontOfSize:18];
29 | tv.maxCount = @(8);
30 | // tv.isLimit = @YES;
31 | // tv.text = @"123456789";
32 | [self.view addSubview:tv];
33 |
34 | tv.placeholder = @"请输入内容";
35 |
36 | __block UITextView *btv = tv;
37 | tv.textDidChangeBlock = ^(NSString * _Nonnull text, BOOL isOut) {
38 | if (isOut) {
39 | btv.countColor = [UIColor redColor];
40 | } else {
41 | btv.countColor = [UIColor lightGrayColor];
42 | }
43 | };
44 | }
45 |
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/LFKit/Demo/Module/ToolListController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ToolListController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/23.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**实用工具*/
12 | @interface ToolListController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/Demo/Module/ToolListController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ToolListController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/23.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "ToolListController.h"
10 | #import "LFLogManager.h"
11 | #import "LFLogListController.h"
12 |
13 | @interface ToolListController ()
14 |
15 | @property (strong, nonatomic) IBOutlet UITableView *tableView;
16 | @property (nonatomic, strong) NSArray *arrayData;
17 |
18 | @end
19 |
20 | @implementation ToolListController
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 |
25 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"myCell"];
26 | [self loadData];
27 | }
28 |
29 | - (void)didReceiveMemoryWarning {
30 | [super didReceiveMemoryWarning];
31 | // Dispose of any resources that can be recreated.
32 | }
33 |
34 | -(void)viewWillAppear:(BOOL)animated {
35 | [super viewWillAppear:animated];
36 |
37 | }
38 |
39 | -(void)viewWillDisappear:(BOOL)animated {
40 | [super viewWillDisappear:animated];
41 |
42 | }
43 |
44 | #pragma mark - 数据
45 |
46 | - (void)loadData {
47 | _arrayData = [[NSArray alloc] init];
48 | _arrayData = @[
49 | @{@"title":@"日志",@"action":^{
50 | LFLogListController *vc = [[LFLogListController alloc] init];
51 | [vc addButtonTitle:@"分享" callBackData:^(NSString *dataPath) {
52 | DDLogError(@"分享地址%@",dataPath);
53 | }];
54 | [self.navigationController pushViewController:vc animated:YES];
55 | }},
56 | @{@"title":@"生成打印数据",@"action":^{
57 | // for (NSInteger i = 0; i < 100; i++) {
58 | DDLogError(@"1");
59 | DDLogWarn(@"2");
60 | DDLogInfo(@"3");
61 | DDLogDebug(@"4");
62 | DDLogVerbose(@"5");
63 | LFLog1(@"aaa1");
64 | LFLog2(@"aaa2");
65 | XXLog1(@"xxx1");
66 | XXLog2(@"xxx2");
67 | // }
68 | }}
69 | ];
70 | [_tableView reloadData];
71 | }
72 |
73 | #pragma mark - UITableView
74 |
75 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
76 | return _arrayData.count;
77 | }
78 |
79 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
80 | return 44;
81 | }
82 |
83 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
84 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell" forIndexPath:indexPath];
85 | NSDictionary *dic = _arrayData[indexPath.row];
86 | cell.textLabel.text = dic[@"title"];
87 | return cell;
88 | }
89 |
90 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
91 | NSDictionary *dic = _arrayData[indexPath.row];
92 | void(^actionBlock)(void) = dic[@"action"];
93 | if (actionBlock) {
94 | actionBlock();
95 | }
96 | }
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/LFKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleAllowMixedLocalizations
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleDisplayName
10 | LFKit
11 | CFBundleExecutable
12 | $(EXECUTABLE_NAME)
13 | CFBundleIdentifier
14 | $(PRODUCT_BUNDLE_IDENTIFIER)
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | $(PRODUCT_NAME)
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 |
32 | NSAppleMusicUsageDescription
33 | 需要访问媒体库
34 | NSCameraUsageDescription
35 | 需要访问您的摄像头
36 | NSMicrophoneUsageDescription
37 | 需要访问您的麦克风
38 | NSPhotoLibraryAddUsageDescription
39 | 用于上传和保存照片
40 | NSPhotoLibraryUsageDescription
41 | 需要访问您的相册
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIMainStoryboardFile
45 | Main
46 | UIRequiredDeviceCapabilities
47 |
48 | armv7
49 |
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 |
54 | UISupportedInterfaceOrientations~ipad
55 |
56 | UIInterfaceOrientationPortrait
57 | UIInterfaceOrientationPortraitUpsideDown
58 | UIInterfaceOrientationLandscapeLeft
59 | UIInterfaceOrientationLandscapeRight
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSDate+LF/NSDate+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSDate (LF)
12 |
13 | - (NSInteger)lf_year;
14 | - (NSInteger)lf_month;
15 | - (NSInteger)lf_day;
16 | - (BOOL)lf_isToday;
17 | - (BOOL)lf_isYesterday;
18 | - (BOOL)lf_isSameYearAsDate:(NSDate *)aDate;
19 | - (NSDate *)lf_dateByAddingDays:(NSInteger)days;
20 | - (NSDate *)lf_dateByAddingMonths:(NSInteger)months;
21 | - (NSDate *)lf_dateByAddingYears:(NSInteger)years;
22 |
23 | /** 获取年龄*/
24 | - (NSInteger)lf_getAge;
25 |
26 | /**从fromDate到toDate的天数*/
27 | + (NSInteger)lf_daysFrom:(NSDate *)fromDate to:(NSDate *)toDate;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSDate+LF/NSDate+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+LF.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "NSDate+LF.h"
10 |
11 | @implementation NSDate (LF)
12 |
13 | - (NSInteger)lf_year {
14 | return [[[NSCalendar currentCalendar] components:NSCalendarUnitYear fromDate:self] year];
15 | }
16 |
17 | - (NSInteger)lf_month {
18 | return [[[NSCalendar currentCalendar] components:NSCalendarUnitMonth fromDate:self] month];
19 | }
20 |
21 | - (NSInteger)lf_day {
22 | return [[[NSCalendar currentCalendar] components:NSCalendarUnitDay fromDate:self] day];
23 | }
24 |
25 | - (BOOL)lf_isToday {
26 | if (fabs(self.timeIntervalSinceNow) >= 60 * 60 * 24) return NO;
27 | return [NSDate new].lf_day == self.lf_day;
28 | }
29 |
30 | - (BOOL)lf_isYesterday {
31 | NSDate *added = [self lf_dateByAddingDays:1];
32 | return [added lf_isToday];
33 | }
34 |
35 | - (BOOL)lf_isSameYearAsDate:(NSDate *)aDate {
36 | if (self.lf_year != aDate.lf_year) {
37 | return NO;
38 | }
39 | return YES;
40 | }
41 |
42 | - (NSDate *)lf_dateByAddingDays:(NSInteger)days {
43 | NSTimeInterval aTimeInterval = [self timeIntervalSinceReferenceDate] + 86400 * days;
44 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval];
45 | return newDate;
46 | }
47 |
48 | - (NSDate *)lf_dateByAddingMonths:(NSInteger)months {
49 | NSCalendar *calendar = [NSCalendar currentCalendar];
50 | NSDateComponents *components = [[NSDateComponents alloc] init];
51 | [components setMonth:months];
52 | return [calendar dateByAddingComponents:components toDate:self options:0];
53 | }
54 |
55 | - (NSDate *)lf_dateByAddingYears:(NSInteger)years {
56 | NSCalendar *calendar = [NSCalendar currentCalendar];
57 | NSDateComponents *components = [[NSDateComponents alloc] init];
58 | [components setYear:years];
59 | return [calendar dateByAddingComponents:components toDate:self options:0];
60 | }
61 |
62 | /** 获取年龄*/
63 | - (NSInteger)lf_getAge;
64 | {
65 | // 出生日期转换 年月日
66 | NSDateComponents *components1 = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:self];
67 | NSInteger brithDateYear = [components1 year];
68 | NSInteger brithDateDay = [components1 day];
69 | NSInteger brithDateMonth = [components1 month];
70 |
71 | // 获取系统当前 年月日
72 | NSDateComponents *components2 = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]];
73 | NSInteger currentDateYear = [components2 year];
74 | NSInteger currentDateDay = [components2 day];
75 | NSInteger currentDateMonth = [components2 month];
76 |
77 | // 计算年龄
78 | NSInteger iAge = currentDateYear - brithDateYear - 1;
79 | if ((currentDateMonth > brithDateMonth) || (currentDateMonth == brithDateMonth && currentDateDay >= brithDateDay)) {
80 | iAge++;
81 | }
82 |
83 | return iAge;
84 | }
85 |
86 | /**从fromDate到toDate的天数*/
87 | + (NSInteger)lf_daysFrom:(NSDate *)fromDate to:(NSDate *)toDate {
88 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
89 | NSDateComponents *comp = [calendar components:NSCalendarUnitDay
90 | fromDate:fromDate
91 | toDate:toDate
92 | options:NSCalendarWrapComponents];
93 | return comp.day;
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSLayoutConstraint+LFXIB/NSLayoutConstraint+LFXIB.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSLayoutConstraint+LFXIB.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //给xib的属性面板加如下属性,代码写的UI也可以使用如下属性
12 | //IB_DESIGNABLE //这个只能自定义控件加
13 | @interface NSLayoutConstraint (LFXIB)
14 |
15 | @property (assign,nonatomic) IBInspectable CGFloat pxConstant; //约束的值,单位px
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSLayoutConstraint+LFXIB/NSLayoutConstraint+LFXIB.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSLayoutConstraint+LFXIB.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "NSLayoutConstraint+LFXIB.h"
10 |
11 | @implementation NSLayoutConstraint (LFXIB)
12 |
13 | - (void)setPxConstant:(CGFloat)pxConstant {
14 | self.constant = pxConstant / [UIScreen mainScreen].scale;
15 | }
16 |
17 | - (CGFloat)pxConstant {
18 | return self.constant * [UIScreen mainScreen].scale;
19 | }
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSString+LF/NSString+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/4.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface NSString (LF)
13 |
14 | #pragma mark - size相关
15 |
16 | /**根据文字数获取高度*/
17 | - (CGFloat)getHeightWithFont:(UIFont*)font width:(CGFloat)width;
18 |
19 | /**根据文字数获取宽度度*/
20 | - (CGFloat)getWidthWithFont:(UIFont*)font;
21 |
22 | #pragma mark - 字符串处理
23 |
24 | /**截取字符串之间的字符串(如截取出#话题#)*/
25 | - (NSMutableArray *)stringBetweenString:(NSString *)string;
26 |
27 | /**获取拼音*/
28 | - (NSString *)getPinyin;
29 |
30 | /**获取拼音首字母*/
31 | - (NSString *)getInitial;
32 |
33 | /**字符串提取数字*/
34 | - (NSString *)getNumberString;
35 |
36 | /**字符串关键字部分变高亮色*/
37 | - (NSMutableAttributedString *)getAttributeStringWithKeywords:(NSString *)keywords keyColor:(UIColor *)color;
38 |
39 | /**URL编码*/
40 | - (NSString *)URLEncoded;
41 |
42 | /**URL解码*/
43 | -(NSString *)URLDecoded;
44 |
45 | /**获取MD5*/
46 | - (NSString *)getMD5;
47 |
48 | /**拼接前缀(防重复拼接)*/
49 | - (NSString *)lf_addPrefix:(NSString *)prefix;
50 |
51 | /**拼接后缀(防重复拼接)*/
52 | - (NSString *)lf_addSuffix:(NSString *)suffix;
53 |
54 | /**去掉前缀*/
55 | - (NSString *)lf_deletePrefix:(NSString *)prefix;
56 | /**去掉后缀*/
57 | - (NSString *)lf_deleteSuffix:(NSString *)suffix;
58 |
59 | /**或运算,如果自己为空,就用另一个字符串*/
60 | - (NSString *)lf_or:(NSString *)str;
61 |
62 | /**去掉字符串两端的空白字符*/
63 | - (NSString *)lf_trim;
64 |
65 | #pragma mark - 数字相关
66 |
67 | /**保留count位小数(高保真)*/
68 | - (NSString *)lf_keepDecimalCount:(NSInteger)count;
69 |
70 | /**保留小数位数,一般的位数(高保真)*/
71 | - (NSString *)lf_keepDecimalNormal;
72 |
73 | /**浮点型转化为万*/
74 | - (NSString *)lf_flotToWanFormat;
75 |
76 | /**整型转化为万*/
77 | - (NSString *)lf_intToWanFormat;
78 |
79 | /** 字节转KB或M */
80 | + (NSString *)lf_sizeWithByte:(long long)byte;
81 |
82 | #pragma mark - 校验相关
83 |
84 | /**身份证号*/
85 | - (BOOL)isIdentityCard;
86 |
87 | /**邮箱*/
88 | - (BOOL)isEmail;
89 |
90 | /**手机号码验证*/
91 | - (BOOL)isMobile;
92 |
93 | /**判断是不是纯数字*/
94 | - (BOOL)isInt;
95 |
96 | /**判断是否为浮点形*/
97 | - (BOOL)isFloat;
98 |
99 | /**判断是否为数字*/
100 | - (BOOL)isNumber;
101 |
102 | /**判断是否含中文*/
103 | - (BOOL)containsChinese;
104 |
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSTimer+LF/NSTimer+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSTimer+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/10/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSTimer (LF)
12 |
13 | //暂停
14 | - (void)pauseTimer;
15 |
16 | //继续
17 | - (void)resumeTimer;
18 |
19 | //过一段时间再继续
20 | - (void)resumeTimerAfterTimeInterval:(NSTimeInterval)interval;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/NSTimer+LF/NSTimer+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSTimer+LF.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/10/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "NSTimer+LF.h"
10 |
11 | @implementation NSTimer (LF)
12 |
13 | -(void)pauseTimer
14 | {
15 | if (![self isValid]) {
16 | return ;
17 | }
18 | [self setFireDate:[NSDate distantFuture]];//暂停, distantFuture(不可达到的未来的某个时间点)
19 |
20 | }
21 |
22 |
23 | -(void)resumeTimer
24 | {
25 | if (![self isValid]) {
26 | return ;
27 | }
28 | [self setFireDate:[NSDate date]];//继续
29 | }
30 |
31 | - (void)resumeTimerAfterTimeInterval:(NSTimeInterval)interval
32 | {
33 | if (![self isValid]) {
34 | return ;
35 | }
36 | [self setFireDate:[NSDate dateWithTimeIntervalSinceNow:interval]];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSArray+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 |
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface NSArray (LF)
14 |
15 | /**安全取值*/
16 | - (id)lf_objectAtIndex:(NSInteger)index;
17 |
18 | /**转成可变型数据,包括里面的字典、数组*/
19 | - (NSMutableArray *)lf_Mutable;
20 |
21 | /**去重复*/
22 | - (NSMutableArray *)lf_removeDuplicates;
23 |
24 | /**主键去重复,如果元素是字符串key可不传;如果元素是字典,则传主键*/
25 | - (NSMutableArray *)lf_removeDuplicatesWithKey:(NSString *)key;
26 |
27 | /** 查找数组中指定键值对的字典*/
28 | - (NSDictionary *)lf_itemWithKey:(NSString *)key value:(NSString *)value;
29 |
30 | @end
31 |
32 | NS_ASSUME_NONNULL_END
33 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSDictionary+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface NSDictionary (LF)
14 |
15 | - (NSString *)lf_stringForKey:(NSString *)key;
16 |
17 | - (NSString *)lf_stringForKey:(NSString *)key defaultValue:(NSString *)defaultValue;
18 |
19 | - (NSInteger)lf_integerForKey:(NSString *)key;
20 | - (float)lf_floatForKey:(NSString *)key;
21 | - (BOOL)lf_boolForKey:(NSString *)key;
22 | - (NSMutableArray *)lf_arrayForKey:(NSString *)key;
23 | - (NSMutableDictionary *)lf_dictionaryKey:(NSString *)key;
24 | - (long long)lf_longLongForKey:(NSString *)key;
25 |
26 | /**转成可变型数据,包括里面的字典、数组*/
27 | - (NSMutableDictionary *)lf_Mutable;
28 |
29 | /**返回一个用于url参数的string
30 | 如key1=value1&key2=value2
31 | */
32 | - (NSString *)getURLArgumentsString;
33 |
34 |
35 | /**
36 | 改变字典中某些key的名字
37 |
38 | @param param 字典数组@[@{@"原始key1":@"新key1",@"原始key2":@"新key2"},...]
39 | @return 结果
40 | */
41 | - (NSMutableDictionary *)changeKeyName:(NSDictionary *)param;
42 |
43 |
44 | /**
45 | 改变数组中的字典中某些key的名字
46 | @param array 数据源
47 | @param param 字典数组@[@{@"原始key1":@"新key1",@"原始key2":@"新key2"},...]
48 | @return 结果
49 | */
50 | + (NSMutableArray *)changeKeyNameFromArray:(NSArray *)array param:(NSDictionary *)param;
51 |
52 |
53 | /**
54 | 从字典中提取数据组成列表需要的结构(基本多个section的列表需要用到)
55 | 例如将
56 | @{
57 | @"aa": @[dic1, dic2],
58 | @"bb": @[dic1, dic2],
59 | }
60 | 转化为
61 | @[
62 | @{
63 | @"title":str1;
64 | @"data":@[dic1,dic2];
65 | },
66 | @{
67 | @"title":str2;
68 | @"data":@[dic3,dic4];
69 | }
70 | ]
71 |
72 | @param ktArray @[@{@"aa":"需要设置的title"},@{@"bb":"需要设置的title"},...]
73 | @param param 字典数组@[@{@"原始key1":@"新key1",@"原始key2":@"新key2"}]
74 | @return 结果 例如:
75 |
76 | */
77 | - (NSMutableArray *)getArrayWithKeyTitles:(NSArray *)ktArray param:(NSDictionary *)param;
78 |
79 | @end
80 |
81 | NS_ASSUME_NONNULL_END
82 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSMutableArray+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableArray+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 |
10 |
11 |
12 | @interface NSMutableArray (LF)
13 |
14 | - (void)lf_removeObjectAtIndex:(NSInteger)index;
15 | - (void)lf_replaceObjectAtIndex:(NSInteger)index withObject:(id)anObject;
16 | - (void)lf_insertObject:(id)anObject atIndex:(NSInteger)index;
17 | - (void)lf_addObject:(id)anObject;
18 |
19 | /**加一个不重复的元素*/
20 | - (void)addDifferentObject:(id)anObject;
21 |
22 | /**加一个主键不重复的元素,如果元素是字符串key可以不用传;如果元素是字典,则传主键*/
23 | - (void)addObject:(id)anObject withKey:(NSString *)key;
24 |
25 | @end
26 |
27 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSMutableArray+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableArray+LF.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "NSMutableArray+LF.h"
10 |
11 | @implementation NSMutableArray (LF)
12 |
13 | - (void)lf_removeObjectAtIndex:(NSInteger)index {
14 | if (index < self.count && index > -1) {
15 | [self removeObjectAtIndex:index];
16 | }
17 | }
18 |
19 | - (void)lf_replaceObjectAtIndex:(NSInteger)index withObject:(id)anObject {
20 | if (index < self.count && index > -1 && anObject) {
21 | [self replaceObjectAtIndex:index withObject:anObject];
22 | }
23 | }
24 |
25 | - (void)lf_insertObject:(id)anObject atIndex:(NSInteger)index {
26 | if (index < self.count + 1 && index > -1 && anObject) {
27 | [self insertObject:anObject atIndex:index];
28 | }
29 | }
30 |
31 | - (void)lf_addObject:(id)anObject {
32 | if (anObject) {
33 | [self addObject:anObject];
34 | }
35 | }
36 |
37 | /**加一个不重复的元素*/
38 | - (void)addDifferentObject:(id)anObject {
39 | if (!anObject) {
40 | return;
41 | }
42 | if (![self containsObject:anObject]) {
43 | [self addObject:anObject];
44 | }
45 | }
46 |
47 | /**加一个主键不重复的元素,如果元素是字符串key可以不用传;如果元素是字典,则传主键*/
48 | - (void)addObject:(id)anObject withKey:(NSString *)key {
49 | if (!anObject) {
50 | return;
51 | }
52 | if (self.count < 1) {
53 | [self addObject:anObject];
54 | } else {
55 | if ([anObject isKindOfClass:[NSDictionary class]]) {
56 | if (key.length > 0) {
57 | BOOL has = NO;
58 | for (NSDictionary *dic in self) {
59 | NSString *pk = dic[key];
60 | if ([pk isEqualToString:((NSDictionary *)anObject)[key]]) {
61 | has = YES;
62 | break;
63 | }
64 | }
65 | if (!has) {
66 | [self addObject:anObject];
67 | }
68 |
69 | } else {
70 | [self addObject:anObject];
71 | }
72 | } else if ([anObject isKindOfClass:[NSString class]] || [anObject isKindOfClass:[NSNumber class]]) {
73 | if (![self containsObject:anObject]) {
74 | [self addObject:anObject];
75 | }
76 | } else {
77 | if (key.length > 0) {
78 | BOOL has = NO;
79 | for (NSObject *obj in self) {
80 | NSString *pk = [obj valueForKey:key];
81 | if ([pk isEqualToString:[anObject valueForKey:key]]) {
82 | has = YES;
83 | break;
84 | }
85 | }
86 | if (!has) {
87 | [self addObject:anObject];
88 | }
89 |
90 | } else {
91 | [self addObject:anObject];
92 | }
93 | }
94 | }
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSMutableDictionary+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableDictionary+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface NSMutableDictionary (LF)
14 |
15 | - (void)lf_setObject:(id)obj forKey:(NSString *)key;
16 |
17 | @end
18 |
19 | NS_ASSUME_NONNULL_END
20 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/SafeValue/NSMutableDictionary+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSMutableDictionary+LF.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/10/28.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "NSMutableDictionary+LF.h"
10 |
11 | @implementation NSMutableDictionary (LF)
12 |
13 | - (void)lf_setObject:(id)obj forKey:(NSString *)key {
14 | if (obj != nil && key != nil) {
15 | [self setObject:obj forKey:key];
16 | }
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIBarButtonItem+LF/UIBarButtonItem+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIBarButtonItem (LF)
12 |
13 | /**导航上的图片按钮*/
14 | + (UIBarButtonItem *)itemWithImage:(UIImage *)image action:(void(^)(void))action;
15 |
16 | /**导航上的文字按钮*/
17 | + (UIBarButtonItem *)itemWithTitle:(NSString*)title action:(void(^)(void))action;
18 |
19 | /**导航上的图片+文字按钮*/
20 | + (UIBarButtonItem *)itemWithmage:(UIImage *)image title:(NSString *)title action:(void(^)(void))action;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIBarButtonItem+LF/UIBarButtonItem+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIBarButtonItem+LF.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UIBarButtonItem+LF.h"
10 | #import "UIButton+LF.h"
11 |
12 | @implementation UIBarButtonItem (LF)
13 |
14 | /**导航上的图片按钮*/
15 | + (UIBarButtonItem *)itemWithImage:(UIImage *)image action:(void (^)(void))action {
16 | UIButton *itemBtn = [UIButton buttonWithType:UIButtonTypeSystem];
17 | [itemBtn setImage:image forState:UIControlStateNormal];
18 | [itemBtn sizeToFit];
19 | itemBtn.btnAction = action;
20 | UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:itemBtn];
21 | return item;
22 | }
23 |
24 | /**导航上的文字按钮*/
25 | + (UIBarButtonItem *)itemWithTitle:(NSString*)title action:(void (^)(void))action {
26 | UIButton *itemBtn = [UIButton buttonWithType:UIButtonTypeSystem];
27 | [itemBtn.titleLabel setFont:[UIFont systemFontOfSize:16]];
28 | [itemBtn setTitle:title forState:UIControlStateNormal];
29 | [itemBtn sizeToFit];
30 | itemBtn.btnAction = action;
31 | UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:itemBtn];
32 | return item;
33 | }
34 |
35 | /**导航上的图片+文字按钮*/
36 | + (UIBarButtonItem *)itemWithmage:(UIImage *)image title:(NSString *)title action:(void (^)(void))action {
37 | UIButton *itemBtn = [UIButton buttonWithType:UIButtonTypeSystem];
38 | [itemBtn.titleLabel setFont:[UIFont systemFontOfSize:16]];
39 | [itemBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
40 | [itemBtn setImage:image forState:UIControlStateNormal];
41 | [itemBtn setTitle:title forState:UIControlStateNormal];
42 | [itemBtn sizeToFit];
43 | itemBtn.btnAction = action;
44 | UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:itemBtn];
45 | return item;
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIButton+LF/UIButton+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIButton+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/4.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // 定义一个排列样式枚举(包含了四种类型的button)
12 | typedef NS_ENUM(NSUInteger, LFButtonArrangeStyle) {
13 | LFButtonStyleImageTop, // image在上,label在下
14 | LFButtonStyleImageLeft, // image在左,label在右
15 | LFButtonStyleImageRight, // image在右,label在左
16 | LFButtonStyleImageBottom // image在下,label在上
17 | };
18 |
19 | #define kDefaultSubTitle @"ss秒后重新获取"
20 |
21 | typedef void(^LFBtnAction)(void);
22 |
23 | @interface UIButton (LF)
24 |
25 | @property (nonatomic, strong) NSNumber *currentTime;//倒计时的当前时间
26 | @property (nonatomic, strong) NSTimer *resendTimer;//定时器
27 | @property (nonatomic, copy) LFBtnAction btnAction;
28 |
29 | @property (nonatomic, strong) CAShapeLayer *shapeLayer;
30 |
31 |
32 | /** 设置图文排列样式及间距 **/
33 | - (void)setArrangeStyle:(LFButtonArrangeStyle)style space:(CGFloat)space;
34 |
35 | /*
36 | * 倒计时按钮
37 | * @param timeLine 倒计时总时间
38 | * @param title 还没倒计时的title
39 | * @param subTitle 倒计时的子名字 格式为xxssxx,xx为你要显示的文字,不传则默认为:ss秒
40 | * @param mColor 还没倒计时的颜色
41 | * @param color 倒计时的颜色
42 | */
43 |
44 | - (void)startWithTime:(NSInteger)second title:(NSString *)title subTitle:(NSString *)subTitle;
45 |
46 | - (void)removeTimer;
47 |
48 | - (void)resetButton;
49 |
50 | /** 开始加载动画 */
51 | - (void)lf_showLoading;
52 |
53 | /** 停止加载动画 */
54 | - (void)lf_stopLoading;
55 |
56 |
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIColor+LF/UIColor+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+LF.h
3 | // LFQRCode
4 | //
5 | // Created by 张林峰 on 2017/5/16.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIColor (LF)
12 |
13 | /**获取图片某位置的颜色*/
14 | + (UIColor *)lf_colorFromImage:(UIImage *)image atPoint:(CGPoint)point;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIImage+LF/UIImage+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/5/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, TriangleDirection) {
12 | TriangleDirection_Down,
13 | TriangleDirection_Left,
14 | TriangleDirection_Right,
15 | TriangleDirection_Up
16 | };
17 |
18 | @interface UIImage (LF)
19 |
20 | /**生成纯色图片*/
21 | + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
22 |
23 | /**生成纯色带圆角图片*/
24 | + (UIImage *)lf_imageWithColor:(UIColor *)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius;
25 |
26 | /**生成渐变色图片*/
27 | + (UIImage *)imageWithRect:(CGSize)size StartColor:(UIColor *)startColor endColor:(UIColor *)endColor StartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
28 |
29 | /**生成三角图片direction为角的方向*/
30 | + (UIImage *)imageWithRect:(CGSize)size color:(UIColor *)color direction:(TriangleDirection)direction;
31 |
32 | /**生成截屏图片*/
33 | + (UIImage *)captureWithView:(UIView *)view;
34 |
35 | /**获取图片某位置的颜色*/
36 | - (UIColor *)colorAtPoint:(CGPoint)point;
37 |
38 | /**压缩图片到指定内存大小kb*/
39 | - (UIImage *)compressToByte:(NSUInteger)maxLength;
40 |
41 | /**压缩图片到指定尺寸*/
42 | - (UIImage *)compressToSize:(CGSize)size;
43 |
44 | #pragma mark - 毛玻璃效果
45 | -(UIImage*)applyLightEffect;
46 | -(UIImage*)applyExtraLightEffect;
47 | -(UIImage*)applyDarkEffect;
48 | -(UIImage*)applyTintEffectWithColor:(UIColor*)tintColor;
49 | -(UIImage*)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor*)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage*)maskImage;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIImageView+LF/UIImageView+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImageView+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/4.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImageView (LF)
12 |
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIImageView+LF/UIImageView+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImageView+LF.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/4.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UIImageView+LF.h"
10 |
11 | @implementation UIImageView (LF)
12 |
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UILabel+LF/UILabel+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel+LF.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 16/1/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UILabel (LF)
12 |
13 | #pragma mark - 消息数量椭圆Label
14 | @property (nonatomic, retain) NSString *tipNumber;//消息数量,有值时将显示为红色椭圆label
15 |
16 | #pragma mark - 数字相关处理
17 | /**正数加前缀“+”,颜色红;负数颜色绿;空值当0处理*/
18 | - (void)setColorNumberText:(NSString *)text;
19 |
20 | /**正数加前缀“+”;空值当0处理*/
21 | - (void)setNumberText:(NSString *)text;
22 |
23 | /**正数加前缀“+”,颜色红;负数颜色绿*/
24 | - (void)setColorNumber:(float)number;
25 |
26 | /**正数加前缀“+”*/
27 | - (void)setNumber:(float)number;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UILabel+LF/UILabel+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel+LF.m
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 16/1/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UILabel+LF.h"
10 | #import
11 |
12 | static void *tipNumberKey = &tipNumberKey;
13 |
14 | @implementation UILabel (LF)
15 |
16 | - (NSString *)tipNumber {
17 | return objc_getAssociatedObject(self, &tipNumberKey);
18 | }
19 |
20 | -(void)setTipNumber:(NSString *)tipNumber {
21 | objc_setAssociatedObject(self, & tipNumberKey, tipNumber, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
22 | }
23 |
24 | //消息数量,有值时将显示为红色椭圆label
25 | -(void)layoutSubviews {
26 | [super layoutSubviews];
27 | if (self.tipNumber) {
28 | self.backgroundColor = [UIColor redColor];
29 | self.textColor = [UIColor whiteColor];
30 | self.textAlignment = NSTextAlignmentCenter;
31 | self.hidden = self.tipNumber.length < 1 ? YES : NO;
32 | if ([self.tipNumber isEqualToString:@"0"]) {
33 | self.hidden = YES;
34 | }
35 | if (self.tipNumber.length > 2) {
36 | self.tipNumber = @"99+";
37 | }
38 | if ([self.tipNumber isEqualToString:@"-1"]) {
39 | self.tipNumber = @"";
40 | CGRect frame = self.frame;
41 | frame.size.width = 10;
42 | frame.size.height = 10;
43 | self.frame = frame;
44 | }
45 |
46 | self.text = self.tipNumber;
47 | float radius = self.frame.size.height < self.frame.size.width ? self.frame.size.height : self.frame.size.width;
48 | self.clipsToBounds = YES;
49 | self.layer.cornerRadius = radius / 2.0f;
50 | }
51 | }
52 |
53 |
54 | /**正数加前缀“+”,颜色红;负数颜色绿;空值当0处理*/
55 | - (void)setColorNumberText:(NSString *)text {
56 | text = text.length > 0 ? text : @"0";
57 | if (text.floatValue > 0) {
58 | self.text = [NSString stringWithFormat:@"+%0.1f",text.floatValue];
59 | self.textColor = [UIColor redColor];
60 | } else if(text.floatValue < 0) {
61 | self.text = [NSString stringWithFormat:@"%0.1f",text.floatValue];
62 | self.textColor = [UIColor greenColor];
63 | } else {
64 | self.text = [NSString stringWithFormat:@"%0.1f",text.floatValue];
65 | }
66 | }
67 |
68 | /**正数加前缀“+”;空值当0处理*/
69 | -(void)setNumberText:(NSString *)text {
70 | text = text.length > 0 ? text : @"0";
71 | if (text.floatValue > 0) {
72 | self.text = [NSString stringWithFormat:@"+%0.1f",text.floatValue];
73 | } else {
74 | self.text = [NSString stringWithFormat:@"%0.1f",text.floatValue];
75 | }
76 | }
77 |
78 | /**正数加前缀“+”,颜色红;负数颜色绿*/
79 | - (void)setColorNumber:(float)number {
80 | if (number > 0) {
81 | self.text = [NSString stringWithFormat:@"+%0.1f",number];
82 | self.textColor = [UIColor redColor];
83 | } else if (number < 0) {
84 | self.text = [NSString stringWithFormat:@"%0.1f",number];
85 | self.textColor = [UIColor greenColor];
86 | } else {
87 | self.text = [NSString stringWithFormat:@"%0.1f",number];
88 | }
89 | }
90 |
91 | /**正数加前缀“+”*/
92 | -(void)setNumber:(float)number {
93 | if (number > 0) {
94 | self.text = [NSString stringWithFormat:@"+%0.1f",number];
95 | } else {
96 | self.text = [NSString stringWithFormat:@"%0.1f",number];
97 | }
98 | }
99 |
100 |
101 | @end
102 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UITabBarController+HideTabBar/UITabBarController+HideTabBar.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITabBarController+HideTabBar.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/25.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define TABBAR_HEIGHT (49)
12 |
13 | @interface UITabBarController (HideTabBar)
14 |
15 | - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UITabBarController+HideTabBar/UITabBarController+HideTabBar.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITabBarController+HideTabBar.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/25.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UITabBarController+HideTabBar.h"
10 |
11 | @implementation UITabBarController (HideTabBar)
12 |
13 | - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated {
14 |
15 | if ([self.view.subviews count] < 2) {
16 | return;
17 | }
18 |
19 | if(hidden) {
20 | if(animated) {
21 | [UIView animateWithDuration:0.2
22 | animations:^{
23 | self.tabBar.frame = CGRectMake(self.view.bounds.origin.x,
24 | self.view.bounds.size.height,
25 | self.view.bounds.size.width,
26 | TABBAR_HEIGHT);
27 | }
28 | completion:^(BOOL finished) {
29 | self.tabBar.frame = CGRectMake(self.view.bounds.origin.x,
30 | self.view.bounds.size.height,
31 | self.view.bounds.size.width,
32 | TABBAR_HEIGHT);
33 | }];
34 | } else {
35 |
36 | self.tabBar.frame = CGRectMake(self.view.bounds.origin.x,
37 | self.view.bounds.size.height,
38 | self.view.bounds.size.width,
39 | TABBAR_HEIGHT);
40 | }
41 | } else {
42 |
43 | if(animated) {
44 | [UIView animateWithDuration:0.2
45 | animations:^{
46 | self.tabBar.frame = CGRectMake(self.view.bounds.origin.x,
47 | self.view.bounds.size.height - TABBAR_HEIGHT,
48 | self.view.bounds.size.width,
49 | TABBAR_HEIGHT);
50 | } completion:^(BOOL finished) {
51 |
52 | }];
53 | } else {
54 |
55 | self.tabBar.frame = CGRectMake(self.view.bounds.origin.x,
56 | self.view.bounds.size.height - TABBAR_HEIGHT,
57 | self.view.bounds.size.width,
58 | TABBAR_HEIGHT);
59 | }
60 | }
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UITextField+LF/UITextField+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/9.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UITextField (LF)
12 |
13 | @property (nonatomic, strong) NSNumber *maxLength;//最大长度
14 |
15 | - (void)shake;
16 |
17 |
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UITextField+LF/UITextField+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField+LF.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/9.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UITextField+LF.h"
10 | #import
11 |
12 | static void *maxLengthKey = &maxLengthKey;
13 |
14 | @implementation UITextField (LF)
15 |
16 | - (void)shake {
17 | CGPoint y = CGPointMake(self.layer.position.x-10, self.layer.position.y);
18 | CGPoint x = CGPointMake(self.layer.position.x+10, self.layer.position.y);
19 | CABasicAnimation * animation = [CABasicAnimation animationWithKeyPath:@"position"];
20 | [animation setTimingFunction:[CAMediaTimingFunction
21 | functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
22 | [animation setFromValue:[NSValue valueWithCGPoint:x]];
23 | [animation setToValue:[NSValue valueWithCGPoint:y]];
24 | [animation setAutoreverses:YES];
25 | [animation setDuration:0.08];
26 | [animation setRepeatCount:3];
27 | [self.layer addAnimation:animation forKey:nil];
28 | }
29 |
30 | - (void)setMaxLength:(NSNumber *)maxLength {
31 | objc_setAssociatedObject(self, &maxLengthKey, maxLength, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
32 | [self addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
33 | }
34 |
35 | - (NSNumber *)maxLength {
36 | return objc_getAssociatedObject(self, &maxLengthKey);
37 | }
38 |
39 |
40 | - (void)textFieldDidChange:(UITextField *)textField {
41 | NSNumber * nlength = self.maxLength;
42 | NSInteger maxLength = nlength.integerValue;
43 | if (textField.text.length > maxLength) {
44 | UITextRange *markedRange = [textField markedTextRange];
45 | if (markedRange) {
46 | return;
47 | }
48 | //Emoji占2个字符,如果是超出了半个Emoji,用maxLength位置来截取会出现Emoji截为2半
49 | //超出最大长度的那个字符序列(Emoji算一个字符序列)的range
50 | NSRange range = [textField.text rangeOfComposedCharacterSequenceAtIndex:maxLength];
51 | textField.text = [textField.text substringToIndex:range.location];
52 | }
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UITextView+LF/UITextView+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITextView+LF.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/9/2.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | typedef void(^TextDidChange)(NSString *text, BOOL isOut);
14 |
15 | @interface UITextView (LF)
16 |
17 | @property (nonatomic, strong) NSString *placeholder;//占位符
18 | @property (nonatomic, strong) UIFont *placeholderFont;//占位符字体,默认13号字体
19 | @property (nonatomic, strong) UIColor *placeholderColor;//占位符颜色,默认浅灰色
20 |
21 | @property (nonatomic, strong) NSNumber *maxCount;//最大字数
22 | @property (nonatomic, strong) UIFont *countFont;//计数字体,默认13号字体
23 | @property (nonatomic, strong) UIColor *countColor;//计数颜色,默认浅灰色
24 | @property (nonatomic, strong) NSNumber *isLimit;//超过最大字数,是否截取,0否,1是
25 |
26 | //默认 @{@"top":@(6),@"left":@(5),@"bottom":@(5),@"right":@(5)} top、left控制占位符边距。bottom、right控制计数边距
27 | @property (nonatomic, strong) NSDictionary *insetDic;
28 |
29 | @property (nonatomic, copy) TextDidChange textDidChangeBlock; //获取当前文字、是否超出字数(如果超出会回调2次,截取前一次截取后一次)
30 |
31 | /**在持有本组件的控制器或者视图里调用,必须调用 */
32 | - (void)lf_layoutSubviews;
33 |
34 | @end
35 |
36 | NS_ASSUME_NONNULL_END
37 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIView+LF/UIView+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+LF.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/10.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef void(^LFTapViewBlock)(UITapGestureRecognizer *gesture);
12 |
13 | @interface UIView (LF)
14 |
15 | @property (nonatomic, copy) LFTapViewBlock tapViewBlock;//点击事件
16 |
17 | /*!移除某一约束*/
18 | - (void)lf_removeConstraintsWithFirstItem:(id)firstItem firstAttribute:(NSLayoutAttribute)firstAttribute;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIView+LF/UIView+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+LF.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/10.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UIView+LF.h"
10 | #import
11 |
12 | static void *tapViewBlockKey = &tapViewBlockKey;
13 |
14 | @implementation UIView (LF)
15 |
16 | #pragma mark - 给view添加点击事件
17 |
18 | - (LFTapViewBlock)tapViewBlock {
19 | return objc_getAssociatedObject(self, &tapViewBlockKey);
20 | }
21 |
22 | -(void)setTapViewBlock:(LFTapViewBlock)tapViewBlock {
23 | objc_setAssociatedObject(self, & tapViewBlockKey, tapViewBlock, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
24 |
25 | [self addTapBlock];
26 | }
27 |
28 | /**添加点击事件*/
29 | - (void)addTapBlock{
30 | self.userInteractionEnabled = YES; // label默认是NO,所以要设置为yes
31 | UITapGestureRecognizer *tapGestureRecognizer =
32 | [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
33 | [self addGestureRecognizer:tapGestureRecognizer];
34 | tapGestureRecognizer.cancelsTouchesInView = YES; //为yes只响应优先级最高的事件,Button高于手势,textfield高于手势,textview高于手势,手势高于tableview。为no同时都响应,默认为yes
35 | }
36 |
37 | /**点击事件回调*/
38 | - (void)tapped:(UITapGestureRecognizer *)gesture {
39 | if (self.tapViewBlock) {
40 | self.tapViewBlock(gesture);
41 | }
42 | }
43 |
44 | /*!移除某一约束*/
45 | - (void)lf_removeConstraintsWithFirstItem:(id)firstItem firstAttribute:(NSLayoutAttribute)firstAttribute {
46 | for (NSLayoutConstraint *constraint in self.constraints) {
47 | if (constraint.firstItem == firstItem && constraint.firstAttribute == firstAttribute) {
48 | if ([constraint respondsToSelector:@selector(setActive:)]) {
49 | constraint.active = NO;
50 | } else {
51 | [self removeConstraint:constraint];
52 | }
53 | }
54 | }
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIView+LFXIB/UIView+LFXIB.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+LFXIB.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //给xib的属性面板加如下属性,代码写的UI也可以使用如下属性
12 | //IB_DESIGNABLE //这个只能自定义控件加
13 | @interface UIView (LFXIB)
14 |
15 | @property (assign,nonatomic) IBInspectable NSInteger lfCornerRadius; //圆角
16 | @property (strong,nonatomic) IBInspectable UIColor *lfBorderColor; //边框色,UIColor类型
17 | @property (assign,nonatomic) IBInspectable NSInteger pxBorderWidth; //边框宽,单位px
18 | @property (assign,nonatomic) IBInspectable CGFloat pxWidth; //宽,单位px
19 | @property (assign,nonatomic) IBInspectable CGFloat pxHeight; //高,单位px
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIView+LFXIB/UIView+LFXIB.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+LFXIB.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/11/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UIView+LFXIB.h"
10 |
11 | @implementation UIView (LFXIB)
12 |
13 | - (void)setLfCornerRadius:(NSInteger)lfCornerRadius{
14 | self.layer.cornerRadius = lfCornerRadius;
15 | self.layer.masksToBounds = lfCornerRadius > 0;
16 | }
17 |
18 | - (NSInteger)lfCornerRadius{
19 | return self.layer.cornerRadius;
20 | }
21 |
22 | - (void)setLfBorderColor:(UIColor *)lfBorderColor{
23 | self.layer.borderColor = lfBorderColor.CGColor;
24 | }
25 |
26 | - (UIColor *)lfBorderColor{
27 | return [UIColor colorWithCGColor:self.layer.borderColor];
28 | }
29 |
30 | - (void)setPxBorderWidth:(NSInteger)pxBorderWidth{
31 | self.layer.borderWidth = pxBorderWidth / [UIScreen mainScreen].scale;
32 | }
33 |
34 | - (NSInteger)pxBorderWidth{
35 | return self.layer.borderWidth * [UIScreen mainScreen].scale;
36 | }
37 |
38 |
39 |
40 | - (void)setPxWidth:(CGFloat)pxWidth {
41 | CGRect rect = self.frame;
42 | rect.size.width = pxWidth / [UIScreen mainScreen].scale;
43 | self.frame = rect;
44 | }
45 |
46 | - (CGFloat)pxWidth {
47 | return self.frame.size.width * [UIScreen mainScreen].scale;
48 | }
49 |
50 | - (void)setPxHeight:(CGFloat)pxHeight {
51 | CGRect rect = self.frame;
52 | rect.size.height = pxHeight / [UIScreen mainScreen].scale;
53 | self.frame = rect;
54 | }
55 |
56 | - (CGFloat)pxHeight {
57 | return self.frame.size.height * [UIScreen mainScreen].scale;
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIViewController+FullScreenScroll/UIViewController+FullScreenScroll.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+FullScreenScroll.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/25.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define kFullScreenScrollNotification @"kELFullScreenScrollNotification"
12 |
13 | @interface UIViewController (FullScreenScroll)
14 |
15 | @property (nonatomic) NSNumber *startY;//手势开始位置
16 |
17 | /**添加上下滑动手势*/
18 | - (void)addSwipe:(UIView *)inView;
19 |
20 | /**添加上下滑动手势触发事件*/
21 | - (void)handleSwipe:(UISwipeGestureRecognizer *)gesture;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIViewController+FullScreenScroll/UIViewController+FullScreenScroll.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+FullScreenScroll.m
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/6/25.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "UIViewController+FullScreenScroll.h"
10 | #import "UITabBarController+HideTabBar.h"
11 | #import
12 |
13 | static void *startYKey = &startYKey;
14 |
15 |
16 | @implementation UIViewController (FullScreenScroll)
17 |
18 | - (NSNumber *)startY {
19 | return objc_getAssociatedObject(self, &startYKey);
20 | }
21 |
22 | -(void)setStartY:(NSNumber *)startY {
23 | objc_setAssociatedObject(self, & startYKey, startY, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
24 | }
25 |
26 | - (void)addSwipe:(UIView *)inView {
27 | //上下滑动手势
28 | UIPanGestureRecognizer *swipeGestureRecognizer=[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)];
29 | // [swipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionDown];
30 | [inView addGestureRecognizer:swipeGestureRecognizer];
31 | swipeGestureRecognizer.cancelsTouchesInView = NO;//为yes只响应优先级最高的事件,Button高于手势,textfield高于手势,textview高于手势,手势高于tableview。为no同时都响应,默认为yes
32 | swipeGestureRecognizer.delegate = (id)self;
33 | }
34 | - (void)handleSwipe:(UISwipeGestureRecognizer *)gesture {
35 | CGPoint touchPoint = [gesture locationInView:self.view];
36 | if (gesture.state == UIGestureRecognizerStateBegan) {
37 | self.startY = @(touchPoint.y);
38 | }
39 | if((touchPoint.y - self.startY.floatValue) > 30) {
40 | [self.tabBarController setTabBarHidden:NO animated:YES];
41 | [self.navigationController setNavigationBarHidden:NO animated:YES];
42 | [[NSNotificationCenter defaultCenter] postNotificationName:kFullScreenScrollNotification object:@(NO)];
43 | } else if ((touchPoint.y - self.startY.floatValue) < -30) {
44 | [self.tabBarController setTabBarHidden:YES animated:YES];
45 | [self.navigationController setNavigationBarHidden:YES animated:YES];
46 | [[NSNotificationCenter defaultCenter] postNotificationName:kFullScreenScrollNotification object:@(YES)];
47 | }
48 | }
49 |
50 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
51 |
52 | if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
53 | return YES;
54 | }
55 | return NO;
56 |
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIViewController+LF/UIViewController+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+LF.h
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/9/24.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface UIViewController (LF)
13 |
14 | /**获取KeyWindow*/
15 | + (UIWindow *)lf_getKeyWindow;
16 |
17 | /**获取当前控制器*/
18 | + (UIViewController *)lf_currentViewController;
19 |
20 | /**从根控制器上获取当前控制器*/
21 | + (UIViewController *)lf_currentViewControllerWithRootViewController:(UIViewController *)rootViewController;
22 |
23 | /**获取view所在的控制器*/
24 | + (UIViewController *)lf_viewControllerOfView:(UIView *)view;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Category/UIViewController+LF/UIViewController+LF.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+LF.m
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/9/24.
6 | //
7 |
8 | #import "UIViewController+LF.h"
9 |
10 | @implementation UIViewController (LF)
11 |
12 | /**获取当前控制器*/
13 | + (UIViewController*)lf_currentViewController {
14 | return [self lf_currentViewControllerWithRootViewController:[self lf_getKeyWindow].rootViewController];
15 | }
16 |
17 | /**获取KeyWindow*/
18 | + (UIWindow *)lf_getKeyWindow {
19 | if (@available(iOS 13.0, *)) {
20 | for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
21 | if (windowScene.activationState == UISceneActivationStateForegroundActive) {
22 | for (UIWindow *window in windowScene.windows) {
23 | if (window.isKeyWindow) {
24 | return window;
25 | break;
26 | }
27 | }
28 | }
29 | }
30 | }
31 | else {
32 | return [UIApplication sharedApplication].keyWindow;
33 | }
34 | return nil;
35 | }
36 |
37 | /**从根控制器上获取当前控制器*/
38 | + (UIViewController *)lf_currentViewControllerWithRootViewController:(UIViewController *)rootViewController {
39 | if (rootViewController.presentedViewController) {
40 | UIViewController* presentedViewController = rootViewController.presentedViewController;
41 | return [self lf_currentViewControllerWithRootViewController:presentedViewController];
42 | } else if ([rootViewController isKindOfClass:[UINavigationController class]]) {
43 | UINavigationController* navigationController = (UINavigationController*)rootViewController;
44 | return [self lf_currentViewControllerWithRootViewController:navigationController.visibleViewController];
45 | } else if ([rootViewController isKindOfClass:[UITabBarController class]]) {
46 | UITabBarController *tabBarController = (UITabBarController *)rootViewController;
47 | return [self lf_currentViewControllerWithRootViewController:tabBarController.selectedViewController];
48 | } else {
49 | return rootViewController;
50 | }
51 | }
52 |
53 | /**获取view所在的控制器*/
54 | + (UIViewController *)lf_viewControllerOfView:(UIView *)view {
55 | // 遍历响应者链。返回第一个找到视图控制器
56 | UIResponder *responder = view;
57 | while ((responder = [responder nextResponder])){
58 | if ([responder isKindOfClass: [UIViewController class]]){
59 | return (UIViewController *)responder;
60 | }
61 | }
62 | // 如果没有找到则返回nil
63 | return nil;
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFAlignCollectionViewFlowLayout/LFAlignCollectionViewFlowLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFAlignCollectionViewFlowLayout.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger,LFAlignCollectionViewFlowLayoutType){
12 | LFAlignCollectionViewFlowLayoutTypeLeft,
13 | LFAlignCollectionViewFlowLayoutTypeCenter,
14 | LFAlignCollectionViewFlowLayoutTypeRight
15 | };
16 |
17 |
18 | /**
19 | 可设置对齐样式的CollectionViewFlowLayout
20 | */
21 | @interface LFAlignCollectionViewFlowLayout : UICollectionViewFlowLayout
22 |
23 | -(instancetype)initWthType:(LFAlignCollectionViewFlowLayoutType)alignType;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFAnnulusProgress/LFAnnulusProgress.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFAnnulusProgress.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | 环形进度条
13 | */
14 | @interface LFAnnulusProgress : UIView
15 |
16 | @property (nonatomic, assign) CGFloat progressValue;
17 | @property (nonatomic, strong) UIColor *startColor;
18 | @property (nonatomic, strong) UIColor *centerColor;
19 | @property (nonatomic, strong) UIColor *endColor;
20 | @property (nonatomic, assign) CGFloat bgLineWidth;
21 | @property (nonatomic, assign) CGFloat lineWidth;
22 | @property (nonatomic, assign) CGFloat startAngle;
23 | @property (nonatomic, assign) CGFloat endAngle;
24 | @property (nonatomic, assign) BOOL isClockWise;//是否顺时针
25 |
26 | /**一定要在初始化时确定大小*/
27 | -(instancetype)initWithFrame:(CGRect)frame;
28 | - (void)createUI;
29 | - (void)removeUI;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFAnnulusProgress/LFAnnulusProgress.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFAnnulusProgress.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFAnnulusProgress.h"
10 |
11 | #define DEGREES_TO_RADOANS(x) (M_PI * (x) / 180.0) // 将角度转为弧度
12 |
13 | @interface LFAnnulusProgress ()
14 |
15 | @property (strong, nonatomic) CAShapeLayer *colorLayer; // 渐变色
16 | @property (strong, nonatomic) CAShapeLayer *colorMaskLayer; // 渐变色遮罩
17 |
18 | @end
19 |
20 | @implementation LFAnnulusProgress
21 |
22 | -(instancetype)initWithFrame:(CGRect)frame {
23 |
24 | self = [super initWithFrame:frame];
25 |
26 | if (self) {
27 | //默认设置
28 | self.startColor = [UIColor yellowColor];
29 | self.centerColor = [UIColor orangeColor];
30 | self.endColor = [UIColor redColor];
31 | self.lineWidth = 5;
32 | self.isClockWise = YES;
33 | self.startAngle = DEGREES_TO_RADOANS(-90);
34 | self.endAngle = DEGREES_TO_RADOANS(270);
35 | self.backgroundColor = [UIColor whiteColor];
36 | self.progressValue = 0;
37 | }
38 |
39 | return self;
40 |
41 | }
42 |
43 | - (void)createUI {
44 | //将自己裁剪成圆环
45 | self.layer.mask = [self getAnnulusMaskLayer:self.bgLineWidth];
46 |
47 | //渐变色layer由左右两边组成
48 | self.colorLayer = [CAShapeLayer layer];
49 | self.colorLayer.frame = self.bounds;
50 | [self.layer addSublayer:self.colorLayer];
51 |
52 | CAGradientLayer *leftLayer = [CAGradientLayer layer];
53 | leftLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds));
54 | leftLayer.locations = @[@0.0, @0.9, @1];// 分段设置渐变色
55 | leftLayer.colors = @[(id)self.endColor.CGColor, (id)self.centerColor.CGColor];
56 | [self.colorLayer addSublayer:leftLayer];
57 |
58 | CAGradientLayer *rightLayer = [CAGradientLayer layer];
59 | rightLayer.frame = CGRectMake(CGRectGetWidth(self.bounds) / 2, 0, CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds));
60 | rightLayer.locations = @[@0.0, @0.9, @1];
61 | rightLayer.colors = @[(id)self.startColor.CGColor, (id)self.centerColor.CGColor];
62 | [self.colorLayer addSublayer:rightLayer];
63 |
64 | //渐变色layer的遮罩layer
65 | CAShapeLayer *layer = [self getAnnulusMaskLayer:self.lineWidth];
66 | layer.lineWidth = self.lineWidth + 0.5;
67 | self.colorMaskLayer = layer;
68 | self.colorLayer.mask = self.colorMaskLayer;
69 | self.progressValue = 0;
70 | }
71 |
72 | - (void)removeUI {
73 | [self.colorLayer removeFromSuperlayer];
74 | }
75 |
76 | /**获取圆环Layer*/
77 | - (CAShapeLayer *)getAnnulusMaskLayer:(CGFloat)lineWidth {
78 | CAShapeLayer *layer = [CAShapeLayer layer];
79 | layer.frame = self.bounds;
80 | // 创建一个圆心为父视图中点的圆,半径为父视图宽的0.5 - lineWidth/2
81 | UIBezierPath *path = nil;
82 | if (self.isClockWise) {
83 | path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2) radius:CGRectGetWidth(self.bounds) / 2 - lineWidth/2 startAngle:self.startAngle endAngle:self.endAngle clockwise:YES];
84 | } else {
85 | path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2) radius:CGRectGetWidth(self.bounds) / 2 - lineWidth/2 startAngle:self.endAngle endAngle:self.startAngle clockwise:NO];
86 | }
87 | layer.lineWidth = lineWidth;
88 | layer.path = path.CGPath;
89 | layer.fillColor = [UIColor clearColor].CGColor; // 填充色为透明(不设置为黑色)
90 | layer.strokeColor = [UIColor blackColor].CGColor; // 随便设置一个边框颜色
91 | // layer.lineCap = kCALineCapRound; // 设置线为圆角
92 | return layer;
93 | }
94 |
95 | - (void)setProgressValue:(CGFloat)progressValue {
96 | if (progressValue > 1.0) {
97 | return;
98 | }
99 | _progressValue = progressValue;
100 | self.colorMaskLayer.strokeEnd = progressValue;
101 |
102 | }
103 |
104 | @end
105 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBadge/LFBadge.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBadge.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/11/24.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, LFBadgeType) {
12 | LFBadgeType_Center,//Badge中心对准父视图右上角
13 | LFBadgeType_RightTop,//Badge右上角对准父视图右上角
14 | LFBadgeType_LeftBottom//Badge左下角对准父视图右上角
15 | };
16 |
17 | /**未读消息角标控件,支持xib和代码2种方式使用,支持拖拽清除*/
18 |
19 | @interface LFBadge : UIView
20 |
21 | @property (nonatomic, strong) UIColor *badgeCorlor;//角标颜色,默认红色
22 | @property (nonatomic, strong) UILabel *lbText;//默认白字,字体14,角标大小自动适应字体大小
23 | @property (nonatomic) BOOL needDisappearEffects;//是否需要消失特效,爆炸特效
24 |
25 | //最大数字,不设置则默认99,要在count之前设置
26 | @property (nonatomic, assign) NSInteger maxCount;
27 |
28 | //@"0"或者nil隐藏,@""显示红点,大于maxCount的数字字符串显示maxCount++,其他字符串就显示本来样子(你也可以显示new)
29 | @property (nonatomic, copy) NSString *count;
30 |
31 | @property (nonatomic, assign) CGFloat redDotSize;//红点大小,不设置则默认8
32 | @property (nonatomic, assign) CGFloat maxDistance;//大圆脱离小圆的最大距离
33 |
34 | /**自行设置其他约束或者frame时下面2属性无效****/
35 | @property (nonatomic) UIEdgeInsets edgeInsets;//对父视图右上角的偏移量,默认UIEdgeInsetsZero
36 | @property (nonatomic) LFBadgeType type;
37 |
38 | /**拖动清除回调(设置了这个才会有拖动效果)*/
39 | @property (nonatomic, copy) void(^clearBlock)(void);
40 |
41 |
42 | /**添加到父视图右上角(自动加约束)*/
43 | - (void)addToView:(UIView*)superview;
44 |
45 | /**将角标加到TabBarItem右上角(自动加约束)*/
46 | - (void)addToTabBarItem:(UITabBarItem *)tabBarItem;
47 |
48 | /**将角标加到BarButtonItem右上角(自动加约束)*/
49 | - (void)addToBarButtonItem:(UIBarButtonItem *)barButtonItem;
50 |
51 | /**清除角标约束(如果不想加到父视图右上角可调该方法,然后自行设置其他约束或者frame)*/
52 | - (void)clearBadgeConstraint;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBaseCardView/LFAlertView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFAlertView.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/2/22.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFBaseCardView.h"
10 |
11 | typedef NS_ENUM (NSInteger, LFAlertViewStyle) {
12 | LFAlertViewActionSheet = 0,
13 | LFAlertViewAlert
14 | };
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | @interface LFAlertView : LFBaseCardView
19 |
20 | @property (nonatomic, strong) UILabel *lbTitle;
21 | @property (nonatomic, strong) UITextView *tvMessage;
22 |
23 | //textFieldArray和placeholderArray 二选一,设置placeholderArray的话则生成默认的textFieldArray,需要自定义输入框样式则设置buttonArray;placeholderArray可以是@[@"",@""]等空字符串的数组
24 | @property (nonatomic, strong) NSArray* textFieldArray;
25 | @property (nonatomic, strong) NSArray* placeholderArray;
26 |
27 | //buttonArray和buttonTitle 二选一,设置buttonTitle的话则生成默认的buttonArray,需要自定义按钮样式则设置buttonArray;取消按钮放在数组第一个位置。
28 | @property (nonatomic, strong) NSArray* buttonArray;
29 | @property (nonatomic, strong) NSArray* buttonTitleArray;
30 |
31 | @property (nonatomic, copy) void(^clickBlock)(UIButton *button);
32 |
33 | NS_ASSUME_NONNULL_END
34 |
35 | - (instancetype _Nullable)initWithTitle:(NSString *_Nullable)title message:(NSString *_Nullable)message style:(LFAlertViewStyle)style;
36 |
37 | - (void)show;
38 |
39 | @end
40 |
41 |
42 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBaseCardView/LFBaseCardView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBaseCardView.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/22.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, LFBaseCardAnimate) {
12 | LFBaseCardAnimateNormal,//中间
13 | LFBaseCardAnimateFromBottom,//从底部滑出并贴着底部
14 | LFBaseCardAnimateFromTop,//从顶部滑出并贴着顶部
15 | LFBaseCardAnimateFromBottomToCenter,//从底部到中间(待实现)
16 | LFBaseCardAnimateFromTopToCenter//从顶部到中间(待实现)
17 | };
18 |
19 | @interface LFBaseCardView : UIView
20 |
21 | @property (nonatomic, strong) NSLayoutConstraint *cotCenter;
22 | @property (nonatomic, assign) CGFloat windowY;//窗口的y位置,不设置则上下居中(如果有键盘,会自动去掉键盘大小后,再上下居中)
23 | @property (nonatomic, assign) CGFloat windowW;//窗口的宽度(不设置则需要由控制器子视图的约束来确定窗口大小)
24 | @property (nonatomic, assign) CGFloat windowH;//窗口的高度(不设置则需要由控制器子视图的约束来确定窗口大小)
25 | @property (nonatomic, assign) CGFloat maxHeight;//窗口最大高度
26 | @property (nonatomic, assign) BOOL isFullWidth;//是否宽度全屏(针对横屏也要宽度全屏)
27 | @property (nonatomic, assign) BOOL isFullHeight;//是否高度全屏
28 | @property (nonatomic, assign) BOOL hideMask;//半透明背景遮罩层,
29 | @property (nonatomic, assign) BOOL needTapGesture;//是否需要点击空白处消失
30 | @property (nonatomic, copy) void(^tapBlankBlock)(void); //点击空白回调
31 | @property (nonatomic, copy) void(^dismissCompletion)(void); //弹窗消失完成回调
32 |
33 | - (void)showIn:(UIView *)superview animate:(LFBaseCardAnimate)animate;
34 |
35 | - (void)dismiss:(void(^)(void))completion;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBubbleView/LFBubbleView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBubbleView.h
3 | // LFBubbleViewDemo
4 | //
5 | // Created by 张林峰 on 16/6/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, LFTriangleDirection) {
12 | LFTriangleDirection_Down,
13 | LFTriangleDirection_Left,
14 | LFTriangleDirection_Right,
15 | LFTriangleDirection_Up
16 | };
17 |
18 |
19 | /**
20 | 气泡提示框
21 | */
22 | @interface LFBubbleView : UIView
23 |
24 | @property (nonatomic, strong) UIColor *color;//背景色,默认红色半透明
25 | @property (nonatomic, strong) UIColor *textColor;//字体颜色,默认白色
26 | @property (nonatomic, strong) UIFont *font;//字体,默认12
27 | @property (nonatomic, strong) UIColor *borderColor;//边框色,默认无
28 | @property (nonatomic, assign) CGFloat borderWidth;//默认无
29 | @property (nonatomic, assign) CGFloat cornerRadius;//圆角,默认5
30 | @property (nonatomic, assign) CGFloat triangleH;//三角形高.默认7
31 | @property (nonatomic, assign) CGFloat triangleW;//三角形底边长默认7
32 | @property (nonatomic) UIEdgeInsets edgeInsets;//label四周边距,默认(5,5,5,5)
33 |
34 | @property (nonatomic, strong) UIView *contentView;//容器,可放自定义视图,默认装文字
35 | @property (nonatomic, strong) UILabel *lbTitle;//提示文字
36 | @property (nonatomic) LFTriangleDirection direction;//三角方向,默认朝下
37 | @property (nonatomic, assign) CGFloat dismissAfterSecond;//hideAfterSecond秒后自动消失,不设置或0则不自动消失
38 | @property (nonatomic, strong) NSString *showOnceKey;//如果设置了Key,该气泡只显示一次(比如某个新功能只需要提示用户一次)
39 |
40 | //优先使用triangleXY。如果triangleXY和triangleXYScale都不设置,则三角在中间
41 | @property (nonatomic, assign) CGFloat triangleXY;//三角中心的x或y(三角朝上下代表x,三角朝左右代表y)
42 | @property (nonatomic, assign) CGFloat triangleXYScale;//三角的中心x或y位置占边长的比例,如0.5代表在中间
43 |
44 | /**
45 | * 显示
46 | *
47 | * @param point 三角顶端位置
48 | */
49 | - (void)showInPoint:(CGPoint)point;
50 |
51 | /**来回平移动画*/
52 | - (void)doTranslationAnimate;
53 |
54 | /**弹跳动画*/
55 | - (void)doSpringAnimate;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBubbleView/LFBubbleViewDefaultConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBubbleViewDefaultConfig.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/3.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | (可选)配置LFBubbleView默认样式的单例,只需应用启动时配置一次即可,就不用每次繁琐的设置那些属性
13 | */
14 | @interface LFBubbleViewDefaultConfig : NSObject
15 |
16 | @property (nonatomic, strong) UIColor *color;//背景色,默认红色半透明
17 | @property (nonatomic, strong) UIColor *textColor;//字体颜色,默认白色
18 | @property (nonatomic, strong) UIFont *font;//字体,默认12
19 | @property (nonatomic, strong) UIColor *borderColor;//边框色,默认无
20 | @property (nonatomic, assign) CGFloat borderWidth;//默认无
21 | @property (nonatomic, assign) CGFloat cornerRadius;//圆角,默认5
22 | @property (nonatomic, assign) CGFloat triangleH;//三角形高.默认7
23 | @property (nonatomic, assign) CGFloat triangleW;//三角形底边长默认7
24 | @property (nonatomic) UIEdgeInsets edgeInsets;//label四周边距,默认(5,5,5,5)
25 |
26 | + (instancetype)sharedInstance;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFBubbleView/LFBubbleViewDefaultConfig.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFBubbleViewDefaultConfig.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/3.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFBubbleViewDefaultConfig.h"
10 | #import
11 |
12 | @implementation LFBubbleViewDefaultConfig
13 |
14 | - (instancetype)init {
15 | self = [super init];
16 | if (self) {
17 | self.color = [UIColor colorWithRed:1 green:0 blue:0 alpha:0.5];
18 | self.textColor = [UIColor whiteColor];
19 | self.font = [UIFont systemFontOfSize:12];
20 | self.cornerRadius = 5;
21 | self.triangleH = 7;
22 | self.triangleW = 7;
23 | self.edgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
24 | }
25 | return self;
26 | }
27 |
28 | static LFBubbleViewDefaultConfig *_instance = nil;
29 | + (instancetype)sharedInstance {
30 | static dispatch_once_t onceToken;
31 | dispatch_once(&onceToken, ^{
32 | _instance = [[self alloc] init];
33 | });
34 | return _instance;
35 | }
36 |
37 | - (id)copyWithZone:(NSZone *)zone {
38 | id obj = [[[self class] allocWithZone:zone] init];
39 |
40 | Class class = [self class];
41 | unsigned int count = 0;
42 | //获取类中所有成员变量名
43 | Ivar *ivar = class_copyIvarList(class, &count);
44 | for (int i = 0; i < count; i++) {
45 | Ivar iva = ivar[i];
46 | const char *name = ivar_getName(iva);
47 | NSString *strName = [NSString stringWithUTF8String:name];
48 | //进行解档取值
49 | // id value = [decoder decodeObjectForKey:strName];
50 | id value = [self valueForKey:strName];
51 | //利用KVC对属性赋值
52 | [obj setValue:value forKey:strName];
53 | }
54 | free(ivar);
55 |
56 | return obj;
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFCamera/LFCamera.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFCamera.h
3 | // LFCamera
4 | //
5 | // Created by 张林峰 on 2017/4/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, LFCaptureFlashMode) {
12 | LFCaptureFlashModeOff = 0,
13 | LFCaptureFlashModeOn = 1,
14 | LFCaptureFlashModeAuto = 2
15 | };
16 |
17 | @interface LFCamera : UIView
18 |
19 | @property (assign, nonatomic) CGRect effectiveRect;//拍摄有效区域((可不设置,不设置则不显示遮罩层和边框)
20 |
21 | //有效区边框色,默认橘色
22 | @property (nonatomic, strong) UIColor *effectiveRectBorderColor;
23 |
24 | //遮罩层颜色,默认黑色半透明
25 | @property (nonatomic, strong) UIColor *maskColor;
26 |
27 | @property (nonatomic) UIView *focusView;//聚焦的view
28 |
29 | /**如果用代码初始化,一定要调这个方法初始化*/
30 | - (instancetype)initWithFrame:(CGRect)frame;
31 |
32 | /**获取摄像头方向*/
33 | - (BOOL)isCameraFront;
34 |
35 | /**获取闪光灯模式*/
36 | - (LFCaptureFlashMode)getCaptureFlashMode;
37 |
38 | /**切换闪光灯*/
39 | - (void)switchLight:(LFCaptureFlashMode)flashMode;
40 |
41 | /**切换摄像头*/
42 | - (void)switchCamera:(BOOL)isFront;
43 |
44 | /**拍照*/
45 | - (void)takePhoto:(void (^)(UIImage *img))resultBlock;
46 |
47 | /**重拍*/
48 | - (void)restart;
49 |
50 | /**调整图片朝向*/
51 | + (UIImage *)fixOrientation:(UIImage *)aImage;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFCycleScrollView/LFCycleScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFCycleScrollView.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/10/29.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | //功能强大的轮播空间,不仅可以轮播图片,还可以轮播自定义的任何view
10 |
11 | #import
12 |
13 | @protocol LFCycleScrollViewDelegate;
14 | @protocol LFCycleScrollViewDataSource;
15 |
16 | @interface LFCycleScrollView : UIView
17 |
18 | @property (nonatomic, strong) NSArray *arrayImage; //图片链接数组,存放NSString类型
19 | @property (nonatomic, assign) NSInteger curPage;
20 | @property (nonatomic, strong) UIImage * placeholderImage;
21 | @property (nonatomic, assign) UIViewContentMode contentMode;
22 | @property (nonatomic, assign) BOOL removeTapEvent;
23 | @property (nonatomic, weak) id dataSource;
24 | @property (nonatomic, weak) id delegate;
25 | /**
26 | 默认初始化方式:默认有pageController,默认定时滚动,默认滚动时间间隔2秒
27 | *
28 | 1.如果从外部传入了arrayURL数组,则不需要设置datasource。2.如果需要自定义滚动内容,则设置datasource并实现其方法,arrayURL传nil。
29 | * @param frame frame description
30 | * @param arrayImage 图片链接数组,存放NSString类型
31 | * @return id
32 | */
33 | - (id)initWithFrame:(CGRect)frame withImages:(NSArray *)arrayImage;
34 |
35 |
36 |
37 | /**
38 | * 1.如果从外部传入了arrayURL数组,则不需要设置datasource。2.如果需要自定义滚动内容,则设置datasource并实现其方法,arrayURL传nil。
39 | *
40 | * @param frame frame description
41 | * @param showPageController 是否需要pageController
42 | * @param isAutoScroll 是否自动滚动
43 | * @param duration 滚动时间间隔
44 | * @param arrayImage 图片链接数组,存放NSString类型
45 | * @return id
46 | */
47 | - (id)initWithFrame:(CGRect)frame
48 | showPageController:(BOOL)showPageController
49 | IsAutoScroll:(BOOL)isAutoScroll
50 | Duration:(NSTimeInterval)duration
51 | withImages:(NSArray *)arrayImage;
52 |
53 | //设置PageController点的颜色(非必选,有默认的)
54 | - (void)setPageIndicator:(UIColor *)color highlightColor:(UIColor*)hColor;
55 | //刷新数据
56 | - (void)reloadData;
57 | //获取当前展示的视图
58 | - (UIView *)getCurrentShowView;
59 | //停止滚动
60 | - (void)stopTimer;
61 | //开始滚动
62 | - (void)startTimer;
63 |
64 | @end
65 |
66 |
67 | @protocol LFCycleScrollViewDelegate
68 |
69 | @optional
70 |
71 | - (void)cycleScrollView:(LFCycleScrollView *)csView currentScrollPage:(NSInteger)index;
72 | - (void)cycleScrollView:(LFCycleScrollView *)csView didScrollAtIndex:(NSInteger)index;
73 | - (void)cycleScrollView:(LFCycleScrollView *)csView beginScrollAtIndex:(NSInteger)index;
74 | - (void)cycleScrollView:(LFCycleScrollView *)csView didClickPageAtIndex:(NSInteger)index;
75 | - (void)cycleScrollView:(LFCycleScrollView *)csView doubleClickAtIndex:(NSInteger)index;
76 |
77 | @end
78 |
79 | //自定义的轮播内容(非必选,如果选了就要实现下面方法,用法同tableview)
80 | @protocol LFCycleScrollViewDataSource
81 |
82 | @required
83 | - (NSInteger)numberOfPagesWithCycleScrollView:(LFCycleScrollView *)csView;
84 | - (UIView *)cycleScrollView:(LFCycleScrollView *)csView pageAtIndex:(NSInteger)index;
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFEmptyIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFErrorView/LFEmptyIcon@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFEmptyIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFErrorView/LFEmptyIcon@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFErrorCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFErrorCell.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/11/1.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFErrorView.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface LFErrorCell : UITableViewCell
15 |
16 | @property (nonatomic, strong) LFErrorView *errorView;
17 |
18 | @property (nonatomic, strong) UIImage *errorImage;
19 | @property (nonatomic, strong) NSString *errorMessage;
20 | @property (nonatomic, assign) CGFloat iconTop; // 图片距离顶部。 如果这个数字超过图片上下居中时距顶部的距离,则上下居中。
21 |
22 | @end
23 |
24 | NS_ASSUME_NONNULL_END
25 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFErrorCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFErrorCell.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/11/1.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFErrorCell.h"
10 |
11 | @interface LFErrorCell ()
12 |
13 | @end
14 |
15 | @implementation LFErrorCell
16 |
17 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
18 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
19 | if (self) {
20 | self.selectionStyle = UITableViewCellSelectionStyleNone;
21 | self.separatorInset = UIEdgeInsetsMake(0, 10000, 0, 0);
22 |
23 | self.errorView = [[LFErrorView alloc] initWithFrame:self.contentView.bounds];
24 | self.errorView.ivIcon.image = [UIImage imageNamed:@"LFEmptyIcon"];
25 | self.errorView.lbText.text = @"暂无数据";
26 | [self.contentView addSubview:self.errorView];
27 | }
28 | return self;
29 | }
30 |
31 | - (void)layoutSubviews {
32 | [super layoutSubviews];
33 | self.errorView.frame = self.contentView.bounds;
34 | }
35 |
36 | - (void)setErrorImage:(UIImage *)errorImage {
37 | _errorImage = errorImage;
38 | self.errorView.ivIcon.image = errorImage;
39 | }
40 |
41 | - (void)setErrorMessage:(NSString *)errorMessage {
42 | _errorMessage = errorMessage;
43 | self.errorView.lbText.text = errorMessage;
44 | }
45 |
46 | - (void)setIconTop:(CGFloat)iconTop {
47 | _iconTop = iconTop;
48 | self.errorView.iconTop = _iconTop;
49 | [self.errorView layoutSubviews];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFErrorIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFErrorView/LFErrorIcon@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFErrorIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFErrorView/LFErrorIcon@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFErrorView/LFErrorView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFErrorView.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFErrorView : UIView
12 |
13 | @property (nonatomic, strong) UIImageView *ivBackground;//背景图
14 | @property (nonatomic, assign) BOOL needBlurEffect;
15 | @property (nonatomic, strong) UIImageView *ivIcon;//默认暂无数据的icon
16 | @property (nonatomic, strong) UILabel *lbText;//默认“暂无数据”
17 | @property (nonatomic, strong) UIButton *button;//点击按钮,默认隐藏,文字为空,设置了文字就会自动显示
18 |
19 | //如果show了之后要改下面属性值,需调用一下layoutSubviews
20 | @property (nonatomic, assign) CGFloat itemSpace;//每个子控件间距,默认20
21 | @property (nonatomic, assign) CGFloat labelMargin;//label与父视图边距,默认40
22 | @property (nonatomic, assign) CGFloat iconTop; // 图片距离顶部。 如果这个数字超过图片上下居中时距顶部的距离,则上下居中。
23 | @property (nonatomic, copy) void(^tapBlock)(LFErrorView *errorView);//有按钮文字则是点击按钮的事件,没按钮则是点击整个页面的事件
24 |
25 |
26 |
27 |
28 | /**展示空页面(如果有颜色、字体、间距等样式调整,可建一个子类,重写该方法)*/
29 | + (LFErrorView *)showEmptyInView:(UIView *)supView tapBlock:(void(^)(LFErrorView *errorView))tapBlock;
30 |
31 | /**展示错误页面(如果有颜色、字体、间距等样式调整,可建一个子类,重写该方法)*/
32 | + (LFErrorView *)showErrorInView:(UIView *)supView message:(NSString *)message tapBlock:(void(^)(LFErrorView *errorView))tapBlock;
33 |
34 |
35 | @end
36 |
37 | @interface UIView (ErrorView)
38 |
39 | - (LFErrorView *)showEmptyView:(void(^)(LFErrorView *errorView))tapBlock;
40 |
41 | - (LFErrorView *)showErrorView:(void(^)(LFErrorView *errorView))tapBlock;
42 |
43 | - (void)hideErrorView;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFFMDB/FMDatabase+LF.h:
--------------------------------------------------------------------------------
1 | //
2 | // FMDatabase+LF.h
3 | // LeanFish
4 | //
5 | // Created by 张林峰 on 2018/1/31.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FMDatabase (LF)
12 |
13 | /**默认Document下创建*/
14 | + (instancetype)databaseWithName:(NSString *)name;
15 |
16 | /**获取数据库路径*/
17 | - (NSString*)lf_getPath;
18 |
19 |
20 | /**
21 | 创建表
22 |
23 | @param modelClass 自定义类
24 | @param pkId 主键,可不传
25 | @param nameArr 类中不参与建表的字段
26 | @return 是否创建成果
27 | */
28 | - (BOOL)lf_createTable:(Class)modelClass pkId:(NSString *)pkId ignoreName:(NSArray *)nameArr;
29 |
30 | /**
31 | 插入
32 |
33 | @param tableName 表的名称
34 | @param object 要插入的数据,可以是自定义对象或dictionary
35 | @return 是否插入成功
36 | */
37 | - (BOOL)lf_insertWithTableName:(NSString *)tableName object:(id)object;
38 |
39 | /**
40 | 删除
41 |
42 | @param tableName 表的名称
43 | @param format 条件语句, 如:@"where name = '小李'"
44 | @return 是否删除成功
45 | */
46 | - (BOOL)lf_deleteWithTableName:(NSString *)tableName whereFormat:(NSString *)format, ...;
47 |
48 | /**
49 | 更新
50 |
51 | @param tableName 表的名称
52 | @param object 要更改的数据,可以是自定义对象或dictionary
53 | @param format 条件语句, 如:@"where name = '小李'"
54 | @return 是否更改成功
55 | */
56 | - (BOOL)lf_updateWithTableName:(NSString *)tableName object:(id)object whereFormat:(NSString *)format, ...;
57 |
58 | /**
59 | 查找
60 |
61 | @param tableName 表的名称
62 | @param object 自定义对像的类名(@"Person")、类([Person class])、实例或dictionary,查询的每条结果放到这个自定义对象或字典中
63 | @param format 条件语句, 如:@"where name = '小李'",
64 | @return 将结果存入array,数组中的元素的类型为object的类型
65 | */
66 | - (NSArray *)lf_queryWithTableName:(NSString *)tableName object:(id)object whereFormat:(NSString *)format, ...;
67 |
68 | /**
69 | 批量插入或更改
70 |
71 | @param dicOrModelArray 要insert数据的数组,也可以将model和dictionary混合装入array
72 | @return 返回的数组存储未插入成功的下标,数组中元素类型为NSNumber
73 | */
74 | - (NSArray *)lf_insertWithTableName:(NSString *)tableName dicOrModelArray:(NSArray *)dicOrModelArray;
75 |
76 | /**
77 | 根据自定义类增加新字段,该操作已在事务中执行
78 |
79 | @param tableName 表的名称
80 | @param object 自定义对像的类名(@"Person")、类([Person class])、实例
81 | @param nameArr 不允许生成字段的属性名的数组
82 | @return 是否成功
83 | */
84 | - (BOOL)lf_alterTableWithTableName:(NSString *)tableName object:(id)object ignoreName:(NSArray *)nameArr;
85 |
86 |
87 | /**
88 | 根据字典增加新字段,该操作已在事务中执行
89 |
90 | @param tableName 表的名称
91 | @param dic 格式为@{@"newname":@"TEXT"}
92 | @return 是否成功
93 | */
94 | - (BOOL)lf_alterTableWithTableName:(NSString *)tableName dictionary:(NSDictionary *)dic;
95 |
96 | /**删除表*/
97 | - (BOOL)lf_deleteTable:(NSString *)tableName;
98 |
99 | /**清空表*/
100 | - (BOOL)lf_deleteAllDataWithTableName:(NSString *)tableName;
101 |
102 | /**是否存在表*/
103 | - (BOOL)lf_isExistTable:(NSString *)tableName;
104 |
105 | /**表中共有多少条数据*/
106 | - (int)lf_tableItemCountWithTableName:(NSString *)tableName;
107 |
108 |
109 | #pragma mark - 线程安全
110 |
111 | /**多线程*/
112 | - (void)lf_inDatabase:(void(^)(FMDatabase *db))block;
113 |
114 | /**事物*/
115 | - (void)lf_inTransaction:(void(^)(FMDatabase *db, BOOL *rollback))block;
116 |
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFFMDB/LFModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFModel.h
3 | // LeanFish
4 | //
5 | // Created by 张林峰 on 2018/2/3.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define SqlText @"text" //数据库的字符类型
12 | #define SqlReal @"real" //数据库的浮点类型
13 | #define SqlInteger @"integer" //数据库的整数类型
14 | #define SqlBlob @"blob" //数据库的二进制类型
15 |
16 |
17 | @interface LFModel : NSObject
18 |
19 | /**获取类的属性*/
20 | +(NSMutableDictionary*)getClassIvarList:(__unsafe_unretained Class)cla;
21 |
22 | /**获取类及父类的属性*/
23 | +(NSDictionary*)getClassAndSuperClassIvarList:(__unsafe_unretained Class)cla;
24 |
25 | /**对象转字典*/
26 | + (NSDictionary *)getDicFromModel:(id)model;
27 |
28 | /**属性类型转数据库类型*/
29 | +(NSString*)getSqlTypeFromPropertyType:(NSString*)type;
30 |
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/Photo_video@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/Photo_video@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/Photo_video@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/Photo_video@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_pressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_pressed@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_pressed@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_radio_pressed@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_video_play_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_video_play_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/Images/photo_video_play_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFImagePicker/Images/photo_video_play_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFAlbumModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFAlbumModel.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/4.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #define LFAlbumMainColor [UIColor colorWithRed:87/255.0f green:185/255.0f blue:245/255.0f alpha:1]
13 | #define LFAlbumDisabledColor [UIColor colorWithRed:176/255.0f green:176/255.0f blue:176/255.0f alpha:1]
14 |
15 | @interface LFAlbumModel : NSObject
16 |
17 | @property (nonatomic, copy) NSString *title; //相册名字
18 | @property (nonatomic, assign) NSInteger count; //该相册内相片数量
19 | @property (nonatomic, strong) PHAsset *headImageAsset; //相册第一张图片缩略图
20 | @property (nonatomic, strong) PHAssetCollection *assetCollection; //相册集,通过该属性获取该相册集下所有照片
21 |
22 | /**获取用户照片相册列表*/
23 | + (NSArray *)getPhotoAlbumList;
24 |
25 | /**获取用户视频相册列表*/
26 | + (NSArray *)getVideoAlbumList;
27 |
28 | /**获取用户所有相册列表,包含视频*/
29 | + (NSArray *)getPhotoAndVideoAlbumList;
30 |
31 | /**获取相册集中的图片Asset*/
32 | + (NSArray *)getImageAssetsInAssetCollection:(PHAssetCollection *)assetCollection ascending:(BOOL)ascending;
33 |
34 | /**获取相册集中的视频Asset*/
35 | + (NSArray *)getVideoAssetsInAssetCollection:(PHAssetCollection *)assetCollection ascending:(BOOL)ascending;
36 |
37 | /**生成纯色图片*/
38 | + (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFBigImageBrowser.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBigImageBrowser.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/10.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFPhotoBrowser.h"
10 | #import "LFPhotoModel.h"
11 |
12 | @interface LFBigImageBrowser : LFPhotoBrowser
13 |
14 | //最大选择数
15 | @property (nonatomic, assign) NSInteger maxSelectCount;
16 |
17 | //是否选择了原图
18 | @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
19 | //当前已经选择的图片
20 | @property (nonatomic, strong) NSMutableArray *arraySelectPhotos;
21 |
22 | //选则完成后回调
23 | @property (nonatomic, copy) void (^DoneBlock)(BOOL isOriginalPhoto);
24 |
25 |
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFBigVideoController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBigVideoController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/10.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFPhotoModel.h"
10 |
11 | #import
12 |
13 | @interface LFBigVideoController : UIViewController
14 |
15 | @property (nonatomic, strong) LFPhotoModel *videoModel;
16 |
17 | @property (nonatomic, copy) void (^selectVideoBlock)(LFPhotoModel* video); //点击确定按钮回调
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFImagePicker.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFImagePicker.h
3 | // LFQRCode
4 | //
5 | // Created by 张林峰 on 2017/5/16.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "LFPhotoModel.h"
12 | #import "LFPhotoAlbumController.h"
13 |
14 | //注意:使用原生相册或拍照LFImagePicker一定要定义成全局变量,否则没有回调
15 |
16 | @interface LFImagePicker : NSObject
17 |
18 | //原生相册单选
19 | - (void)pickSingleImageWithController:(UIViewController *)ctr allowsEditing:(BOOL)allowsEditing resultBlock:(void(^)(UIImage *image))resultBlock;
20 |
21 | //自定义相册多选
22 | - (void)pickMultiImageWithController:(UIViewController *)ctr maxCount:(NSInteger)maxCount dataType:(LFPhotoDataType)type resultBlock:(void(^)(NSMutableArray *arraySelectPhotoModel))resultBlock;
23 |
24 | //原生拍照
25 | - (void)pickImageFromCameraWithController:(UIViewController *)ctr allowsEditing:(BOOL)allowsEditing resultBlock:(void(^)(UIImage *image))resultBlock;
26 |
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoAlbumCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoAlbumCell.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/4.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFPhotoAlbumCell : UITableViewCell
12 |
13 | @property (nonatomic, strong) UIImageView *headImageView;
14 | @property (nonatomic, strong) UILabel *labTitle;
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoAlbumCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoAlbumCell.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/4.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFPhotoAlbumCell.h"
10 |
11 | @implementation LFPhotoAlbumCell
12 |
13 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
14 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
15 | if (self) {
16 | [self.contentView addSubview:self.headImageView];
17 | [self.contentView addSubview:self.labTitle];
18 | self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
19 | }
20 | return self;
21 | }
22 |
23 | - (void)layoutSubviews {
24 | [super layoutSubviews];
25 | CGFloat height = CGRectGetHeight(self.contentView.bounds);
26 | CGFloat gap = 5;
27 | CGFloat imghHight = height - gap*2;
28 | self.headImageView.frame = CGRectMake(15, gap, imghHight, imghHight);
29 | self.labTitle.frame = CGRectMake(CGRectGetMaxX(self.headImageView.frame)+10, (height - 20)/2, 200, 20);
30 | }
31 |
32 | #pragma mark - Getter
33 |
34 | - (UIImageView *)headImageView {
35 | if (!_headImageView) {
36 | _headImageView = [[UIImageView alloc] init];
37 | _headImageView.backgroundColor = [UIColor whiteColor];
38 | _headImageView.contentMode = UIViewContentModeScaleAspectFill;
39 | _headImageView.clipsToBounds = YES;
40 | }
41 | return _headImageView;
42 | }
43 |
44 | - (UILabel *)labTitle {
45 | if (!_labTitle) {
46 | _labTitle = [[UILabel alloc] init];
47 | _labTitle.textColor = [UIColor blackColor];
48 | _labTitle.textAlignment = NSTextAlignmentLeft;
49 | _labTitle.font = [UIFont systemFontOfSize:16];
50 | }
51 | return _labTitle;
52 | }
53 | @end
54 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoAlbumController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoAlbumController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/4.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFPhotoModel.h"
11 |
12 | typedef NS_ENUM (NSUInteger, LFPhotoDataType) {
13 | LFPhotoDataTypeAll, //选照片、视频
14 | LFPhotoDataTypeVideos, //只选视频
15 | LFPhotoDataTypePhotos //只选照片
16 | };
17 |
18 | /**相册列表*/
19 | @interface LFPhotoAlbumController : UIViewController
20 |
21 | @property (nonatomic, assign) LFPhotoDataType dataType;
22 |
23 | //最大选择数
24 | @property (nonatomic, assign) NSInteger maxSelectCount;
25 |
26 | //当前已经选择的图片
27 | @property (nonatomic, strong) NSMutableArray *arraySelectPhotos;
28 |
29 | //选则完成后回调
30 | @property (nonatomic, copy) void (^DoneBlock)(NSMutableArray *arraySelectPhotos, BOOL isOriginalPhoto);
31 |
32 | //取消选择后回调
33 | @property (nonatomic, copy) void (^CancelBlock)(void);
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoCollectionCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoCollectionCell.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/6.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFPhotoModel.h"
11 |
12 | @interface LFPhotoCollectionCell : UICollectionViewCell
13 |
14 | @property (nonatomic, strong) UIImageView *imageView;
15 | @property (nonatomic, strong) UIButton *btnSelect;
16 | @property (nonatomic, strong) UIView *coverView;//蒙层,不可点时显示蒙层
17 | @property (nonatomic, strong) LFPhotoModel *photo;
18 | @property (nonatomic, strong) void(^selectBlock)(LFPhotoModel *photo, UIButton *button);
19 |
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoNavController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoNavController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/10.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM (NSInteger, LFPhotoNavBarStyle) {
12 | LFPhotoNavBarStyleBlack,
13 | LFPhotoNavBarStyleLightContent
14 | };
15 |
16 | @interface LFPhotoNavController : UINavigationController
17 |
18 | @property (nonatomic, assign) LFPhotoNavBarStyle navbarStyle;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFPhotoNavController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoNavController.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/10.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFPhotoNavController.h"
10 | #import "LFAlbumModel.h"
11 |
12 | @interface LFPhotoNavController ()
13 |
14 | @end
15 |
16 | @implementation LFPhotoNavController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | self.navigationBar.translucent = YES;
22 | self.navbarStyle = LFPhotoNavBarStyleBlack;
23 | }
24 |
25 | - (UIStatusBarStyle)preferredStatusBarStyle {
26 | return [self.topViewController preferredStatusBarStyle];
27 | }
28 |
29 | - (void)setNavbarStyle:(LFPhotoNavBarStyle)navbarStyle {
30 | _navbarStyle = navbarStyle;
31 | switch (_navbarStyle) {
32 | case LFPhotoNavBarStyleBlack:
33 | {
34 | [self navBlackStyle]; //无需重复设置
35 | }
36 | break;
37 | case LFPhotoNavBarStyleLightContent:
38 | {
39 | [self navLightContentStyle];
40 | }
41 | break;
42 | default:
43 | break;
44 | }
45 | }
46 |
47 | - (void)navBlackStyle {
48 | self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
49 | self.navigationBar.tintColor = [UIColor whiteColor];
50 | self.navigationBar.barTintColor = [UIColor blackColor];
51 |
52 | [self.navigationBar setBackgroundImage:[[LFAlbumModel imageWithColor:[UIColor blackColor] size:CGSizeMake(1, 1)] resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch] forBarMetrics:UIBarMetricsDefault];
53 | [self.navigationBar setShadowImage:nil];
54 | }
55 |
56 | - (void)navLightContentStyle {
57 | [self.navigationBar setTitleTextAttributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:18.0f],
58 | NSForegroundColorAttributeName:[UIColor blackColor]}];
59 | self.navigationBar.tintColor = [UIColor blackColor];
60 | self.navigationBar.barTintColor = [UIColor whiteColor];
61 | UIImage *image = [LFAlbumModel imageWithColor:[UIColor whiteColor] size:CGSizeMake(1, 1)];
62 | image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch];
63 | [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
64 | [self.navigationBar setShadowImage:nil];
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFImagePicker/LFThumbnailViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFThumbnailViewController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/4.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFPhotoModel.h"
11 |
12 | @interface LFThumbnailViewController : UIViewController
13 |
14 | //相册属性
15 | @property (nonatomic, strong) PHAssetCollection *assetCollection;
16 |
17 | //当前已经选择的图片
18 | @property (nonatomic, strong) NSMutableArray *arraySelectPhotos;
19 | //最大选择数
20 | @property (nonatomic, assign) NSInteger maxSelectCount;
21 | //是否选择了原图
22 | @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
23 |
24 | //选则完成后回调
25 | @property (nonatomic, copy) void (^DoneBlock)(BOOL isOriginalPhoto);
26 |
27 |
28 | //取消选择后回调
29 | @property (nonatomic, copy) void (^CancelBlock)(void);
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLocalMusicPicker/LFLocalMusicPicker.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFLocalMusicPicker.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2017/5/18.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LFLocalMusicPicker : NSObject
13 |
14 | - (void)pickMusicWithController:(UIViewController *)ctr resultBlock:(void(^)(MPMediaItemCollection *mediaItemCollection))resultBlock;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLocalMusicPicker/LFLocalMusicPicker.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFLocalMusicPicker.m
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2017/5/18.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFLocalMusicPicker.h"
10 |
11 | @interface LFLocalMusicPicker ()
12 |
13 | @property (nonatomic, copy) void(^resultBlock)(MPMediaItemCollection *mediaItemCollection);
14 |
15 | @end
16 |
17 | @implementation LFLocalMusicPicker
18 |
19 | - (void)pickMusicWithController:(UIViewController *)ctr resultBlock:(void(^)(MPMediaItemCollection *mediaItemCollection))resultBlock {
20 | self.resultBlock = resultBlock;
21 |
22 | [self requestAppleMusicAccessWithAuthorizedHandler:^{
23 | //创建播放器控制器
24 | MPMediaPickerController *mpc = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeAnyAudio];
25 | //设置代理
26 | mpc.delegate = self;
27 | [ctr presentViewController:mpc animated:YES completion:nil];
28 | } unAuthorizedHandler:^{
29 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"请到设置-隐私中开启媒体与Apple Music权限" preferredStyle:UIAlertControllerStyleAlert];
30 | [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]];
31 | [alert addAction:[UIAlertAction actionWithTitle:@"去开启" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
32 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
33 | }]];
34 | [ctr presentViewController:alert animated:YES completion:nil];
35 | }];
36 |
37 | }
38 |
39 | #pragma mark - Delegate
40 | //选中后调用
41 | - (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
42 | if (self.resultBlock) {
43 | self.resultBlock(mediaItemCollection);
44 | }
45 |
46 | [mediaPicker dismissViewControllerAnimated:YES completion:nil];
47 | }
48 | //点击取消时回调
49 | - (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker{
50 | [mediaPicker dismissViewControllerAnimated:YES completion:nil];
51 | }
52 |
53 | #pragma mark - 权限
54 | //检查权限
55 | - (void)requestAppleMusicAccessWithAuthorizedHandler:(void(^)(void))authorizedHandler
56 | unAuthorizedHandler:(void(^)(void))unAuthorizedHandler{
57 | if (@available(iOS 9.3, *)) {
58 | MPMediaLibraryAuthorizationStatus authStatus = [MPMediaLibrary authorizationStatus];
59 | if (authStatus == MPMediaLibraryAuthorizationStatusNotDetermined) {
60 | [MPMediaLibrary requestAuthorization:^(MPMediaLibraryAuthorizationStatus status) {
61 | if (status == MPMediaLibraryAuthorizationStatusAuthorized) {
62 | dispatch_async(dispatch_get_main_queue(), ^{
63 | authorizedHandler ? authorizedHandler() : nil;
64 | });
65 | }else{
66 | dispatch_async(dispatch_get_main_queue(), ^{
67 | unAuthorizedHandler ? unAuthorizedHandler() : nil;
68 | });
69 | }
70 | }];
71 | }else if (authStatus == MPMediaLibraryAuthorizationStatusAuthorized){
72 | authorizedHandler ? authorizedHandler() : nil;
73 | }else{
74 | unAuthorizedHandler ? unAuthorizedHandler() : nil;
75 | }
76 | } else {
77 | // Fallback on earlier versions
78 | }
79 | }
80 |
81 | @end
82 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFLogDetailController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFLogDetailController.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2017/11/1.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**日志详情*/
12 | @interface LFLogDetailController : UIViewController
13 |
14 | @property (nonatomic, strong) NSString *logText;
15 | @property (nonatomic, strong) NSString *logDate;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFLogDetailController.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFLogDetailController.m
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2017/11/1.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFLogDetailController.h"
10 |
11 | @interface LFLogDetailController ()
12 |
13 | @property (nonatomic, strong) UITextView *textView;
14 |
15 | @end
16 |
17 | @implementation LFLogDetailController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | // Do any additional setup after loading the view.
22 | self.textView = [[UITextView alloc] initWithFrame:self.view.bounds];
23 | self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
24 | self.textView.editable = NO;
25 | self.textView.text = self.logText;
26 | [self.view addSubview:self.textView];
27 | }
28 |
29 | -(void)viewDidLayoutSubviews {
30 | [super viewDidLayoutSubviews];
31 | if (@available(iOS 11.0, *)) {
32 | self.textView.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, self.view.frame.size.height - self.view.safeAreaInsets.top);
33 | } else {
34 | self.textView.frame = self.view.bounds;
35 | }
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFLogListController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFLogListController.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2017/11/1.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | /**日志列表*/
11 | @interface LFLogListController : UIViewController
12 |
13 | /**给每个Section加个按钮,点击返回该Section日志路径。使用者可以在该回调实现其他功能,比如将该日志分享出去*/
14 | - (void)addButtonTitle:(NSString *)title callBackData:(void(^)(NSString *dataPath))callBack;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFLogManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFLogManager.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/7/2.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 |
10 | // 过期提醒
11 | #define LFLogManagerDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead)
12 |
13 | #import
14 |
15 | /**
16 | 用法:
17 | 1.PrefixHeader文件中加一句extern DDLogLevel ddLogLevel;(如果没有PrefixHeader则在大家都引用的头文件加这句)
18 | 2.app启动是调用[[LFLogManager shareInstance] install];
19 |
20 |
21 | 如果要自定义打印级别和日志路径:
22 | 1.PrefixHeader文件中
23 | #import
24 | extern DDLogLevel ddLogLevel;
25 | #define XXLOG_LEVEL1 (1 << 5)
26 | #define XXLOG_LEVEL2 (1 << 6)
27 | #define XXLog1(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 0), XXLOG_LEVEL1, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
28 | #define XXLog2(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 1), XXLOG_LEVEL2, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
29 |
30 | 2.app启动是调用
31 | //自定义log1
32 | [[LFLogManager shareInstance] installWithLevels:@[@(LFLOG_LEVEL1),@(LFLOG_LEVEL2)] path:filePath];
33 |
34 | //自定义log2(
35 | [[LFLogManager shareInstance] installWithLevels:@[@(XXLOG_LEVEL1),@(XXLOG_LEVEL2)] path:filePath2];
36 | */
37 |
38 | /**日志管理(自己打印的日志+崩溃日志+设置打印级别)*/
39 | @interface LFLogManager : NSObject
40 |
41 | //存放自定义文件FileLogger的字典,key是path
42 | @property (nonatomic, strong, readonly) NSMutableDictionary *dicFileLogger;
43 |
44 | //注意:以下属性需在install之前设置
45 | //单个文件最大size,默认1024*1024
46 | @property (readwrite, assign) unsigned long long maximumFileSize;
47 |
48 | //本次日志距上次创文件超过rollingFrequency秒后新建文件,默认60 * 60 * 24,24小时
49 | @property (readwrite, assign) NSTimeInterval rollingFrequency;
50 |
51 | //最大文件数,默认7
52 | @property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
53 |
54 |
55 | + (instancetype)shareInstance;
56 |
57 | + (void)install LFLogManagerDeprecated("类方法install已弃用,请使用实例方法install");
58 |
59 | /**一般安装(所有DDLog的日志)*/
60 | - (void)install;
61 |
62 | /**自定义安装(自定义等级、文件路径日志)(可与上面的默认安装二者选其一,或者二者都要也行)*/
63 | - (void)installWithLevels:(NSArray*)levels path:(NSString *)path;
64 |
65 | /**获取某路径日志文件,数组中元素DDLogFileInfo*/
66 | - (NSArray *)getLogFilesWithPath:(NSString *)path;
67 |
68 | /**获取所有日志文件,数组中元素DDLogFileInfo*/
69 | - (NSArray *)getAllLogFiles;
70 |
71 | /**获取日志文件,数组中元素DDLogFileInfo*/
72 | - (NSArray *)getLogFiles LFLogManagerDeprecated("已弃用,请使用getAllLogFiles方法");
73 |
74 | /**设置打印级别*/
75 | - (void)setLogLevel:(NSInteger)level;
76 |
77 |
78 | @end
79 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFSelectLogLevelVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFSelectLogLevelVC.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2018/2/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**选择日志打印级别*/
12 | @interface LFSelectLogLevelVC : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFLogManager/LFSelectLogLevelVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFSelectLogLevelVC.m
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 2018/2/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFSelectLogLevelVC.h"
10 | #import "LFLogManager.h"
11 | #import "DDLog.h"
12 |
13 | extern DDLogLevel ddLogLevel;
14 |
15 | @interface LFSelectLogLevelVC ()
16 |
17 | @property (strong, nonatomic) UITableView *tableView;
18 | @property (strong, nonatomic) NSArray *arrayData;
19 |
20 | @end
21 |
22 | @implementation LFSelectLogLevelVC
23 |
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | self.arrayData = @[@{@"name":@"DDLogLevelOff",@"value":@(DDLogLevelOff)},
27 | @{@"name":@"DDLogLevelError",@"value":@(DDLogLevelError)},
28 | @{@"name":@"DDLogLevelWarning",@"value":@(DDLogLevelWarning)},
29 | @{@"name":@"DDLogLevelInfo",@"value":@(DDLogLevelInfo)},
30 | @{@"name":@"DDLogLevelDebug",@"value":@(DDLogLevelDebug)},
31 | @{@"name":@"DDLogLevelVerbose",@"value":@(DDLogLevelVerbose)},
32 | @{@"name":@"DDLogLevelAll",@"value":@(DDLogLevelAll)}];
33 | [self initUI];
34 | }
35 |
36 | - (void)initUI {
37 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
38 | _tableView.dataSource = self;
39 | _tableView.delegate = self;
40 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"mycell"];
41 | [self.view addSubview:_tableView];
42 | }
43 |
44 | -(void)viewDidLayoutSubviews {
45 | [super viewDidLayoutSubviews];
46 | // NSLog(@"大视图3%@",self.view);
47 | if (@available(iOS 11.0, *)) {
48 | self.tableView.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, self.view.frame.size.height - self.view.safeAreaInsets.top);
49 | } else {
50 | self.tableView.frame = self.view.bounds;
51 | }
52 | }
53 |
54 |
55 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
56 | return self.arrayData.count;
57 | }
58 |
59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
60 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"mycell"];
61 | NSDictionary *dic = self.arrayData[indexPath.row];
62 | cell.textLabel.text = dic[@"name"];
63 |
64 | NSInteger level = ((NSNumber *)dic[@"value"]).integerValue;
65 | if (level == ddLogLevel) {
66 | cell.accessoryType = UITableViewCellAccessoryCheckmark;
67 | } else {
68 | cell.accessoryType = UITableViewCellAccessoryNone;
69 | }
70 | return cell;
71 | }
72 |
73 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
74 | NSDictionary *dic = self.arrayData[indexPath.row];
75 | NSInteger level = ((NSNumber *)dic[@"value"]).integerValue;
76 | [[LFLogManager shareInstance] setLogLevel:level];
77 | [tableView reloadData];
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFOptionTableView/LFOptionTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFOptionTableView.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 15/12/31.
6 | // Copyright © 2015年 张林峰. All rights reserved.
7 | //
8 | //功能:输入框下面提供选项的列表
9 |
10 | #define kCellHeigth 30
11 |
12 | #import
13 | @class LFOptionTableView;
14 | @protocol LFOptionTableViewDelegate
15 |
16 | @optional
17 | - (void)LFOptionTableView:(LFOptionTableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
18 |
19 | @end
20 |
21 | @interface LFOptionTableView : UITableView
22 |
23 | @property (nonatomic, weak) idmyDelegate;
24 |
25 | /**
26 | * 初始化与TextField等宽并紧贴在TextField下方的提供选项的列表
27 | *
28 | * @param maxHeight 最大高度,self高度=行数*行高>maxHeight时,self高度=maxHeight,
29 | * @param tf 需要下拉框的TextField
30 | * @param parentView 用来add self,可以是TextField的父视图,祖父视图...祖祖视图,当然越大越好
31 | * @param array 数据源(可选),如果不传则通过key查找NSUserDefaults里的数据
32 | * @param key 通过key查找、存储NSUserDefaults里的数据(可选),key和array至少传一个
33 | * @param autoSave 是否自动保存输入纪录
34 | *
35 | * @return LFOptionTableView
36 | */
37 | - (UITableView *)initWithMaxHeigth:(CGFloat)maxHeight TextField:(UITextField *)tf ParentView:(UIView *)parentView DataSource:(NSMutableArray *)array SaveKey:(NSString *)key IsAutoSave:(BOOL)autoSave;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPhotoBrowser/LFBigImageCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFBigImageCell.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFPhotoModel.h"
11 |
12 | @interface LFBigImageCell : UICollectionViewCell
13 |
14 | @property (nonatomic, strong) UIScrollView *scrollView;
15 | @property (nonatomic, strong) UIImage *placeholder;
16 | @property (nonatomic, strong) LFPhotoModel *photo;
17 |
18 | @property (nonatomic, copy) void (^singleTapCallBack)(void);
19 |
20 | - (UIImage *)getImage;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPhotoBrowser/LFPhotoBrowser.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoBrowser.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFPhotoModel.h"
11 |
12 | @interface LFPhotoBrowser : UIView
13 |
14 | #pragma mark - 必传参
15 | @property (nonatomic, strong) NSArray *arrayData;
16 | @property (nonatomic, assign) NSInteger currentIndex;
17 | @property (nonatomic, weak) UIViewController *ctr;//用于弹权限框的alert
18 |
19 | #pragma mark - 可不传
20 | @property (nonatomic, strong) UIImage *placeholder;
21 | @property (nonatomic) CGRect beginRect;//外面列表中cell转换到window的rect,用于做转场动画(不传则没有转场动画)
22 | @property (nonatomic, strong) UIImage *beginImage;//外面列表中被点击的图片,用于做转场动画(不传则没有转场动画)
23 | //@property (nonatomic, assign) BOOL isShowTopBar;//yes单击显示头部bar,no单击大图浏览器消失,默认为no
24 | @property (nonatomic, assign) BOOL isSupportLandscape;//是否支持横屏,默认yes
25 |
26 | #pragma mark - 方便外面设置字体、图标,没事不需设置
27 | @property (strong, nonatomic) UIView *topBar;
28 | @property (nonatomic, strong) UIButton *btBack;
29 | @property (nonatomic, strong) UIButton *btSave;
30 | @property (nonatomic, strong) UILabel *lbTitle;
31 |
32 | @property (nonatomic, copy) void(^clickBlock)(NSInteger index);//单击事件,如果传了block,则优先使用block事件,否则根据isShowTopBar判断使用何种单击事件
33 | @property (nonatomic, copy) void(^didScrollBlock)(NSInteger index);
34 | @property (nonatomic, copy) void(^didDismiss)(void);//消失事件(让状态栏显示会用到)
35 |
36 | //展示
37 | - (void)show;
38 |
39 | - (UIImage *)getCurrentImage;
40 |
41 | - (void)dismiss;
42 |
43 | //保存图片
44 | - (void)save;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPhotoBrowser/LFPhotoModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPhotoModel.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/6/2.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import //照片
11 |
12 | @interface LFPhotoModel : NSObject
13 |
14 | @property (nonatomic, strong) UIImage *image;
15 | @property (nonatomic, strong) UIImage *smallImage;
16 | @property (nonatomic, strong) PHAsset *asset;
17 | @property (nonatomic, strong) NSString *smallImageUrl;
18 | @property (nonatomic, strong) NSString *bigImageUrl;
19 | @property (nonatomic, assign) CGFloat height;
20 | @property (nonatomic, assign) CGFloat width;
21 | @property (nonatomic, assign) BOOL isSelected;
22 |
23 | /** 字符串数组转大图浏览组件所需数据模型 */
24 | + (NSMutableArray *)getDatasFromStringArray:(NSArray *)array;
25 |
26 | /*
27 | 当前媒体是否为视频
28 | */
29 | - (BOOL)isVideo;
30 |
31 | /*
32 | 获取视频媒体的时长
33 | */
34 | - (NSInteger)fetchVideoLength;
35 |
36 | /*
37 | 获取视频媒体的时长,用于显示
38 | */
39 | - (NSString *)fetchVideoTimeString;
40 |
41 | #pragma mark - 获取asset对应的图片
42 | + (void)requestImageForAsset:(PHAsset *)asset
43 | size:(CGSize)size
44 | resizeMode:(PHImageRequestOptionsResizeMode)resizeMode
45 | needThumbnails:(BOOL)needThumbnails
46 | completion:(void (^)(UIImage *image, NSDictionary *info))completion;
47 |
48 | + (void)requestImageForAsset:(PHAsset *)asset compressionQuality:(CGFloat)compressionQuality resizeMode:(PHImageRequestOptionsResizeMode)resizeMode completion:(void (^)(UIImage *image))completion;
49 |
50 | #pragma mark - 计算大小
51 | /**
52 | * @brief 获取数组内图片的字节大小
53 | */
54 | + (void)getPhotosBytesWithArray:(NSArray*)photos completion:(void (^)(NSString *photosBytes))completion;
55 | /**
56 | * @brief 判断图片是否存储在本地/或者已经从iCloud上下载到本地
57 | */
58 | + (BOOL)judgeAssetisInLocalAblum:(PHAsset *)asset;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPickerView/LFPickerView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPickerView.h
3 | // LFPickerView
4 | //
5 | // Created by 张林峰 on 17/1/11.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define LFPickerViewHeight 216
12 |
13 |
14 | /**
15 | 功能:将PickerView,DatePicker封装得更加简单易用,并可搭配UITextField使用(可选)
16 | */
17 | @interface LFPickerView : UIView
18 |
19 | @property (strong, nonatomic) UIView *maskView;//黑色半透明背景,hidden属性可控制该背景是否显示
20 | @property (strong, nonatomic) UIPickerView *pickerView;
21 | @property (strong, nonatomic) UIDatePicker *datePicker;
22 | @property (strong, nonatomic) UIButton *btnLeft;
23 | @property (strong, nonatomic) UIButton *btnRight;
24 | @property (nonatomic, strong) UITextField *receiverField;////接收数据的TextField(可不设置,如果使用者连回调都懒得处理了,设置他自动帮你处理receiverField的数据)
25 | @property (strong, nonatomic) NSString *strAppending;//有多列时receiverField显示文案的连接符,比如显示男-25岁,则strAppending是“-”
26 |
27 | /**一般picker正在滚动的回调(数组中存放选中的行,多列则有多个值,strResult是拼接好的结果)*/
28 | @property (copy, nonatomic) void(^valueChanged)(LFPickerView * picker, NSArray *values, NSString *strResult);
29 |
30 | /**一般picker确定按钮回调(数组中存放选中的行,多列则有多个值,strResult是拼接好的结果)*/
31 | @property (copy, nonatomic) void(^valueComplete)(LFPickerView * picker, NSArray *values, NSString *strResult);
32 |
33 | /**时间滚动的回调*/
34 | @property (copy, nonatomic) void(^dateChanged)(LFPickerView * picker, NSString *strDate);
35 |
36 | /**时间确定按钮回调*/
37 | @property (copy, nonatomic) void(^dateComplete)(LFPickerView * picker, NSString *strDate);
38 |
39 | /**取消回调*/
40 | @property (copy, nonatomic) void(^cancelBlock)(void);
41 |
42 | /**
43 | * 一般picker
44 | *
45 | * @param component 列数
46 | * @param array 当有多列时为包含多个小数组的大数组,当只有一列时是包含字符串的数组
47 | *
48 | * @return ELPickerView
49 | */
50 | -(id)initWithComponents:(NSInteger)component dataSource:(NSArray *)array height:(CGFloat)height;
51 |
52 | /**
53 | 时间picker
54 | @param format 时间格式
55 | @param height 高度
56 | @return 时间
57 | */
58 | - (id)initWithFormat:(NSString *)format height:(CGFloat)height;
59 |
60 | /**
61 | 设置选中行、列
62 |
63 | @param row 选中列
64 | @param component 选中列
65 | @param animated 是否动画
66 | */
67 | - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;
68 |
69 | /**显示*/
70 | - (void)show;
71 |
72 | /**消失*/
73 | - (void)dismiss;
74 |
75 | @end
76 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/LFEditPicsCollectionView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFEditPicsCollectionView.h
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/10/3.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LFEditPicsCollectionView : UICollectionView
13 |
14 | @property (nonatomic, strong) NSMutableArray *dataArray; // 本地路径、网络路径、imgge
15 | @property (nonatomic, strong) NSString *addIconName; // 本地加号图片名
16 | @property (nonatomic, assign) CGFloat cellWidth; // cell宽
17 | @property (nonatomic, assign) CGFloat cellHeight; // cell高
18 | @property (nonatomic, assign) NSInteger oneRowNum; // 一行个数。默认3个。优先级低于cellWidth
19 | @property (nonatomic, assign) CGFloat margin; // cell间距。默认4
20 | @property (nonatomic, assign) NSInteger maxCount; // 最大张数,默认9
21 | @property (nonatomic, assign) BOOL showDeleteButton; // 是否显示删除按钮
22 |
23 | @property (copy, nonatomic) void (^clickBlock)(NSInteger index, BOOL isAdd);
24 | @property (copy, nonatomic) void (^deleteBlock)(NSInteger index);
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/LFPicCollectionCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPicCollectionCell.h
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/9/23.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | @interface LFPicCollectionCell : UICollectionViewCell
13 |
14 | @property (strong, nonatomic) UIImageView *imageView;
15 | @property (nonatomic, strong) NSString *imageUrl;
16 | @property (nonatomic, strong) UIButton *deleteButton;
17 | @property (nonatomic, assign) NSInteger index;
18 |
19 | @property (nonatomic, copy) void(^deleteBlock)(NSInteger index);
20 |
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/LFPicCollectionCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFPicCollectionCell.m
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/9/23.
6 | //
7 |
8 | #import "LFPicCollectionCell.h"
9 | #import
10 | #import
11 |
12 | @interface LFPicCollectionCell ()
13 |
14 | @end
15 |
16 | @implementation LFPicCollectionCell
17 |
18 | - (instancetype)initWithFrame:(CGRect)frame {
19 | self = [super initWithFrame:frame];
20 | if (self) {
21 | self.clipsToBounds = NO;
22 | self.contentView.clipsToBounds = NO;
23 | [self.contentView addSubview:self.imageView];
24 | [self.contentView addSubview:self.deleteButton];
25 | [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
26 | make.edges.equalTo(self.contentView);
27 | }];
28 |
29 | [self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
30 | make.top.equalTo(self.contentView.mas_top).offset(-7);
31 | make.right.equalTo(self.contentView.mas_right).offset(7);
32 | make.width.height.mas_equalTo(14);
33 | }];
34 | }
35 | return self;
36 | }
37 |
38 | - (void)setImageUrl:(NSString *)imageUrl {
39 | if (!imageUrl) {
40 | return;;
41 | }
42 | if (imageUrl.length < 1) {
43 | return;;
44 | }
45 | _imageUrl = imageUrl;
46 | if ([imageUrl containsString:@"http"]) {
47 | [self.imageView yy_setImageWithURL:[NSURL URLWithString:imageUrl] placeholder:nil];
48 | } else if ([imageUrl containsString:@"/"]) {
49 | // 本地图
50 | self.imageView.image = [UIImage imageWithContentsOfFile:imageUrl];
51 | } else {
52 | // 图片名称
53 | self.imageView.image = [UIImage imageNamed:imageUrl];
54 | }
55 |
56 | }
57 |
58 | - (void)deleteImage:(id)sender {
59 | if (self.deleteBlock) {
60 | self.deleteBlock(self.index);
61 | }
62 | }
63 |
64 | // 让超出父视图的子视图也可以点击
65 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
66 | UIView *view = [super hitTest:point withEvent:event];
67 | if (view == nil) {
68 | //将坐标由当前视图发送到 指定视图 fromView是无法响应的范围小父视图
69 | CGPoint stationPoint = [_deleteButton convertPoint:point fromView:self];
70 | if (CGRectContainsPoint(_deleteButton.bounds, stationPoint))
71 | {
72 | view = _deleteButton;
73 | }
74 | }
75 | return view;
76 | }
77 |
78 |
79 | - (UIImageView *)imageView {
80 | if (!_imageView) {
81 | _imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
82 | [_imageView setContentMode:UIViewContentModeScaleAspectFill];
83 | _imageView.backgroundColor = [UIColor colorWithRed:245.0f/255.0f green:245.0f/255.0f blue:245.0f/255.0f alpha:1];;
84 | _imageView.clipsToBounds=YES;
85 | // _imageView.layer.cornerRadius = 1.5;
86 | }
87 | return _imageView;
88 | }
89 |
90 | - (UIButton *)deleteButton {
91 | if (!_deleteButton) {
92 | _deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
93 | _deleteButton.backgroundColor = [UIColor clearColor];
94 | [_deleteButton setBackgroundImage:[UIImage imageNamed:@"lf_close"] forState:UIControlStateNormal];
95 | _deleteButton.hidden = YES;
96 | [_deleteButton addTarget:self action:@selector(deleteImage:) forControlEvents:UIControlEventTouchUpInside];
97 | }
98 | return _deleteButton;
99 | }
100 |
101 | @end
102 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/LFPicturesCollectionView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPicturesCollectionView.h
3 | // QingShe
4 | //
5 | // Created by 张林峰 on 2022/9/23.
6 | //
7 |
8 | #import
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @protocol LFPicturesCollectionViewDelegate
14 |
15 | @optional
16 |
17 | // 可选外部实现。外部不实现就用内部的大图浏览
18 | -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath;
19 |
20 | @end
21 |
22 | /**显示单图或多图的照片墙*/
23 | @interface LFPicturesCollectionView : UICollectionView
24 |
25 | @property (nonatomic, weak) UIViewController *ctrl;
26 |
27 | // 数组元素结构必须为@{@"url": xxx, @"height": xx, @"width": xx }
28 | @property (nonatomic, strong) NSMutableArray *dataArray;
29 |
30 | @property (nonatomic, assign) CGFloat margin; // cell间距。默认4
31 | @property (nonatomic, assign) CGFloat maxHeight; // 单图最大高度
32 | @property (nonatomic, assign) CGFloat maxWidth; // 单图最大宽度,默认就是本组件宽度
33 | @property (nonatomic, assign) CGFloat minHeight; // 最小高度
34 | @property (nonatomic, assign) CGFloat minWidth; // 最小宽度
35 | @property (nonatomic, assign) NSInteger maxCount; // 最大张数,默认9
36 | @property (nonatomic, assign) BOOL needSave; // 是否需要保存
37 | @property (nonatomic, weak) id picDelegate;
38 |
39 | /**获取图片大小*/
40 | - (CGSize)getPicSize;
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/lf_addPhoto@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFPicturesCollectionView/lf_addPhoto@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/lf_addPhoto@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFPicturesCollectionView/lf_addPhoto@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/lf_close@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFPicturesCollectionView/lf_close@2x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPicturesCollectionView/lf_close@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/LFKit/Component/LFPicturesCollectionView/lf_close@3x.png
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPopupMenu/LFPopupMenu.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPopupMenu.h
3 | // LFPopupMenu
4 | //
5 | // Created by 张林峰 on 2017/8/20.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, PopupMenuDirection) {
12 | PopupMenuDirection_Auto, //箭头自动确定朝上还是下
13 | PopupMenuDirection_Up, //箭头朝上
14 | PopupMenuDirection_Down //箭头朝下
15 | };
16 |
17 | @interface LFPopupMenuItem : NSObject
18 |
19 | @property (nonatomic, strong) NSString *title;
20 | @property (nonatomic, strong) UIImage *image;
21 |
22 | /** 生成选项对象,标题和图片至少要传一个参数*/
23 | + (LFPopupMenuItem *)createWithTitle:(NSString *)title image:(UIImage *)image NS_DEPRECATED_IOS(2_0, 2_0, "该方法已废弃,建议使用+ (LFPopupMenuItem *)createWithTitle:(NSString *)title image:(UIImage *)image action:(void(^)(void))action");
24 |
25 | /** 生成选项对象,标题和图片至少要传一个参数*/
26 | + (LFPopupMenuItem *)createWithTitle:(NSString *)title image:(UIImage *)image action:(void(^)(void))action;
27 |
28 | @end
29 |
30 |
31 |
32 |
33 |
34 |
35 | @interface LFPopupMenu : UIView
36 |
37 | @property (nonatomic, assign) CGFloat rowHeight;//行高,默认60
38 | @property (nonatomic, assign) CGFloat arrowH;//箭头形高,默认9
39 | @property (nonatomic, assign) CGFloat arrowW;//箭头形宽,默认9
40 | @property (nonatomic, assign) CGFloat minWidth;//弹窗最小宽度,默认0
41 | @property (nonatomic, assign) CGFloat popupMargin;//窗口距屏幕边缘最小距离,默认5
42 | @property (nonatomic, assign) CGFloat leftEdgeMargin;//左边距窗口的距离,默认16
43 | @property (nonatomic, assign) CGFloat rightEdgeMargin;//右边距窗口的距离,默认16
44 | @property (nonatomic, assign) CGFloat textMargin;//文字距图标的距离,默认8
45 | @property (nonatomic, assign) CGFloat lineMargin;//分割线左边距,默认0
46 | @property (nonatomic, assign) CGFloat cornerRadius;//弹窗圆角,默认6
47 | @property (nonatomic, assign) CGFloat arrowCornerRadius;//箭头的圆角,默认0
48 | @property (nonatomic, strong) UIColor *lineColor;//分割线颜色、边框色,默认系统灰色
49 | @property (nonatomic, strong) UIFont *textFont;//默认15
50 | @property (nonatomic, strong) UIColor *textColor;//默认黑色
51 | @property (nonatomic, strong) UIColor *fillColor;//带箭头框的填充色,默认白色
52 | @property (nonatomic, assign) BOOL needBorder;//是否要边框
53 |
54 | @property (nonatomic, strong) UIView *maskView;//半透明遮罩层,默认黑色半透明,可自行设置
55 | @property (nonatomic, strong) UIImage *imgBG;//背景图,设置了这个就不用画带箭头的框了。
56 | @property (nonatomic, assign) CGPoint anchorPoint;//设置背景图的情况使用,背景图的三角在背景图的位置比例,如左上角(0,0),右下角(1,1),下边中间(0.5,1)以此类推
57 | @property (nonatomic, strong) UIView *menuSuperView;//本菜单弹窗的父视图,默认在Window上
58 | @property (nonatomic, assign) PopupMenuDirection direction;
59 |
60 | @property (nonatomic, copy) void(^dismissComplete)(void);//所以消失的回调
61 | @property (nonatomic, copy) void(^selectDismiss)(void);//选择后消失的回调
62 | @property (nonatomic, copy) void(^otherDismiss)(void);//点其他区域消失的回调
63 |
64 | /**
65 | 配置选项,注意:设置上面属性之后调用
66 |
67 | @param items 含文字和标题的对象数组
68 | */
69 | - (void)configWithItems:(NSArray*)items;
70 |
71 | /**
72 | 配置选项,注意:设置上面属性之后调用
73 |
74 | @param items 含文字和标题的对象数组
75 | @param action 点击回调,根据index判断点击的第几个
76 | */
77 | - (void)configWithItems:(NSArray*)items action:(void(^)(NSInteger index))action NS_DEPRECATED_IOS(2_0, 2_0, "该方法已废弃,建议使用- (void)configWithItems:(NSArray*)items");
78 |
79 | /**完全自定义菜单弹窗*/
80 | - (void)configWithCustomView:(UIView *)customView;
81 |
82 | /**
83 | 显示菜单窗,有imgBG的情况下调用
84 | @param point 本控件“左上角”位置,相对window
85 | */
86 | - (void)showInPoint:(CGPoint)point;
87 |
88 | /**
89 | 显示菜单窗,无imgBG的情况下调用
90 | @param point 箭头顶点位置,相对window
91 | */
92 | - (void)showArrowInPoint:(CGPoint)point;
93 |
94 |
95 | /**
96 | 显示菜单窗,无imgBG的情况下调用(推荐)
97 |
98 | @param view 箭头对准的view
99 | */
100 | - (void)showArrowToView:(UIView*)view;
101 |
102 | /**
103 | 显示菜单窗,无imgBG的情况下调用(同上,只是加了偏移)
104 |
105 | @param view 箭头对准的view
106 | */
107 | - (void)showArrowToView:(UIView*)view offset:(CGFloat)offset;
108 |
109 |
110 | - (void)dismiss;
111 |
112 | @end
113 |
114 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPopupMenu/LFPopupMenuDefaultConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFPopupMenuDefaultConfig.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/3.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | (可选)配置LFPopupMenu默认样式的单例,只需应用启动时配置一次即可,就不用每次繁琐的设置那些属性
13 | */
14 |
15 | @interface LFPopupMenuDefaultConfig : NSObject
16 |
17 | @property (nonatomic, assign) CGFloat rowHeight;//行高,默认50
18 | @property (nonatomic, assign) CGFloat arrowH;//箭头形高,默认9
19 | @property (nonatomic, assign) CGFloat arrowW;//箭头形宽,默认9
20 | @property (nonatomic, assign) CGFloat minWidth;//弹窗最小宽度,默认0
21 | @property (nonatomic, assign) CGFloat popupMargin;//窗口距屏幕边缘最小距离,默认5
22 | @property (nonatomic, assign) CGFloat leftEdgeMargin;//左边距窗口的距离,默认16
23 | @property (nonatomic, assign) CGFloat rightEdgeMargin;//右边距窗口的距离,默认16
24 | @property (nonatomic, assign) CGFloat textMargin;//文字距图标的距离,默认8
25 | @property (nonatomic, assign) CGFloat lineMargin;//分割线左边距,默认0
26 | @property (nonatomic, assign) CGFloat cornerRadius;//弹窗圆角,默认6
27 | @property (nonatomic, assign) CGFloat arrowCornerRadius;//箭头的圆角,默认0
28 | @property (nonatomic, strong) UIColor *lineColor;//分割线颜色、边框色,默认系统灰色
29 | @property (nonatomic, strong) UIFont *textFont;//默认15
30 | @property (nonatomic, strong) UIColor *textColor;//默认黑色
31 | @property (nonatomic, strong) UIColor *fillColor;//带箭头框的填充色,默认白色
32 | @property (nonatomic, assign) BOOL needBorder;//是否要边框
33 |
34 | + (instancetype)sharedInstance;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFPopupMenu/LFPopupMenuDefaultConfig.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFPopupMenuDefaultConfig.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/3.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFPopupMenuDefaultConfig.h"
10 | #import
11 |
12 | @implementation LFPopupMenuDefaultConfig
13 |
14 | - (instancetype)init {
15 | self = [super init];
16 | if (self) {
17 | self.rowHeight = 50;
18 | self.arrowH = 9;
19 | self.arrowW = 9;
20 | self.popupMargin = 5;
21 | self.leftEdgeMargin = 16;
22 | self.rightEdgeMargin = 16;
23 | self.textMargin = 8;
24 | self.cornerRadius = 6;
25 | self.arrowCornerRadius = 0;
26 | self.lineColor = [UIColor grayColor];
27 | self.textFont = [UIFont systemFontOfSize:15];
28 | self.textColor = [UIColor blackColor];
29 | self.fillColor = [UIColor whiteColor];
30 | self.needBorder =NO;
31 | }
32 | return self;
33 | }
34 |
35 | + (instancetype)sharedInstance {
36 | static LFPopupMenuDefaultConfig *instance = nil;
37 | static dispatch_once_t onceToken;
38 | dispatch_once(&onceToken, ^{
39 | instance = [[self alloc] init];
40 | });
41 | return instance;
42 | }
43 |
44 | - (id)copyWithZone:(NSZone *)zone {
45 | id obj = [[[self class] allocWithZone:zone] init];
46 |
47 | Class class = [self class];
48 | unsigned int count = 0;
49 | //获取类中所有成员变量名
50 | Ivar *ivar = class_copyIvarList(class, &count);
51 | for (int i = 0; i < count; i++) {
52 | Ivar iva = ivar[i];
53 | const char *name = ivar_getName(iva);
54 | NSString *strName = [NSString stringWithUTF8String:name];
55 | //进行解档取值
56 | // id value = [decoder decodeObjectForKey:strName];
57 | id value = [self valueForKey:strName];
58 | //利用KVC对属性赋值
59 | [obj setValue:value forKey:strName];
60 | }
61 | free(ivar);
62 |
63 | return obj;
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFQRCode/LFQRCodeScanner.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFQRCodeScanner.h
3 | // LFQRCode
4 | //
5 | // Created by 张林峰 on 2017/4/26.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LFQRCodeScanner : UIView
13 |
14 | @property (nonatomic, strong) UIImageView *imgLine;//扫描线
15 | @property (nonatomic, copy) void (^scanFilishBlock)(AVMetadataMachineReadableCodeObject *result);
16 |
17 |
18 |
19 | /**
20 | 初始化扫描view
21 | @param frame 注意:frame要传准确的
22 | @param rect 扫描有效区,即中间空缺部分
23 | */
24 | - (instancetype)initWithFrame:(CGRect)frame rectOfInterest:(CGRect)rect;
25 |
26 | /**开始扫描*/
27 | - (void)start;
28 | /**结束扫描*/
29 | - (void)stop;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFQRCode/LFQRCodeUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFQRCodeUtil.h
3 | // LFQRCode
4 | //
5 | // Created by 张林峰 on 2017/4/26.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LFQRCodeUtil : NSObject
13 |
14 | /**直接从图片读取二维码*/
15 | + (NSString *)readQRCodeFromImage:(UIImage *)image;
16 |
17 |
18 | /**
19 | 生成二维码
20 | @param QRString 二维码内容
21 | @param sizeWidth 尺寸
22 | @param color 二维码颜色,注意要是深色冷色,否则不易识别(默认是黑色,黑色最易识别)
23 | @param logo 不是必传参数
24 | @return 二维码
25 | */
26 | +(UIImage *)createQRimageString:(NSString *)QRString sizeWidth:(CGFloat)sizeWidth fillColor:(UIColor *)color logo:(UIImage *)logo;
27 |
28 | /**将模糊图变清晰*/
29 | + (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat)size;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFSegment/LFNestPageContainer.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFNestPageContainer.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2022/9/29.
6 | //
7 |
8 | #import
9 | #import "LFSegmentView.h"
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | /**最外层的嵌套滑动容器(嵌套的是控制器)*/
14 | @interface LFNestPageContainer : UIScrollView
15 |
16 | // 大容器滑动回调
17 | @property (nonatomic, copy) void(^scrollViewDidScrollBlock)(UIScrollView *scrollView);
18 |
19 | // pageController横向滑动的回调
20 | @property (nonatomic, copy) void(^pageControllerDidScrollBlock)(CGFloat pageOffset);
21 |
22 | @property (nonatomic, weak) UIViewController *vc; // 父控制器
23 | @property (nonatomic, assign) BOOL canSwipeBack; // 是否允许侧滑返回
24 | @property (nonatomic, assign) CGFloat topOffset; // 悬浮距上距离
25 | @property (nonatomic, assign) BOOL needRefreshSubList; // 有头部时候是否需要子列表刷新功能
26 | @property (nonatomic, assign) BOOL pageScrollEnabled; // 列表容器是否支持左右滑动,默认yes(有时子页面含有进度条之类的可滑动的,可以禁止这个来解决手势冲突)
27 |
28 | /** 放在本容器之外的LFSegmentView,传给本容器可以自动处理联动 */
29 | @property (nonatomic, strong) LFSegmentView *absoluteSegmentView;
30 | @property (nonatomic, copy) void(^ _Nullable changeIndexBlock)(NSInteger index);
31 |
32 | /** 设置嵌套的控制器*/
33 | - (void)setupControllers:(NSArray *)list currentIndex:(NSInteger)index;
34 |
35 | /**以下2个视图都要设置正确的高度再setup*/
36 | - (void)setupHeader:(UIView *)headerView;
37 | /** 吸顶segment,如果是LFSegmentView类型,自动处理联动,如果是自定义的segmentView,则使用者去处理联动 */
38 | - (void)setupSegment:(UIView *)segmentView;
39 |
40 | - (void)scrollToIndex:(NSInteger)index animated:(BOOL)animated;
41 |
42 | // 滚动到tab
43 | -(void)scrollToTab:(BOOL)animated;
44 |
45 | @end
46 |
47 | NS_ASSUME_NONNULL_END
48 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFSegment/LFNestPageController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFNestPageController.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2022/9/29.
6 | //
7 |
8 | #import
9 |
10 | NS_ASSUME_NONNULL_BEGIN
11 |
12 | /**横向滚动的嵌套页面(嵌套的是控制器)*/
13 | @interface LFNestPageController : UIPageViewController
14 |
15 | @property (nonatomic,strong) NSNumber *debounce;
16 |
17 | @property (nonatomic, weak) UIViewController *vc; // 父控制器(要配置侧滑必传)
18 | @property (nonatomic, assign) BOOL canSwipeBack; // 是否允许侧滑返回
19 | @property (nonatomic, assign, readonly) NSInteger selectedIndex;
20 | @property (nonatomic, retain, readonly) NSArray *allViewControllers;
21 | @property (nonatomic, strong, readonly) UIViewController *selectedViewController;
22 | @property (nonatomic, assign) CGFloat pageOffset; // 偏移量。
23 | @property (nonatomic, assign) BOOL scrollEnabled; // 是否支持左右滑动,默认yes
24 |
25 | @property (nonatomic,copy) void (^selectChanged) (NSInteger originIndex, NSInteger index);
26 |
27 | @property (nonatomic,copy) void (^scrollViewDidScroll) (UIScrollView *scrollView, CGFloat pageOffset);
28 |
29 | - (void)scrollToIndex:(NSInteger)index animated:(BOOL)animated;
30 |
31 | //获取UIPageController的scrollView
32 | - (UIScrollView *)fetchPageCtrlScrollView;
33 | - (UIScrollView *)fetchSubCtrlScrollView:(NSInteger)index;
34 |
35 | - (instancetype)initWithList:(NSArray *)list index:(NSInteger)index;
36 | - (void)updateList:(NSArray *)list index:(NSInteger)index;
37 |
38 | @end
39 |
40 | @interface UIScrollView (LFNestObserve)
41 | @property (nonatomic, strong) NSNumber *lf_isObserver;
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFSegment/LFNestedPageScroll.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFNestedPageScroll.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/8/23.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LFSegmentView.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | /** 横向滚动的嵌套页面(嵌套的是view,如果要嵌套控制器推荐用LFNestPageController)
15 | 搭配使用组合:
16 | 1.LFNestedPageScroll单独使用
17 | 2.LFSegmentView + LFNestedPageScroll
18 | 3.LFSegmentView + LFNestedPageScroll + LFNestedScrollContainer
19 | */
20 | @interface LFNestedPageScroll : UIScrollView
21 |
22 | @property (nonatomic, strong) LFSegmentView *segmentView;
23 |
24 | @property (nonatomic, strong) NSArray *tableViews; //列表数组,可以是tableview、collectionView,甚至是里面含有tableview的UIView等等
25 |
26 | @property (nonatomic, readonly) NSUInteger currentIndex; //当前索引
27 |
28 | @property (nonatomic, copy) void(^didMoveToIndexBlock)(NSUInteger index);// 滑动到index
29 |
30 | @property (nonatomic, copy) void(^didAddTableViewBlock)(NSArray *tables); // 已经加了tableview,或collectionView等UIScrollView类型的视图
31 |
32 | //设置选中第几个
33 | - (void)setSelectedAtIndex:(NSUInteger)index animated:(BOOL)animated;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFSegment/LFNestedScrollContainer.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFNestedScrollContainer.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2019/8/23.
6 | // Copyright © 2019 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "LFNestedPageScroll.h"
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | /** 最外层的嵌套滑动容器(嵌套的是view,如果要嵌套控制器,推荐用LFNestPageContainer) */
16 | @interface LFNestedScrollContainer : UIScrollView
17 |
18 | @property (nonatomic, copy) void(^scrollViewDidScrollBlock)(UIScrollView *scrollView);
19 |
20 | /**以下2个视图都要设置正确的Frame再setup*/
21 | - (void)setupHeader:(UIView *)headerView;
22 | - (void)setupSegment:(UIView *)segmentView;
23 |
24 | - (void)setupPageScroll:(LFNestedPageScroll *)pageScroll;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFSegment/LFSegmentView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFSegmentView.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/1/21.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSUInteger, LFSegmentIndicateStyle) {
12 | LFSegmentIndicateStyleAlignText, //指示线对齐文字
13 | LFSegmentIndicateStyleAlignFull, //指示线对齐整个
14 | };
15 |
16 | /** 分段选择器
17 | 搭配使用组合:
18 | 1.LFSegmentView单独使用
19 | 2.LFSegmentView + LFNestedPageScroll
20 | 3.LFSegmentView + LFNestedPageScroll + LFNestedScrollContainer
21 | */
22 | @interface LFSegmentView : UIView
23 |
24 | @property (nonatomic) LFSegmentIndicateStyle indicateStyle;
25 | @property (nonatomic, strong) UIFont * _Nonnull font;//字体,默认16
26 | @property (nonatomic, strong) UIFont * _Nonnull selectedFont;//字体,默认16
27 | @property (nonatomic, strong, nullable) UIColor *selectedColor;//选中的字体颜色,默认红色
28 | @property (nonatomic, strong, nullable) UIColor *normalColor;//未选中的字体颜色,默认灰色
29 | @property (nonatomic, strong, nullable) UIColor *indicateColor;//指示线颜色,默认和字体颜色一样
30 | @property (nonatomic, assign) CGFloat indicateHeight;//指示线高,默认2
31 | @property (nonatomic, assign) CGFloat minItemSpace;//最小间距,默认20
32 | @property (nonatomic, assign) CGFloat itemSpace;// 间距,优先用itemSpace,没传就用minItemSpace
33 | @property (nonatomic, strong, nullable) UIImage *backgroundImage;//背景图
34 | @property (nonatomic, readonly) UIView * _Nonnull indicateView; //指示杆
35 | @property (nonatomic, readonly) UIView * _Nonnull bottomLine; //底部分割线
36 | @property (nonatomic, strong, readonly) UIButton * _Nullable selectedButton;
37 | @property (nonatomic, strong, readonly) NSArray * _Nonnull buttons;
38 | @property (nonatomic, strong, readonly) UIScrollView * _Nonnull contentView;
39 | @property (nonatomic, readonly) NSUInteger currentIndex;
40 | @property (nonatomic, assign) NSTimeInterval duration; //滑动时间,默认0.3
41 | @property (nonatomic, assign) BOOL needShadow; // 文字是否加阴影
42 | @property (nonatomic, copy) void(^ _Nullable selectedBlock)(NSInteger index, UIButton * _Nullable button);
43 |
44 | - (instancetype _Nullable )initWithFrame:(CGRect)frame titles:(NSArray *_Nonnull)titles;
45 |
46 | - (void)setSelectedIndex:(NSInteger)index;
47 |
48 | /**
49 | 调整线位置
50 |
51 | @param offsetX 页面容器的 offsetX
52 | @param cWidth 页面容器的宽
53 | */
54 | - (void)adjustLinePosition:(CGFloat)offsetX containerWidth:(CGFloat)cWidth;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFStarsView/LFStarsView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFStarsView.h
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | 星级等级视图,支持小数,可设置是否可点击
13 | */
14 | @interface LFStarsView : UIView
15 |
16 | @property (nonatomic, assign) CGFloat value;//若只想用户选择整数,在回调里给本属性赋向上取整整数值。
17 | @property (nonatomic, strong) UIColor *bgColor;//背景色,默认白色。不要设置透明色,可设置跟父视图一样的颜色替代透明色。
18 | @property (nonatomic, copy) void(^selectBlock)(CGFloat value);//设置了回调则可点击或滑动选择星级,不设置则不可点击、滑动
19 |
20 | - (instancetype)initWithFrame:(CGRect)frame;
21 |
22 | - (void)configWithStarNumber:(NSInteger)number image:(UIImage *)image highlightImage:(UIImage *)hImage;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/LFStarsView/LFStarsView.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFStarsView.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/12/25.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFStarsView.h"
10 |
11 | @interface LFStarsView ()
12 |
13 | @property (nonatomic, strong) UIView *starBackgroundView;
14 | @property (nonatomic, strong) UIView *starForegroundView;
15 | @property (nonatomic, assign) NSInteger number;
16 |
17 | @end
18 |
19 | @implementation LFStarsView
20 |
21 | - (instancetype)initWithFrame:(CGRect)frame{
22 | self = [super initWithFrame:frame];
23 | if (self) {
24 | }
25 | return self;
26 | }
27 |
28 | - (void)awakeFromNib {
29 | [super awakeFromNib];
30 | }
31 |
32 | - (void)configWithStarNumber:(NSInteger)number image:(UIImage *)image highlightImage:(UIImage *)hImage {
33 | _number = number;
34 | self.backgroundColor = [UIColor whiteColor];
35 | self.starBackgroundView = [self buidlStarViewWithImage:image];
36 | self.starForegroundView = [self buidlStarViewWithImage:hImage];
37 | [self addSubview:self.starBackgroundView];
38 | [self addSubview:self.starForegroundView];
39 | self.value = 0;
40 | }
41 |
42 | - (void)initUI {
43 |
44 | }
45 |
46 | - (UIView *)buidlStarViewWithImage:(UIImage *)image {
47 | CGRect frame = self.bounds;
48 | UIView *view = [[UIView alloc] initWithFrame:frame];
49 | view.backgroundColor = self.backgroundColor;
50 | view.clipsToBounds = YES;
51 | for (int i = 0; i < _number; i ++) {
52 | UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
53 | imageView.frame = CGRectMake(i * frame.size.width / _number, 0, frame.size.width / _number, frame.size.height);
54 | [view addSubview:imageView];
55 | }
56 | return view;
57 | }
58 |
59 | -(void)setValue:(CGFloat)value {
60 | _value =value;
61 | if (_value < 0) {
62 | _value = 0;
63 | } else if (value > _number) {
64 | value = _number;
65 | }
66 | CGFloat rate=value/_number;
67 | self.starForegroundView.frame = CGRectMake(0, 0, rate*self.frame.size.width, self.frame.size.height);
68 | }
69 |
70 | -(void)setBgColor:(UIColor *)bgColor {
71 | _bgColor = bgColor;
72 | self.backgroundColor = bgColor;
73 | self.starBackgroundView.backgroundColor = bgColor;
74 | self.starForegroundView.backgroundColor = bgColor;
75 | }
76 |
77 | - (void)updateValue:(NSSet *)touches {
78 | if (self.selectBlock) {//判断是否可以点击或滑动星星
79 | UITouch *touch = [touches anyObject];
80 | CGPoint p = [touch locationInView:self];
81 | if (p.x < 0) {
82 | p.x = 0;
83 | } else if (p.x > self.frame.size.width) {
84 | p.x = self.frame.size.width;
85 | }
86 | self.starForegroundView.frame = CGRectMake(0, 0, p.x, self.frame.size.height);
87 | self.selectBlock(p.x/self.frame.size.width * _number);
88 | }
89 | }
90 |
91 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
92 | [self updateValue:touches];
93 | }
94 |
95 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
96 | [self updateValue:touches];
97 | }
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Component/RotationMenu/RotationMenu.h:
--------------------------------------------------------------------------------
1 | //
2 | // RotationMenu.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 15/12/23.
6 | // Copyright © 2015年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | typedef void(^ButtonBlock)(UIButton *);
13 |
14 | @interface RotationMenu : UIView
15 |
16 | @property (nonatomic, copy) ButtonBlock btnBlock;
17 |
18 | /**
19 | * 初始化旋转菜单,一个中心按钮,周围若干个个按钮
20 | *
21 | * @param menuRadius 整个菜单的半径
22 | * @param centerRadius 中心按钮半径
23 | * @param subRadius 周围按钮半径
24 | * @param centerImageName 中心按钮图片名字
25 | * @param centerBackgroundName 中心按钮背景图名字
26 | * @param arraySubImgs 周围按钮图片名字的数组
27 | * @param x 菜单中心的横坐标
28 | * @param y 菜单中心纵坐标
29 | * @param parentView 菜单的父视图
30 | *
31 | * @return 菜单
32 | */
33 | - (id)initWithMenuRadius:(CGFloat)menuRadius
34 | centerRadius:(NSInteger)centerRadius
35 | subRadius:(CGFloat)subRadius
36 | centerImage:(NSString *)centerImageName
37 | centerBackground:(NSString *)centerBackgroundName
38 | subImagesName:(NSArray *)arraySubImgs
39 | MenuCenterX:(CGFloat)x
40 | MenuCenterY:(CGFloat)y
41 | toParentView:(UIView *)parentView;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFDeviceInfo/LFDeviceInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFDeviceInfo.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/8/17.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFDeviceInfo : NSObject
12 |
13 | @property (nonatomic, copy) NSString *deviceToken;/** 获取应用的推送token */
14 | @property (nonatomic, copy) NSString *mac;/** 获取设备的mac地址 */
15 | @property (nonatomic, copy) NSString *clientOS;/** 获取本地设备的操作系统及版本 */
16 | @property (nonatomic, copy) NSString *clientMachine;/** 获取设备的类型 */
17 | @property (nonatomic, assign) BOOL isJailBreak;/** 设备是否越狱 */
18 |
19 | +(instancetype)shareInstance;
20 |
21 | //运营商
22 | + (NSString *)telephonyNetworkInfo;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFEncryptDecryptUtil/LFEncryptDecryptUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFEncryptDecryptUtil.h
3 | // RechargeHand
4 | //
5 | // Created by 张林峰 on 16/5/11.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFEncryptDecryptUtil : NSObject
12 |
13 | #pragma mark - NSData的AES加密解密
14 |
15 | /**NSData AES加密*/
16 | + (NSData *)AES256EncryptPlainData:(NSData *)plainData Key:(NSString *)key;
17 | /**NSData AES解密*/
18 | + (NSData *)AES256DecryptCipherData:(NSData*)cipherData Key:(NSString *)key;
19 |
20 | #pragma mark - NSData的 DES加密解密
21 | /**NSData DES加密*/
22 | + (NSData *)DESEncryptPlainData:(NSData *)plainData Key:(NSString *)key;
23 | /**NSData DES解密*/
24 | + (NSData *)DESDecryptCipherData:(NSData*)cipherData Key:(NSString *)key;
25 | #pragma mark - 字符串的AES加密解密
26 |
27 | /**NSString AES加密*/
28 | + (NSString *)AES256EncryptPlainText:(NSString *)plainText Key:(NSString *)key;
29 | /**NSString AES解密*/
30 | + (NSString *)AES256DecryptCipherText:(NSString*)cipherText Key:(NSString *)key;
31 |
32 | #pragma mark - 字符串的DES加密解密
33 | /**字符串DES加密*/
34 | + (NSString *)DESEncryptPlainText:(NSString *)plainText key:(NSString *)key;
35 | /**字符串DES解密*/
36 | + (NSString *)DESDecryptCipherText:(NSString*)cipherText key:(NSString*)key;
37 |
38 | /**字符串DES加密用到Base64*/
39 | + (NSString *)DESEncryptBase64PlainText:(NSString *)plainText key:(NSString *)key;
40 | /**字符串DES解密用到Base64*/
41 | + (NSString *)DESDecryptBase64CipherText:(NSString*)cipherText key:(NSString*)key;
42 |
43 |
44 | /**
45 | * 字符串DES加密、解密 C#/iOS/Android通用DES加密解密方法,有base64
46 | *
47 | * @param content 需要加密解密内容
48 | * @param type 0 kCCEncrypt 加密,1 kCCDecrypt 解密
49 | * @param aKey 密钥
50 | *
51 | * @return 结果
52 | */
53 | +(NSString*)encryptWithContent:(NSString*)content type:(uint32_t)type key:(NSString*)aKey;
54 |
55 | /**
56 | * 字符串DES加密、解密
57 | *
58 | * @param sText 需要加密解密内容
59 | * @param encryptOperation 0 kCCEncrypt 加密,1 kCCDecrypt 解密
60 |
61 | * @param key 密钥
62 | *
63 | * @return 结果
64 | */
65 | + (NSString *)encrypt:(NSString *)sText encryptOrDecrypt:(uint32_t)encryptOperation key:(NSString *)key;
66 |
67 |
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFFileUtil/LFFileUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFFileUtil.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 16/2/1.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFFileUtil : NSObject
12 |
13 | /**获取Document文件路径*/
14 | + (NSString*)getDocumentFilePathWithName:(NSString*)name;
15 |
16 | /**获取Temp文件路径*/
17 | + (NSString*)getTempFilePathWithName:(NSString*)name;
18 |
19 | /**获取Home文件路径*/
20 | + (NSString*)getHomeFilePathWithName:(NSString*)name;
21 |
22 | /**获取Cache文件路径*/
23 | + (NSString*)getCacheFilePathWithName:(NSString*)name;
24 |
25 | /**创建目录(已判断是否存在,无脑用就行)*/
26 | + (BOOL)creatDirectory:(NSString *)path;
27 |
28 | /**删除目录或文件*/
29 | + (BOOL)deleteItemAtPath:(NSString *)path;
30 |
31 | /**移动文件*/
32 | + (BOOL)moveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error;
33 |
34 | /**拷贝文件*/
35 | + (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error;
36 |
37 | /** 磁盘剩余空间 */
38 | + (long long)freeDiskSpaceInBytes;
39 |
40 | /** 获取文件或者文件夹大小(单位:B) */
41 | + (unsigned long long)sizeAtPath:(NSString *)path;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFJsonUtil/LFJsonUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFJsonUtil.h
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 16/1/26.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 | //本类功能:各种json类型转dict或array
9 |
10 | #import
11 |
12 | @interface LFJsonUtil : NSObject
13 |
14 | /**json字符串转dict或array*/
15 | + (id)objectFromJSONString:(NSString *)string;
16 |
17 | /**json的NSData转dict或array*/
18 | + (id)objectFromJSONData:(NSData *)data;
19 |
20 | /**json的NSData转dict或array,带编码参数*/
21 | + (id)objectFromJSONData:(NSData *)data UsingEncoding:(NSStringEncoding)encoding;
22 |
23 | /**dict或arrayz转json */
24 | + (NSString *)jsonFromObject:(id)object;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFJsonUtil/LFJsonUtil.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFJsonUtil.m
3 | // BaseAPP
4 | //
5 | // Created by 张林峰 on 16/1/26.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import "LFJsonUtil.h"
10 |
11 | @implementation LFJsonUtil
12 |
13 | + (id)objectFromJSONString:(NSString *)string {
14 |
15 | id result = nil;
16 | result = [NSJSONSerialization JSONObjectWithData:[string dataUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)] options:0 error:nil];
17 | if (result == nil) {
18 | // 后台的JSON错了,尝试修正
19 | NSString *possibleJson = [self stringByHealJSONString:string];
20 | result = [NSJSONSerialization JSONObjectWithData:[possibleJson dataUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)] options:0 error:nil];
21 | }
22 | return result;
23 | }
24 |
25 | + (NSString *)stringByHealJSONString:(NSString *)string
26 | {
27 | NSMutableString *mStr = [[NSMutableString alloc]initWithCapacity:string.length];
28 | // 处理所有需要escape的字符
29 | for(int i=0; i< string.length; i++){
30 | unichar c = [string characterAtIndex:i];
31 | NSString *s = [NSString stringWithCharacters:&c length:1];
32 | switch (c) {
33 | case '\b':
34 | [mStr appendString:@"\\b"];
35 | break;
36 | case '\f':
37 | [mStr appendString:@"\\f"];
38 | break;
39 | case '\n':
40 | [mStr appendString:@"\\n"];
41 | break;
42 | case '\r':
43 | [mStr appendString:@"\\r"];
44 | break;
45 | case '\t':
46 | [mStr appendString:@"\\t"];
47 | break;
48 | case '\v':
49 | [mStr appendString:@"\\v"];
50 | break;
51 | default:
52 | [mStr appendString:s];
53 | break;
54 | }
55 | }
56 | return mStr;
57 | }
58 |
59 | + (id)objectFromJSONData:(NSData *)data {
60 | id result = nil;
61 | result = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
62 | if (result == nil) {
63 | //可能后台JSON有问题,尝试修复
64 | NSString *originalString = [[NSString alloc]initWithData:data encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)];
65 | result = [self objectFromJSONString:originalString];
66 | }
67 |
68 | return result;
69 | }
70 |
71 | + (id)objectFromJSONData:(NSData *)data UsingEncoding:(NSStringEncoding)encoding {
72 | NSString *jsonString = [[NSString alloc]initWithData:data encoding:encoding];
73 | NSData *transformedData = [jsonString dataUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)];
74 |
75 | return [self objectFromJSONData:transformedData];
76 | }
77 |
78 | /**dict或arrayz转json */
79 | + (NSString *)jsonFromObject:(id)object {
80 | NSError *error;
81 | NSData *data = [NSJSONSerialization dataWithJSONObject:object options:NSJSONWritingPrettyPrinted error:&error];
82 | if (!error) {
83 | NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
84 | return jsonString;
85 | }
86 | return @"";
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/LFKit/LFKit/Util/LFTimeUtil/LFTimeUtil.h:
--------------------------------------------------------------------------------
1 | //
2 | // LFTimeUtil.h
3 | // APPBaseSDK
4 | //
5 | // Created by 张林峰 on 16/5/31.
6 | // Copyright © 2016年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFTimeUtil : NSObject
12 |
13 | /**
14 | 秒数转为时长字符串
15 |
16 | @param second 秒数
17 | @param format 格式如@"HH:mm:ss" @"mm分ss秒"
18 | @return 时长字符串
19 | */
20 | + (NSString *)getTimeStringFromSecond:(NSInteger)second format:(NSString *)format;
21 |
22 | /**时间戳(毫秒)转时间字符串*/
23 | + (NSString *)getDateTimeStringFromTimestamp:(NSString *)timestamp formatter:(NSString *)formatter;
24 |
25 | /**Date转时间字符串*/
26 | + (NSString *)getDateTimeStringFromDate:(NSDate *)date formatter:(NSString *)formatter;
27 |
28 | /**时间字符串转时间戳(毫秒)*/
29 | + (NSString *)getTimestampFromDateTimeString:(NSString *)string formatter:(NSString *)formatter;
30 |
31 | /**时间字符串转NSDate*/
32 | + (NSDate *)getDateFromDateTimeString:(NSString *)string formatter:(NSString *)formatter;
33 |
34 | /**NSDate 转 时间戳(毫秒)*/
35 | + (NSString *)getTimestampStringFromDate:(NSDate *)date;
36 |
37 | /**获取当前时间戳 (以毫秒为单位)*/
38 | +(NSString *)getNowTimeTimestamp;
39 |
40 | /**时间戳(毫秒)转n小时、分钟、秒前 或者yyyy-MM-dd HH:mm:ss*/
41 | + (NSString *)getBeforeTimeFromDate:(NSString*)strDate;
42 |
43 | /** 时间戳根据格式返回数据 HH:mm、昨天 HH:mm、MM月dd日 HH:mm、yyyy年MM月dd日)*/
44 | + (NSString *)getVariableFormatDateStringFromTimestamp:(NSString *)timestamp;
45 |
46 | /**时间字符串转xx小时前、昨天HH:mm、前天HH:mm、MM月dd日、yyyy年MM月dd日*/
47 | + (NSString *)getShowTimeFromTimeStr:(NSString*)str;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LFKit/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2018/2/9.
6 | // Copyright © 2018年 张林峰. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 | #import
15 | extern DDLogLevel ddLogLevel;
16 |
17 | #define LFLOG_LEVEL1 (1 << 5)
18 | #define LFLOG_LEVEL2 (1 << 6)
19 | #define LFLog1(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 0), LFLOG_LEVEL1, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
20 | #define LFLog2(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 1), LFLOG_LEVEL2, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
21 |
22 |
23 | #define XXLOG_LEVEL1 (1 << 7)
24 | #define XXLOG_LEVEL2 (1 << 8)
25 | #define XXLog1(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 0), XXLOG_LEVEL1, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
26 | #define XXLog2(frmt, ...) LOG_MAYBE(YES, ddLogLevel, (1 << 1), XXLOG_LEVEL2, __PRETTY_FUNCTION__,frmt, ## __VA_ARGS__)
27 |
28 | #endif /* PrefixHeader_pch */
29 |
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_album_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_album_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_album_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_album_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_live_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_live_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_live_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_live_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_record_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_record_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_record_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_record_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_shoot_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_shoot_normal@2x.png
--------------------------------------------------------------------------------
/LFKit/Resource/icon_menu_shoot_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/icon_menu_shoot_normal@3x.png
--------------------------------------------------------------------------------
/LFKit/Resource/img_menu_frame_bg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/img_menu_frame_bg@2x.png
--------------------------------------------------------------------------------
/LFKit/Resource/img_menu_frame_bg@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/img_menu_frame_bg@3x.png
--------------------------------------------------------------------------------
/LFKit/Resource/star_gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/star_gray.png
--------------------------------------------------------------------------------
/LFKit/Resource/star_highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhanglinfeng/LFKit/d56f4d8e7a94c663664ef06f7ae39ceca71d94a5/LFKit/Resource/star_highlight.png
--------------------------------------------------------------------------------
/LFKit/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // LFKit
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/LFKitTests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LFKitTests/LFKitTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFKitTests.m
3 | // LFKitTests
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFKitTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LFKitTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LFKitUITests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LFKitUITests/LFKitUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LFKitUITests.m
3 | // LFKitUITests
4 | //
5 | // Created by 张林峰 on 2017/10/27.
6 | // Copyright © 2017年 张林峰. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LFKitUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LFKitUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // 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.
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 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 张林峰
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '8.0'
2 |
3 | target 'LFKit' do
4 | pod 'YYWebImage'
5 | pod 'FMDB'
6 | pod 'CocoaLumberjack'
7 | pod 'MBProgressHUD'
8 | pod 'Masonry'
9 | pod 'LFKit', :path=> "./"
10 | end
11 |
--------------------------------------------------------------------------------