├── .gitignore
├── 500px.cer
├── Book_Reader.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── xcshareddata
│ └── xcschemes
│ │ └── Book_Reader.xcscheme
└── xcuserdata
│ ├── hhuua.xcuserdatad
│ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── huangye.xcuserdatad
│ └── xcschemes
│ ├── Book_Reader.xcscheme
│ └── xcschememanagement.plist
├── Book_Reader.xcworkspace
├── contents.xcworkspacedata
├── xcshareddata
│ └── IDEWorkspaceChecks.plist
└── xcuserdata
│ ├── hhuua.xcuserdatad
│ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ └── huangye.xcuserdatad
│ ├── IDEFindNavigatorScopes.plist
│ └── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
├── Book_Reader
├── Base.lproj
│ └── LaunchScreen.storyboard
├── Expand
│ ├── Category
│ │ ├── MBProgressHUD+NJ.h
│ │ ├── MBProgressHUD+NJ.m
│ │ ├── MBProgressHUD.bundle
│ │ │ ├── error.png
│ │ │ ├── error@2x.png
│ │ │ ├── success.png
│ │ │ └── success@2x.png
│ │ ├── NSDate+Utils.h
│ │ ├── NSDate+Utils.m
│ │ ├── NSError+HYError.h
│ │ ├── NSError+HYError.m
│ │ ├── NSString+size.h
│ │ ├── NSString+size.m
│ │ ├── UIButton+TouchAreaInsets.h
│ │ ├── UIButton+TouchAreaInsets.m
│ │ ├── UIColor+random.h
│ │ ├── UIColor+random.m
│ │ ├── UIImage+Color.h
│ │ ├── UIImage+Color.m
│ │ ├── UIView+HYView.h
│ │ ├── UIView+HYView.m
│ │ ├── UIView+Screenshot.h
│ │ └── UIView+Screenshot.m
│ ├── GCDMulticastDelegate
│ │ ├── GCDMulticastDelegate.h
│ │ └── GCDMulticastDelegate.m
│ ├── HYEmptyView
│ │ ├── HYEmptyView.h
│ │ ├── HYEmptyView.m
│ │ ├── HYEmptyViewImage.bundle
│ │ │ ├── empty_buliding.png
│ │ │ ├── empty_error.png
│ │ │ ├── empty_info.png
│ │ │ └── empty_noData.png
│ │ ├── UIView+HYEmptyView.h
│ │ └── UIView+HYEmptyView.m
│ ├── HYNetReachability
│ │ ├── HYNetReachability.h
│ │ ├── HYNetReachability.m
│ │ └── TWNetReachability.h
│ ├── HYPresentAnimation
│ │ ├── HYDismissPopAnimation.h
│ │ ├── HYDismissPopAnimation.m
│ │ ├── HYPresentPushAnimation.h
│ │ ├── HYPresentPushAnimation.m
│ │ ├── HYSwipeInteractiveTransition.h
│ │ └── HYSwipeInteractiveTransition.m
│ └── Macros
│ │ ├── HYHigherOrderFunc.h
│ │ ├── HYMacros.h
│ │ ├── HYNotificationMacros.h
│ │ └── HYRegulaStrMacro.h
├── HYAppDelegate.h
├── HYAppDelegate.m
├── Info.plist
├── Main
│ ├── Base
│ │ └── BaseController
│ │ │ ├── HYBaseViewController.h
│ │ │ └── HYBaseViewController.m
│ ├── Model
│ │ ├── BookAPIModel
│ │ │ ├── BookAPIBaseModel.h
│ │ │ ├── BookAPIBaseModel.m
│ │ │ ├── BookChapterModel.h
│ │ │ ├── BookChapterModel.m
│ │ │ ├── BookChapterTextModel.h
│ │ │ ├── BookChapterTextModel.m
│ │ │ ├── BookInfoModel.h
│ │ │ ├── BookInfoModel.m
│ │ │ ├── BookRecordModel.h
│ │ │ ├── BookRecordModel.m
│ │ │ ├── BookSaveInfoModel.h
│ │ │ ├── BookSaveInfoModel.m
│ │ │ ├── BooksourceModel.h
│ │ │ └── BooksourceModel.m
│ │ ├── BookReadContentModel.h
│ │ ├── BookReadContentModel.m
│ │ └── UnsplashImageModel
│ │ │ ├── UnsplashImageModel.h
│ │ │ └── UnsplashImageModel.m
│ ├── Public
│ │ ├── BookAPIs
│ │ │ ├── HYBookAPIs.h
│ │ │ └── HYBookAPIs.m
│ │ ├── Database
│ │ │ ├── HYDatabase.h
│ │ │ ├── HYDatabase.m
│ │ │ ├── HYDatabaseMacros.h
│ │ │ └── Model_Catepory
│ │ │ │ ├── BookChapterModel+database.h
│ │ │ │ ├── BookChapterModel+database.m
│ │ │ │ ├── BookChapterTextModel+database.h
│ │ │ │ ├── BookChapterTextModel+database.m
│ │ │ │ ├── BookInfoModel+database.h
│ │ │ │ ├── BookInfoModel+database.m
│ │ │ │ ├── BookRecordModel+database.h
│ │ │ │ ├── BookRecordModel+database.m
│ │ │ │ ├── BookSaveInfoModel+database.h
│ │ │ │ └── BookSaveInfoModel+database.m
│ │ ├── HYHTTPSessionManager
│ │ │ ├── HYHTTPSessionManager.h
│ │ │ └── HYHTTPSessionManager.m
│ │ ├── UnsplashAPI
│ │ │ ├── UnsplashAPI.h
│ │ │ └── UnsplashAPI.m
│ │ └── UserDefaults
│ │ │ ├── GVUserDefaults+HYUserDefaults.h
│ │ │ └── GVUserDefaults+HYUserDefaults.m
│ ├── View
│ │ ├── BookListView
│ │ │ ├── BookInfoCell.h
│ │ │ ├── BookInfoCell.m
│ │ │ └── BookInfoCell.xib
│ │ ├── BookReadView
│ │ │ ├── BarButtonView.h
│ │ │ ├── BarButtonView.m
│ │ │ ├── BookChapterView.h
│ │ │ ├── BookChapterView.m
│ │ │ ├── BookReadTextView.h
│ │ │ ├── BookReadTextView.m
│ │ │ ├── BookSetingView.h
│ │ │ └── BookSetingView.m
│ │ ├── BookSearchView
│ │ │ ├── BookSearchHotView.h
│ │ │ └── BookSearchHotView.m
│ │ ├── MainBookListView
│ │ │ ├── MainBookInfoCell.h
│ │ │ ├── MainBookInfoCell.m
│ │ │ ├── MainBookInfoCell.xib
│ │ │ ├── MainBookRightCell.h
│ │ │ ├── MainBookRightCell.m
│ │ │ └── MainBookRightCell.xib
│ │ └── UnsplashImageView
│ │ │ ├── Layout
│ │ │ ├── HYFlowLayout.h
│ │ │ └── HYFlowLayout.m
│ │ │ ├── UnsplashImageCell.h
│ │ │ ├── UnsplashImageCell.m
│ │ │ └── UnsplashImageCell.xib
│ ├── ViewController
│ │ ├── BookInfoVC
│ │ │ ├── BookInfoVC.h
│ │ │ ├── BookInfoVC.m
│ │ │ └── BookInfoVC.xib
│ │ ├── BookReadVC
│ │ │ ├── BookReadContentVC.h
│ │ │ ├── BookReadContentVC.m
│ │ │ ├── BookReadVC.h
│ │ │ ├── BookReadVC.m
│ │ │ └── PageVC
│ │ │ │ ├── BookPageVC.h
│ │ │ │ └── BookPageVC.m
│ │ ├── BookSearchListVC
│ │ │ ├── BookSearchListVC.h
│ │ │ └── BookSearchListVC.m
│ │ ├── BookSearchVC
│ │ │ ├── BookSearchVC.h
│ │ │ └── BookSearchVC.m
│ │ ├── BookSortVC
│ │ │ ├── BookSortVC.h
│ │ │ └── BookSortVC.m
│ │ ├── BookSourceListVC
│ │ │ ├── BookSourceListVC.h
│ │ │ └── BookSourceListVC.m
│ │ ├── MainBookListVC
│ │ │ ├── MainBookListVC.h
│ │ │ ├── MainBookListVC.m
│ │ │ ├── MainBookRightVC.h
│ │ │ └── MainBookRightVC.m
│ │ ├── UnsplashImageVC
│ │ │ ├── UnsplashImageVC.h
│ │ │ └── UnsplashImageVC.m
│ │ └── UnsplashSearchVC
│ │ │ ├── UnsplashSearchVC.h
│ │ │ └── UnsplashSearchVC.m
│ └── ViewModel
│ │ └── BookReadVM
│ │ ├── BookReadAPIVM
│ │ ├── BookReadAPIVM.h
│ │ └── BookReadAPIVM.m
│ │ ├── BookReadLocalVM
│ │ ├── BookReadLocalVM.h
│ │ └── BookReadLocalVM.m
│ │ └── BookReadVMDelegate.h
├── Resource
│ ├── image
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-60.png
│ │ │ │ ├── Icon-60@3x.png
│ │ │ │ ├── Icon-Small@2x.png
│ │ │ │ ├── Icon-Small@3x.png
│ │ │ │ ├── Icon-Spotlight-40.png
│ │ │ │ ├── Icon-Spotlight-40@2x.png
│ │ │ │ ├── Icon-Spotlight-40@3x-1.png
│ │ │ │ ├── Icon-Spotlight-40@3x.png
│ │ │ │ └── icon_1024.png
│ │ │ └── Contents.json
│ │ └── images.xcassets
│ │ │ ├── BookReadVC
│ │ │ ├── Contents.json
│ │ │ ├── mulu_ascending.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── mulu_ascending.png
│ │ │ ├── mulu_descending.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── mulu_descending.png
│ │ │ ├── setting_color_select.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── setting_color_select.png
│ │ │ ├── setting_sun_l.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── setting_sun_l.png
│ │ │ ├── setting_sun_s.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── setting_sun_s.png
│ │ │ ├── space_1.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── space_1.png
│ │ │ ├── space_2.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── space_2.png
│ │ │ ├── space_3.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── space_3.png
│ │ │ ├── toolbar_caching.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_caching.png
│ │ │ ├── toolbar_day.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_day.png
│ │ │ ├── toolbar_feedback.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_feedback.png
│ │ │ ├── toolbar_mulu.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_mulu.png
│ │ │ ├── toolbar_night.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_night.png
│ │ │ └── toolbar_setting.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── toolbar_setting.png
│ │ │ ├── Contents.json
│ │ │ ├── MainVC
│ │ │ ├── Contents.json
│ │ │ ├── main_fenlei.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_fenlei.png
│ │ │ ├── main_paihang.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_paihang.png
│ │ │ ├── main_random.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_random.png
│ │ │ ├── main_search.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_search.png
│ │ │ ├── main_showright.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_showright.png
│ │ │ └── main_unsplash .imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── main_unsplash .png
│ │ │ ├── Navi
│ │ │ ├── Contents.json
│ │ │ ├── HomeView_navi_back.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── HomeView_navi_back.png
│ │ │ ├── Navi_backImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── back.png
│ │ │ ├── Navi_backImage_black.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── Navi_backImage_black.png
│ │ │ ├── Navi_backImage_blue.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── Navi_backImage_blue.png
│ │ │ ├── Navi_backImage_white.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── navi_back_white.png
│ │ │ ├── grade_line.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── grade_line.png
│ │ │ ├── navi_backbtnImage_white.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── navi_backImage_white.png
│ │ │ └── navi_head.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── navi_head@2x.png
│ │ │ │ └── navi_head@3x.png
│ │ │ └── SearchVC
│ │ │ ├── Contents.json
│ │ │ ├── author.imageset
│ │ │ ├── Contents.json
│ │ │ └── author.png
│ │ │ ├── book.imageset
│ │ │ ├── Contents.json
│ │ │ └── book.png
│ │ │ ├── delete.imageset
│ │ │ ├── Contents.json
│ │ │ └── delete.png
│ │ │ ├── placeholder_empty.imageset
│ │ │ ├── Contents.json
│ │ │ └── placeholder_empty.jpg
│ │ │ └── placeholder_loding.imageset
│ │ │ ├── Contents.json
│ │ │ └── placeholder_loding.png
│ └── public
│ │ └── PrefixHeader.pch
├── Vender
│ ├── GVUserDefaults
│ │ ├── GVUserDefaults.h
│ │ └── GVUserDefaults.m
│ ├── MBProgressHUD
│ │ ├── MBProgressHUD.h
│ │ └── MBProgressHUD.m
│ └── UIPlaceHolderTextView
│ │ ├── UIPlaceHolderTextView.h
│ │ └── UIPlaceHolderTextView.m
└── main.m
├── Podfile
├── Podfile.lock
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | pods
2 | .DS_Store
3 | 项目资料
4 | .git
5 |
--------------------------------------------------------------------------------
/500px.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/500px.cer
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/xcshareddata/xcschemes/Book_Reader.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
69 |
70 |
71 |
72 |
76 |
77 |
78 |
79 |
85 |
87 |
93 |
94 |
95 |
96 |
98 |
99 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/xcuserdata/hhuua.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Book_Reader.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 522205A220E0757D00210706
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/xcuserdata/huangye.xcuserdatad/xcschemes/Book_Reader.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
69 |
70 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/Book_Reader.xcodeproj/xcuserdata/huangye.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Book_Reader.xcscheme
8 |
9 | orderHint
10 | 7
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 522205A220E0757D00210706
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Book_Reader.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Book_Reader.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Book_Reader.xcworkspace/xcuserdata/hhuua.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Book_Reader.xcworkspace/xcuserdata/huangye.xcuserdatad/IDEFindNavigatorScopes.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Book_Reader.xcworkspace/xcuserdata/huangye.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Book_Reader/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 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/MBProgressHUD+NJ.h:
--------------------------------------------------------------------------------
1 | //
2 | // MBProgressHUD+NJ.h
3 | // NJWisdomCard
4 | //
5 | // Created by apple on 15/8/25.
6 | // Copyright (c) 2015年 Weconex. All rights reserved.
7 | //
8 |
9 | #import "MBProgressHUD.h"
10 |
11 | @interface UIView (MBP)
12 |
13 | @property (strong, nonatomic) dispatch_source_t show_mbp_t;
14 |
15 | @end
16 |
17 | @interface MBProgressHUD (NJ)
18 |
19 | + (void)showSuccess:(NSString *)success;
20 | + (void)showSuccess:(NSString *)success toView:(UIView *)view;
21 |
22 | + (void)showError:(NSString *)error;
23 | + (void)showError:(NSString *)error toView:(UIView *)view;
24 |
25 | + (MBProgressHUD *)showMessage:(NSString *)message;
26 | + (void)showMessage:(NSString *)message delay:(NSTimeInterval)time;
27 | + (MBProgressHUD *)showMessage:(NSString *)message toView:(UIView *)view;
28 | + (void)showMessage:(NSString *)message toView:(UIView *)view delay:(NSTimeInterval)time;
29 | + (MBProgressHUD *)showMessage:(NSString *)message toView:(UIView *)view hideAfter:(float)hideTime;
30 |
31 | + (void)hideHUD;
32 | + (void)hideHUDForView:(UIView *)view;
33 |
34 | //显示一个GIF图片数组
35 | + (void)showImages:(UIImage*)images message:(NSString*)message toView:(UIView *)view;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/MBProgressHUD.bundle/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/Category/MBProgressHUD.bundle/error.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/MBProgressHUD.bundle/error@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/Category/MBProgressHUD.bundle/error@2x.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/MBProgressHUD.bundle/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/Category/MBProgressHUD.bundle/success.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/MBProgressHUD.bundle/success@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/Category/MBProgressHUD.bundle/success@2x.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/NSDate+Utils.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+Utils.h
3 | //
4 | // Created by hhuua on 2016/12/30.
5 | // Copyright © 2016年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | #define D_MINUTE 60
11 | #define D_HOUR 3600
12 | #define D_DAY 86400
13 | #define D_WEEK 604800
14 | #define D_YEAR 31556926
15 |
16 | @interface NSDate (Utils)
17 |
18 | + (NSCalendar *) currentCalendar;
19 |
20 | // 计算时间间隔
21 | + (double)secondsFromDate:(NSDate*)dateFrom toDate:(NSDate*)dateTo; // 两个时间之间的秒数
22 | + (double)secondsToNowFromDate:(NSDate*)dateFrom; // 某个时间到现在的秒数
23 |
24 | // 返回时间字符串
25 | //标准时间格式->yyyy-MM-dd HH:mm:ss 格式
26 | + (NSString*)formatDateyyyyMMddHHmmss:(NSDate*)date;
27 | + (NSString*)formatDateyyyyMMddHHmm:(NSDate*)date;
28 | + (NSString*)formatDateMMddHHmmss:(NSDate*)date;
29 | + (NSString*)formatDateMMddHHmm:(NSDate*)date;
30 | + (NSString*)formatDateyyyyMMdd:(NSDate*)date;
31 | + (NSString*)formatDateHHmm:(NSDate*)date;
32 |
33 | //字符串时间格式->yyyyMMddHHmmss 格式
34 | + (NSString*)strDateyyyyMMddHHmmss:(NSDate*)date;
35 | + (NSString*)strDateyyyyMMddHHmm:(NSDate*)date;
36 | + (NSString*)strDateMMddHHmm:(NSDate*)date;
37 | + (NSString*)strDateyyyyMMdd:(NSDate*)date;
38 | + (NSString*)strMMddHHmmss:(NSDate*)date;
39 | + (NSString*)stryyyyMMddHHmmssSSS:(NSDate*)date;
40 | + (NSString*)strHHmm:(NSDate*)date;
41 | + (NSString*)stryyyy:(NSDate*)date;
42 | + (NSString*)stryyyyMM:(NSDate*)date;
43 |
44 | //字符串转时间
45 | + (NSDate*)dateWithStryyyyMMdd:(NSString*)str;
46 | + (NSDate*)dateWithStr:(NSString*)str dateFormat:(NSString*)format;
47 | + (NSDate*)dateWithStryyyyMMddHHmmss:(NSString*)str;
48 | + (NSDate*)dateWithStryyyyMMddHHmmssSSS:(NSString*)str;
49 | + (NSDate*)dateWithStrHHmmss:(NSString*)str;
50 | + (NSDate*)dateWithFormatStryyyyMMddHHmmss:(NSString*)str;
51 | + (NSDate*)dateWithFormatStrHHmm:(NSString*)str;
52 | + (NSDate*)dateWithFormatStryyyyMMdd:(NSString*)str;
53 | + (NSDate*)dateWithStrDayyyyyMMddHHmmss:(NSString*)str;
54 |
55 | //特殊字符串截取
56 | + (NSString*)dateWithSubStryyyyMMddHHmmss:(NSString*)str;
57 | + (NSString*)dateWithSubStr:(NSString*)str;
58 |
59 | //获取描述性字符串,例如:(刚刚,2分钟前等)
60 | + (NSString*)getDescriptionWith:(NSDate*)date;
61 | + (NSString*)DescriptionyyyyMMddHHmmWith:(NSDate*)date;
62 | + (NSString*)DescriptionMMddHHmmWith:(NSDate*)date;
63 |
64 | //返回特殊的时间格式
65 | // x月x日 星期几
66 | + (NSString*)formatDateMMddEEEE:(NSDate*)date;
67 | // x月x日
68 | + (NSString*)formatDateMMdd:(NSDate*)date;
69 |
70 | //获取月初与月末的时间(yyyyMMddHHmmss)
71 | + (NSString*)getEarlyMonthDateStr;
72 | + (NSString*)getEndOfTheMonthDateStr;
73 |
74 | // UTC
75 | + (NSString *)getUTCFormateLocalDate:(NSDate *)localDate;
76 |
77 |
78 | //获取特定时间
79 | + (NSDate*)beginDateOfToday; //获取今天凌晨0点整的时间
80 | + (NSDate*)beginDateBeforeDays:(NSInteger)days; //获取days天之前的凌晨0点整的时间
81 | + (NSDate*)dateWithDaysBeforeNow:(NSInteger)days; //获取days天之前的现在时刻的时间
82 |
83 | //属性
84 | @property (readonly) NSInteger nearestHour;
85 | @property (readonly) NSInteger hour;
86 | @property (readonly) NSInteger minute;
87 | @property (readonly) NSInteger seconds;
88 | @property (readonly) NSInteger day;
89 | @property (readonly) NSInteger month;
90 | @property (readonly) NSInteger week;
91 | @property (readonly) NSInteger weekday;
92 | @property (readonly) NSInteger year;
93 |
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/NSError+HYError.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+HYError.h
3 | //
4 | // Created by hhuua on 2018/3/22.
5 | // Copyright © 2018年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface NSError (HYError)
11 |
12 | + (instancetype)errorWithCode:(NSInteger)code Description:(NSString*)description;
13 | + (instancetype)errorWithDescription:(NSString*)description;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/NSError+HYError.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+HYError.m
3 | //
4 | // Created by hhuua on 2018/3/22.
5 | // Copyright © 2018年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "NSError+HYError.h"
9 |
10 | @implementation NSError (HYError)
11 |
12 | + (instancetype)errorWithDescription:(NSString*)description
13 | {
14 | return [self errorWithCode:9999 Description:description];
15 | }
16 |
17 | + (instancetype)errorWithCode:(NSInteger)code Description:(NSString*)description
18 | {
19 | NSError* err = [[NSError alloc]
20 | initWithDomain:NSCocoaErrorDomain
21 | code:code
22 | userInfo:@{
23 | NSLocalizedDescriptionKey : description,
24 | }];
25 | return err;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/NSString+size.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+size.h
3 | //
4 | // Created by hhuua on 2017/6/25.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface NSString (size)
11 |
12 | /**
13 | * 分页
14 | * 给定size的大小和字符属性,计算需要几页才能显示,并返回分页后的数组。
15 | */
16 | + (NSArray*)pagingWithAttStr:(NSAttributedString*)str Size:(CGSize)size;
17 |
18 | + (NSArray*)pagingWith:(NSString*)text Size:(CGSize)size;
19 |
20 | - (CGFloat)getAttributedStringHeightWithText:(NSAttributedString *)attributedString andWidth:(CGFloat)width andFont:(UIFont *)font;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/NSString+size.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+size.m
3 | //
4 | // Created by hhuua on 2017/6/25.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "NSString+size.h"
9 | #import
10 |
11 | @implementation NSString (size)
12 |
13 | + (NSArray*)pagingWith:(NSString*)text Size:(CGSize)size
14 | {
15 | if (kDictIsEmpty(HYUserDefault.userReadAttConfig)){
16 | NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
17 | paragraphStyle.lineSpacing = 8.0f;
18 | NSDictionary* dic = @{
19 | NSFontAttributeName: [UIFont systemFontOfSize:15],
20 | NSForegroundColorAttributeName: UIHexColor(0x311b0e),
21 | NSKernAttributeName: @(0),
22 | NSParagraphStyleAttributeName: paragraphStyle,
23 | };
24 | HYUserDefault.userReadAttConfig = dic;
25 | }
26 | NSAttributedString* att = [[NSAttributedString alloc] initWithString:text attributes:HYUserDefault.userReadAttConfig];
27 | return [self pagingWithAttStr:att Size:size];
28 | }
29 |
30 | + (NSArray*)pagingWithAttStr:(NSAttributedString*)str Size:(CGSize)size
31 | {
32 | CFAttributedStringRef cfAttStr = (__bridge CFAttributedStringRef)str;
33 | CTFramesetterRef setterRef = CTFramesetterCreateWithAttributedString(cfAttStr);
34 |
35 | NSMutableArray* array = [NSMutableArray array];
36 | int nowLenght = 0;
37 |
38 | while (nowLenght
27 |
28 | @interface UIButton (JLUtils)
29 | /**
30 | * @brief 设置按钮额外热区
31 | */
32 | @property (nonatomic, assign) UIEdgeInsets touchAreaInsets;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIButton+TouchAreaInsets.m:
--------------------------------------------------------------------------------
1 | //
2 | // The MIT License (MIT)
3 | //
4 | // Copyright (c) 2014 Suyeol Jeon (xoul.kr)
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all
14 | // copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | // SOFTWARE.
23 | //
24 |
25 | #import
26 | #import "UIButton+TouchAreaInsets.h"
27 |
28 | @implementation UIButton (JLUtils)
29 |
30 | - (UIEdgeInsets)touchAreaInsets
31 | {
32 | return [objc_getAssociatedObject(self, @selector(touchAreaInsets)) UIEdgeInsetsValue];
33 | }
34 | /**
35 | * @brief 设置按钮额外热区
36 | */
37 | - (void)setTouchAreaInsets:(UIEdgeInsets)touchAreaInsets
38 | {
39 | NSValue *value = [NSValue valueWithUIEdgeInsets:touchAreaInsets];
40 | objc_setAssociatedObject(self, @selector(touchAreaInsets), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
41 | }
42 |
43 | - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
44 | {
45 | UIEdgeInsets touchAreaInsets = self.touchAreaInsets;
46 | CGRect bounds = self.bounds;
47 | bounds = CGRectMake(bounds.origin.x - touchAreaInsets.left,
48 | bounds.origin.y - touchAreaInsets.top,
49 | bounds.size.width + touchAreaInsets.left + touchAreaInsets.right,
50 | bounds.size.height + touchAreaInsets.top + touchAreaInsets.bottom);
51 | return CGRectContainsPoint(bounds, point);
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIColor+random.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+random.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIColor (random)
12 |
13 | + (UIColor *)randomColor;
14 | + (UIColor *)randomLightColor;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIColor+random.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+random.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "UIColor+random.h"
10 |
11 | @implementation UIColor (random)
12 |
13 | + (UIColor *)randomColor
14 | {
15 | CGFloat hue = ( arc4random() % 256 / 256.0 );
16 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5;
17 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5;
18 |
19 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
20 | }
21 |
22 | + (UIColor *)randomLightColor
23 | {
24 | CGFloat hue = ( arc4random() % 256 / 256.0 );
25 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5;
26 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5;
27 |
28 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:0.2];
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIImage+Color.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+Color.h
3 | // iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
4 | //
5 | // Created by Jakey on 14/12/15.
6 | // Copyright (c) 2014年 www.skyfox.org. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (Color)
12 | /**
13 | * @brief 根据颜色生成纯色图片
14 | *
15 | * @param color 颜色
16 | *
17 | * @return 纯色图片
18 | */
19 | + (UIImage *)imageWithColor:(UIColor *)color;
20 | /**
21 | * @brief 取图片某一点的颜色
22 | *
23 | * @param point 某一点
24 | *
25 | * @return 颜色
26 | */
27 | - (UIColor *)colorAtPoint:(CGPoint )point;
28 | //more accurate method ,colorAtPixel 1x1 pixel
29 | /**
30 | * @brief 取某一像素的颜色
31 | *
32 | * @param point 一像素
33 | *
34 | * @return 颜色
35 | */
36 | - (UIColor *)colorAtPixel:(CGPoint)point;
37 | /**
38 | * @brief 返回该图片是否有透明度通道
39 | *
40 | * @return 是否有透明度通道
41 | */
42 | - (BOOL)hasAlphaChannel;
43 |
44 | /**
45 | * @brief 获得灰度图
46 | *
47 | * @param sourceImage 图片
48 | *
49 | * @return 获得灰度图片
50 | */
51 | + (UIImage*)covertToGrayImageFromImage:(UIImage*)sourceImage;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIView+HYView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+HYView.h
3 | // HYColor
4 | //
5 | // Created by hhuua on 2016/12/8.
6 | // Copyright © 2016年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (HYView)
12 |
13 | - (void)removeAllSubviews;//移除所有的子视图
14 | @property (nonatomic, readonly) UIViewController *viewController;//拿到View的Controller
15 |
16 | //拿到或设置View的frame与相关的各个信息
17 | @property (nonatomic) CGFloat left;
18 | @property (nonatomic) CGFloat top;
19 | @property (nonatomic) CGFloat right;
20 | @property (nonatomic) CGFloat bottom;
21 |
22 | @property (nonatomic) CGFloat width;
23 | @property (nonatomic) CGFloat height;
24 |
25 | @property (nonatomic) CGFloat centerX;
26 | @property (nonatomic) CGFloat centerY;
27 |
28 | @property (nonatomic) CGPoint origin;
29 | @property (nonatomic) CGSize size;
30 |
31 |
32 | /** 设置圆角 */
33 | - (void)rounded:(CGFloat)cornerRadius;
34 |
35 | /** 设置圆角和边框 */
36 | - (void)rounded:(CGFloat)cornerRadius width:(CGFloat)borderWidth color:(UIColor *)borderColor;
37 |
38 | /** 设置边框 */
39 | - (void)border:(CGFloat)borderWidth color:(UIColor *)borderColor;
40 |
41 | /** 给哪几个角设置圆角 */
42 | -(void)round:(CGFloat)cornerRadius RectCorners:(UIRectCorner)rectCorner;
43 |
44 | /** 设置阴影 */
45 | -(void)shadow:(UIColor *)shadowColor opacity:(CGFloat)opacity radius:(CGFloat)radius offset:(CGSize)offset;
46 |
47 | @end
48 |
49 | #ifndef kSystemValue
50 | #define kSystemValue [UIDevice currentDevice].systemVersion.floatValue
51 |
52 | #define kiOS7Later (kSystemValue >= 7.0f)
53 | #define kiOS8Later (kSystemValue >= 8.0f)
54 | #define kiOS9Later (kSystemValue >= 9.0f)
55 | #define kiOS9_1Later (kSystemValue >= 9.1f)
56 | #define kios10Later (kSystemValue >= 10.0f)
57 | #define kios8toios10 (kSystemValue >= 8.0f && kSystemValue < 10.0f)
58 |
59 | #endif
60 |
61 | /// 屏幕宽度
62 | #ifndef kScreenWidth
63 | #define kScreenWidth [UIScreen mainScreen].bounds.size.width
64 | #endif
65 |
66 | /// 屏幕高度
67 | #ifndef kScreenHeight
68 | #define kScreenHeight [UIScreen mainScreen].bounds.size.height
69 | #endif
70 |
71 | /// 屏幕大小
72 | #ifndef kScreenSize
73 | #define kScreenSize [UIScreen mainScreen].bounds.size
74 | #endif
75 |
76 | ///屏幕bounds
77 | #ifndef kScreenBounds
78 | #define kScreenBounds [UIScreen mainScreen].bounds
79 | #endif
80 |
81 | /// 屏幕Scale
82 | #ifndef kScreenScale
83 | #define kScreenScale [UIScreen mainScreen].scale
84 | #endif
85 |
86 | #ifndef UIHexColor
87 | #define UIHexColor(_hex_) [UIColor colorWithHexString:((__bridge NSString *)CFSTR(#_hex_))]
88 | #endif
89 |
90 |
91 |
92 | @interface UIColor (HYcolor)
93 | + (UIColor *)colorWithHexString:(NSString *)hexStr;
94 | - (UIColor *)colorByAddColor:(UIColor *)add blendMode:(CGBlendMode)blendMode;
95 |
96 |
97 | @end
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIView+Screenshot.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Screenshot.h
3 | // iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
4 | //
5 | // Created by Jakey on 15/1/10.
6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (Screenshot)
12 | /**
13 | * @brief view截图
14 | *
15 | * @return 截图
16 | */
17 | - (UIImage *)screenshot;
18 |
19 | /**
20 | * @author Jakey
21 | *
22 | * @brief 截图一个view中所有视图 包括旋转缩放效果
23 | *
24 | * @param maxWidth 限制缩放的最大宽度 保持默认传0
25 | *
26 | * @return 截图
27 | */
28 | - (UIImage *)screenshot:(CGFloat)maxWidth;
29 | @end
30 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Category/UIView+Screenshot.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Screenshot.m
3 | // iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
4 | //
5 | // Created by Jakey on 15/1/10.
6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved.
7 | //
8 |
9 | #import "UIView+Screenshot.h"
10 | #import
11 | @implementation UIView (Screenshot)
12 | /**
13 | * @brief view截图
14 | *
15 | * @return 截图
16 | */
17 | - (UIImage *)screenshot {
18 |
19 | UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, [UIScreen mainScreen].scale);
20 | if( [self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)])
21 | {
22 | [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];
23 | }
24 | else
25 | {
26 | [self.layer renderInContext:UIGraphicsGetCurrentContext()];
27 | }
28 |
29 | UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
30 | UIGraphicsEndImageContext();
31 |
32 | return screenshot;
33 | }
34 | /**
35 | * @author Jakey
36 | *
37 | * @brief 截图一个view中所有视图 包括旋转缩放效果
38 | *
39 | * @param maxWidth 限制缩放的最大宽度 保持默认传0
40 | *
41 | * @return 截图
42 | */
43 | - (UIImage *)screenshot:(CGFloat)maxWidth{
44 | CGAffineTransform oldTransform = self.transform;
45 | CGAffineTransform scaleTransform = CGAffineTransformIdentity;
46 |
47 | // if (!isnan(scale)) {
48 | // CGAffineTransform transformScale = CGAffineTransformMakeScale(scale, scale);
49 | // scaleTransform = CGAffineTransformConcat(oldTransform, transformScale);
50 | // }
51 | if (!isnan(maxWidth) && maxWidth>0) {
52 | CGFloat maxScale = maxWidth/CGRectGetWidth(self.frame);
53 | CGAffineTransform transformScale = CGAffineTransformMakeScale(maxScale, maxScale);
54 | scaleTransform = CGAffineTransformConcat(oldTransform, transformScale);
55 |
56 | }
57 | if(!CGAffineTransformEqualToTransform(scaleTransform, CGAffineTransformIdentity)){
58 | self.transform = scaleTransform;
59 | }
60 |
61 | CGRect actureFrame = self.frame; //已经变换过后的frame
62 | CGRect actureBounds= self.bounds;//CGRectApplyAffineTransform();
63 |
64 | //begin
65 | UIGraphicsBeginImageContextWithOptions(actureFrame.size, NO, 0.0);
66 | CGContextRef context = UIGraphicsGetCurrentContext();
67 | CGContextSaveGState(context);
68 | // CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1, -1);
69 | CGContextTranslateCTM(context,actureFrame.size.width/2, actureFrame.size.height/2);
70 | CGContextConcatCTM(context, self.transform);
71 | CGPoint anchorPoint = self.layer.anchorPoint;
72 | CGContextTranslateCTM(context,
73 | -actureBounds.size.width * anchorPoint.x,
74 | -actureBounds.size.height * anchorPoint.y);
75 | if([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)])
76 | {
77 | [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];
78 | }
79 | else
80 | {
81 | [self.layer renderInContext:UIGraphicsGetCurrentContext()];
82 | }
83 | UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
84 | UIGraphicsEndImageContext();
85 | //end
86 | self.transform = oldTransform;
87 |
88 | return screenshot;
89 | }
90 | @end
91 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/GCDMulticastDelegate/GCDMulticastDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class GCDMulticastDelegateEnumerator;
4 |
5 | @interface GCDMulticastDelegate : NSObject
6 |
7 | - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
8 | - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
9 | - (void)removeDelegate:(id)delegate;
10 |
11 | - (void)removeAllDelegates;
12 |
13 | - (NSUInteger)count;
14 | - (NSUInteger)countOfClass:(Class)aClass;
15 | - (NSUInteger)countForSelector:(SEL)aSelector;
16 |
17 | - (BOOL)hasDelegateThatRespondsToSelector:(SEL)aSelector;
18 |
19 | - (GCDMulticastDelegateEnumerator *)delegateEnumerator;
20 |
21 | @end
22 |
23 |
24 | @interface GCDMulticastDelegateEnumerator : NSObject
25 |
26 | - (NSUInteger)count;
27 | - (NSUInteger)countOfClass:(Class)aClass;
28 | - (NSUInteger)countForSelector:(SEL)aSelector;
29 |
30 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr;
31 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr ofClass:(Class)aClass;
32 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr forSelector:(SEL)aSelector;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/HYEmptyView.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYEmptyView.h
3 | //
4 | // Created by hhuua on 2017/6/19.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 | #import "HYNetReachability.h"
10 |
11 | #define WeakSelf(weakSelf) __weak __typeof(&*self) weakSelf = self;
12 | #define StrongSelf(strongSelf) __strong __typeof(&*self) strongSelf = weakSelf;
13 |
14 | typedef void(^netStatusChange)(HYNetReachability* reachability,HYNetReachabilityStatus status);
15 | typedef void(^refreshBtnClick)(void);
16 |
17 | @interface HYEmptyView : UIView
18 | @property (nonatomic,strong) HYNetReachability* reachability;
19 |
20 | /**
21 | * 不加入网络状态监控
22 | */
23 | - (instancetype)initWithSuperView:(UIView*)superView;
24 |
25 | /**
26 | * @param superView emptyView的父视图
27 | * @param netReachablity 是否加入网络状态监控
28 | * @param netBlock 网络状态改变回调
29 | */
30 | - (instancetype)initWithSuperView:(UIView*)superView
31 | AutoNetReachablity:(BOOL)netReachablity
32 | NetStatusChange:(netStatusChange)netBlock;
33 |
34 | /**
35 | * 移除空界面
36 | */
37 | - (void)removeEmptyView;
38 |
39 | /**
40 | * 切换到网络错误状态页面
41 | */
42 | - (void)changeEmptyViewToNetErrorWith:(refreshBtnClick)target;
43 |
44 | /**
45 | * 切换到空数据界面
46 | */
47 | - (void)changeEmptyViewToNoDataWith:(refreshBtnClick)target;
48 |
49 | /**
50 | * 切换到信息不完整界面
51 | */
52 | - (void)changeEmptyViewToNoUserWith:(refreshBtnClick)target;
53 |
54 | /**
55 | * 切换到施工界面
56 | */
57 | - (void)changeEmptyViewToBuild;
58 |
59 | /**
60 | * 切换界面
61 | */
62 | - (void)changeWithImage:(UIImage*)image
63 | Info:(NSString*)info
64 | BtnTitle:(NSString*)btnTitle
65 | Target:(refreshBtnClick)target;
66 |
67 |
68 | @property (nonatomic,strong) UIImage* emptyImage;
69 | @property (nonatomic,copy) NSString* refreshBtnTitle;
70 | @property (nonatomic,copy) NSString* infoTitle;
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_buliding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_buliding.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_error.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_info.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_noData.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Expand/HYEmptyView/HYEmptyViewImage.bundle/empty_noData.png
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/UIView+HYEmptyView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+HYEmptyView.h
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 | #import "HYEmptyView.h"
10 |
11 | @interface UIView (HYEmptyView)
12 |
13 | /**
14 | * 空界面
15 | */
16 | @property (nonatomic,strong) HYEmptyView* emptyView;
17 |
18 | /**
19 | * 移除空界面
20 | */
21 | - (void)removeEmptyView;
22 |
23 | /**
24 | * 切换到网络错误状态页面
25 | */
26 | - (void)changeEmptyViewToNetErrorWith:(refreshBtnClick)target;
27 |
28 | /**
29 | * 切换到空数据界面
30 | */
31 | - (void)changeEmptyViewToNoDataWith:(refreshBtnClick)target;
32 |
33 | /**
34 | * 不要刷新按钮的空数据界面
35 | */
36 | - (void)changeEmptyViewToNoDataWithoutNoBtn;
37 |
38 | /**
39 | * 切换到信息不完整界面
40 | */
41 | - (void)changeEmptyViewToNoUserWith:(refreshBtnClick)target;
42 |
43 | /**
44 | * 切换到施工中界面
45 | */
46 | - (void)changeEmptyViewToBuild;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYEmptyView/UIView+HYEmptyView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+HYEmptyView.m
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "UIView+HYEmptyView.h"
9 | #import
10 | #import "UIView+HYView.h"
11 |
12 | static char* HYEmptyViewKey = "HYEmptyViewKey";
13 | @implementation UIView (HYEmptyView)
14 |
15 |
16 | - (void)removeEmptyView
17 | {
18 | [self.emptyView removeEmptyView];
19 | }
20 |
21 | - (void)changeEmptyViewToNetErrorWith:(refreshBtnClick)target
22 | {
23 | [self.emptyView changeEmptyViewToNetErrorWith:target];
24 | }
25 |
26 | - (void)changeEmptyViewToNoDataWith:(refreshBtnClick)target
27 | {
28 | [self.emptyView changeEmptyViewToNoDataWith:target];
29 | }
30 |
31 | - (void)changeEmptyViewToNoDataWithoutNoBtn
32 | {
33 | [self.emptyView changeWithImage:[UIImage imageNamed:@"HYEmptyViewImage.bundle/empty_noData"]
34 | Info:@"暂无通知信息"
35 | BtnTitle:nil
36 | Target:nil];
37 | self.emptyView.backgroundColor = UIHexColor(0xeeeeee);
38 | }
39 |
40 | - (void)changeEmptyViewToNoUserWith:(refreshBtnClick)target
41 | {
42 | [self.emptyView changeEmptyViewToNoUserWith:target];
43 | }
44 |
45 | - (void)changeEmptyViewToBuild
46 | {
47 | [self.emptyView changeEmptyViewToBuild];
48 | }
49 |
50 | - (void)setEmptyView:(HYEmptyView *)emptyView
51 | {
52 | objc_setAssociatedObject(self, HYEmptyViewKey, emptyView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
53 | }
54 |
55 | - (HYEmptyView *)emptyView
56 | {
57 | if(objc_getAssociatedObject(self, HYEmptyViewKey) == nil){
58 | objc_setAssociatedObject(self, HYEmptyViewKey, [[HYEmptyView alloc] initWithSuperView:self], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
59 | }
60 |
61 | return objc_getAssociatedObject(self, HYEmptyViewKey);
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYNetReachability/HYNetReachability.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYNetReachability.h
3 | //
4 | // Created by hhuua on 2017/6/12.
5 | // Copyright © 2017年 hhuua All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 | /**
12 | * 在IOS8下,苹果提供的Reachability示例代码在从IPv4切换到IPv6网络,或者从IPv6网络切换到IPv4时不会
13 | * 提供网络状态改变的回调。IPV6问题只需要在苹果最新的版本中支持即可。
14 | */
15 | @class HYNetReachability;
16 | typedef NS_ENUM(NSInteger, HYNetReachabilityStatus) {
17 | HYNetReachabilityStatusUnknown = -1, //未识别的网络
18 | HYNetReachabilityStatusNotReachable = 0, //无法链接
19 | HYNetReachabilityStatusReachableViaWWAN = 1, //流量网络
20 | HYNetReachabilityStatusReachableViaWiFi = 2, //WiFi网络
21 | };
22 |
23 | typedef void (^NetReachabilityStatusChanged)(HYNetReachability* reachability,HYNetReachabilityStatus status);
24 |
25 | @protocol HYNetReachabilityDelegate
26 | @optional
27 | /**
28 | * 网络状态改变
29 | */
30 | - (void)HYNetReachability:(HYNetReachability*)reachability ReachabilityChange:(HYNetReachabilityStatus)status;
31 |
32 | @end
33 |
34 | #define kSharedHYNetReachability [HYNetReachability sharedNewReachability]
35 | #define kSharedHYNetReachabilityStatus [kSharedHYNetReachability currentNetStatus]
36 |
37 | @interface HYNetReachability : NSObject
38 | /**
39 | * 通过将sockaddr_in创建为零地址:0.0.0.0,查询本机的网络连接状态
40 | */
41 | + (HYNetReachability*)sharedNewReachability;
42 |
43 | /**
44 | * 通过指定的服务器IP地址(sockaddr_in参数)初始化
45 | */
46 | + (HYNetReachability*)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress;
47 |
48 | /**
49 | * 通过指定的服务器域名初始化
50 | */
51 | + (HYNetReachability*)reachabilityWithHostName:(NSString *)hostName;
52 |
53 | /**
54 | * 通过Block获取状态改变的回调
55 | */
56 | - (void)addTargetWithBlock:(NetReachabilityStatusChanged)block;
57 |
58 | /**
59 | * 添加代理
60 | */
61 | - (void)addDelegate:(id)delegate;
62 |
63 | /**
64 | * 在对象被释放之前,移除代理
65 | */
66 | - (void)removeDelegate:(id)delegate;
67 |
68 | /**
69 | * 开始监听网络
70 | */
71 | - (BOOL)startMonitorNetReachability;
72 |
73 | /**
74 | * 结束监听网络
75 | */
76 | - (void)stopMonitorNetReachability;
77 |
78 | /**
79 | * 获取当前状态
80 | */
81 | - (HYNetReachabilityStatus)currentNetStatus;
82 |
83 | /**
84 | * 当前网络是否可达
85 | */
86 | @property (readonly,nonatomic,assign,getter=isHostReachable) BOOL hostReachable;
87 |
88 | /**
89 | * 当前网络是否是WIFI网络
90 | */
91 | @property (readonly,nonatomic,assign,getter=isHostReachableWIFI) BOOL hostReachableWIFI;
92 |
93 | /**
94 | * 当前网络是否是流量网络
95 | */
96 | @property (readonly,nonatomic,assign,getter=isHostReachableWWAN) BOOL hostReachableWWAN;
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYNetReachability/TWNetReachability.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYNetReachability.h
3 | // yuanchengTravel
4 | //
5 | // Created by 黄也 on 2017/6/12.
6 | // Copyright © 2017年 杭州通悟科技有限公司. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | /**
13 | * 在IOS8下,苹果提供的Reachability示例代码在从IPv4切换到IPv6网络,或者从IPv6网络切换到IPv4时不会
14 | * 提供网络状态改变的回调。IPV6问题只需要在苹果最新的版本中支持即可。
15 | */
16 | @class HYNetReachability;
17 | typedef NS_ENUM(NSInteger, TWNetReachabilityStatus) {
18 | TWNetReachabilityStatusUnknown = -1, //未识别的网络
19 | TWNetReachabilityStatusNotReachable = 0, //无法链接
20 | TWNetReachabilityStatusReachableViaWWAN = 1, //流量网络
21 | TWNetReachabilityStatusReachableViaWiFi = 2, //WiFi网络
22 | };
23 |
24 | typedef void (^NetReachabilityStatusChanged)(HYNetReachability* reachability,TWNetReachabilityStatus status);
25 |
26 | @protocol TWNetReachabilityDelegate
27 | @optional
28 | /**
29 | * 网络状态改变
30 | */
31 | - (void)TWNetReachability:(HYNetReachability*)reachability ReachabilityChange:(TWNetReachabilityStatus)status;
32 |
33 | @end
34 |
35 | #define kSharedTWNetReachability [TWNetReachability sharedNewReachability]
36 | #define kSharedTWNetReachabilityStatus [kSharedTWNetReachability currentNetStatus]
37 |
38 | @interface HYNetReachability : NSObject
39 | /**
40 | * 通过将sockaddr_in创建为零地址:0.0.0.0,查询本机的网络连接状态
41 | */
42 | + (HYNetReachability*)sharedNewReachability;
43 |
44 | /**
45 | * 通过指定的服务器IP地址(sockaddr_in参数)初始化
46 | */
47 | + (HYNetReachability*)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress;
48 |
49 | /**
50 | * 通过指定的服务器域名初始化
51 | */
52 | + (HYNetReachability*)reachabilityWithHostName:(NSString *)hostName;
53 |
54 | /**
55 | * 通过Block获取状态改变的回调
56 | */
57 | - (void)addTargetWithBlock:(NetReachabilityStatusChanged)block;
58 |
59 | /**
60 | * 添加代理
61 | */
62 | - (void)addDelegate:(id)delegate;
63 |
64 | /**
65 | * 在对象被释放之前,移除代理
66 | */
67 | - (void)removeDelegate:(id)delegate;
68 |
69 | /**
70 | * 开始监听网络
71 | */
72 | - (BOOL)startMonitorNetReachability;
73 |
74 | /**
75 | * 结束监听网络
76 | */
77 | - (void)stopMonitorNetReachability;
78 |
79 | /**
80 | * 获取当前状态
81 | */
82 | - (TWNetReachabilityStatus)currentNetStatus;
83 |
84 | /**
85 | * 当前网络是否可达
86 | */
87 | @property (readonly,nonatomic,assign,getter=isHostReachable) BOOL hostReachable;
88 |
89 | /**
90 | * 当前网络是否是WIFI网络
91 | */
92 | @property (readonly,nonatomic,assign,getter=isHostReachableWIFI) BOOL hostReachableWIFI;
93 |
94 | /**
95 | * 当前网络是否是流量网络
96 | */
97 | @property (readonly,nonatomic,assign,getter=isHostReachableWWAN) BOOL hostReachableWWAN;
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYDismissPopAnimation.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYDismissPopAnimation.h
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /**
11 | * 用于在Dismiss时实现Navi的pop动画
12 | */
13 | @interface HYDismissPopAnimation : NSObject
14 |
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYDismissPopAnimation.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYDismissPopAnimation.m
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "HYDismissPopAnimation.h"
9 |
10 | @implementation HYDismissPopAnimation
11 | - (NSTimeInterval)transitionDuration:(id )transitionContext
12 | {
13 | return 0.2f;
14 | }
15 |
16 | - (void)animateTransition:(id )transitionContext
17 | {
18 | UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
19 | UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
20 |
21 | CGRect screenBounds = [[UIScreen mainScreen] bounds];
22 | CGRect initFrame = [transitionContext initialFrameForViewController:fromVC];
23 | CGRect finalFrame = CGRectOffset(initFrame, screenBounds.size.width, 0);
24 |
25 | UIView *containerView = [transitionContext containerView];
26 | [containerView addSubview:toVC.view];
27 | [containerView sendSubviewToBack:toVC.view];
28 |
29 | NSTimeInterval duration = [self transitionDuration:transitionContext];
30 | [UIView animateWithDuration:duration animations:^{
31 | fromVC.view.frame = finalFrame;
32 | } completion:^(BOOL finished) {
33 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
34 | }];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYPresentPushAnimation.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYPresentPushAnimation.h
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /**
11 | * 用于在模态时使用Navi的push动画
12 | */
13 | @interface HYPresentPushAnimation : NSObject
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYPresentPushAnimation.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYPresentPushAnimation.m
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "HYPresentPushAnimation.h"
9 |
10 | @implementation HYPresentPushAnimation
11 |
12 | - (NSTimeInterval)transitionDuration:(id )transitionContext
13 | {
14 | return 0.2f;
15 | }
16 |
17 | - (void)animateTransition:(id )transitionContext
18 | {
19 | UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
20 |
21 | CGRect screenBounds = [[UIScreen mainScreen] bounds];
22 | CGRect finalFrame = [transitionContext finalFrameForViewController:toVC];
23 | toVC.view.frame = CGRectOffset(finalFrame, screenBounds.size.width, 0);
24 |
25 | UIView *containerView = [transitionContext containerView];
26 | [containerView addSubview:toVC.view];
27 |
28 | NSTimeInterval duration = [self transitionDuration:transitionContext];
29 |
30 | [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
31 | toVC.view.frame = finalFrame;
32 | } completion:^(BOOL finished) {
33 | [transitionContext completeTransition:YES];
34 | }];
35 |
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYSwipeInteractiveTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYSwipeInteractiveTransition.h
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | /**
11 | * 用于在使用模态仿Navi动画时的渐进式返回动画
12 | */
13 | @interface HYSwipeInteractiveTransition : UIPercentDrivenInteractiveTransition
14 |
15 | @property (nonatomic, assign) BOOL interacting;
16 | - (void)wireToViewController:(UIViewController*)viewController;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/HYPresentAnimation/HYSwipeInteractiveTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYSwipeInteractiveTransition.m
3 | //
4 | // Created by hhuua on 2017/8/21.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "HYSwipeInteractiveTransition.h"
9 | #import "HYBaseViewController.h"
10 |
11 | @interface HYSwipeInteractiveTransition()
12 | @property (nonatomic, assign) BOOL shouldComplete;
13 | @property (nonatomic, strong) UIViewController *presentingVC;
14 | @end
15 |
16 | @implementation HYSwipeInteractiveTransition
17 |
18 | -(void)wireToViewController:(UIViewController *)viewController
19 | {
20 | self.presentingVC = viewController;
21 |
22 | if([viewController isKindOfClass:[HYBaseViewController class]]){
23 |
24 | [self prepareGestureRecognizerInView:viewController.view];
25 | }else if ([viewController isKindOfClass:[UINavigationController class]]){
26 |
27 | UINavigationController* navi = (UINavigationController*)viewController;
28 | if ([navi.topViewController isKindOfClass:[HYBaseViewController class]]){
29 | [self prepareGestureRecognizerInView:viewController.view];
30 | }
31 | }
32 | }
33 |
34 | - (void)prepareGestureRecognizerInView:(UIView*)view {
35 | UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
36 | [view addGestureRecognizer:gesture];
37 | }
38 |
39 | -(CGFloat)completionSpeed
40 | {
41 | return 1 - self.percentComplete;
42 | }
43 |
44 | - (void)handleGesture:(UIPanGestureRecognizer *)gestureRecognizer {
45 | CGPoint translation = [gestureRecognizer translationInView:gestureRecognizer.view.superview];
46 | switch (gestureRecognizer.state) {
47 | case UIGestureRecognizerStateBegan:
48 |
49 | if(translation.x<0.4){
50 | self.interacting = YES;
51 | [self.presentingVC dismissViewControllerAnimated:YES completion:nil];
52 | }
53 | break;
54 | case UIGestureRecognizerStateChanged: {
55 |
56 | CGFloat fraction = translation.x / (kScreenWidth*0.7);
57 |
58 | fraction = fminf(fmaxf(fraction, 0.0), 1.0);
59 | self.shouldComplete = (fraction > 0.5);
60 |
61 | [self updateInteractiveTransition:fraction];
62 | break;
63 | }
64 | case UIGestureRecognizerStateEnded:
65 | case UIGestureRecognizerStateCancelled: {
66 |
67 | self.interacting = NO;
68 | if (!self.shouldComplete || gestureRecognizer.state == UIGestureRecognizerStateCancelled) {
69 | [self cancelInteractiveTransition];
70 | } else {
71 | [self finishInteractiveTransition];
72 | }
73 | break;
74 | }
75 | default:
76 | break;
77 | }
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Macros/HYHigherOrderFunc.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYHigherOrderFunc.h
3 | // hzcz_zh
4 | //
5 | // Created by hhuua on 2018/1/18.
6 | // Copyright © 2018 hhuua All rights reserved.
7 | //
8 |
9 | /* 实现一些其他语言中常见的高阶函数*/
10 |
11 | #ifndef HYHigherOrderFunc_h
12 | #define HYHigherOrderFunc_h
13 |
14 | /**
15 | * 常见的map函数,传入一个数组,对数组中的所有对象执行同一方法,并返回一个新的数组
16 | * 示例:
17 | NSArray* ddd = kMap(@[@"A", @"B", @"C", @"D", @"E", @"F"], ^id(id obj) {
18 | return ((NSString*)obj).lowercaseString;
19 | });
20 |
21 | 输出: ddd = @[@"a",@"b",@"c",@"d",@"e",@"f"]
22 | */
23 | static inline NSArray* kMap(NSArray* arr, id(^func)(id obj)){
24 | NSMutableArray* array = [[NSMutableArray alloc] init];
25 | [arr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
26 | [array addObject:func(obj)];
27 | }];
28 | return array;
29 | }
30 |
31 | /**
32 | * 常见的filter函数,传入一个数组,对数组中的元素按照判定值进行筛选,并返回一个新的数组
33 | * 示例:
34 | NSArray* ddd = kFilter(@[@"1", @"2", @"3", @"4", @"5", @"6", @"7"], ^BOOL(NSString* obj) {
35 | return [obj integerValue] >= 4;
36 | });
37 |
38 | 输出: ddd = @[@"4", @"5", @"6", @"7"]
39 | */
40 | static inline NSArray* kFilter(NSArray* arr, BOOL(^result)(id obj)){
41 | NSMutableArray* array = [NSMutableArray array];
42 | [arr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
43 | if (result(obj))
44 | [array addObject:obj];
45 | }];
46 | return array;
47 | }
48 |
49 | /**
50 | * 常见的排序函数,给出一个数组,返回一个按照iOS默认规则排序的新数组
51 | * 示例:
52 | NSArray* ddd = kSort(@[@"123", @"143", @"abc", @"bbc", @"110", @"Abc", @"aBc"], ^id(id obj) {
53 | // 返回值为排序的字段,例如按照user对象的name属性进行排序:return user.name;
54 | return obj;
55 | });
56 |
57 | 输出: ddd = @[110,123,143,Abc,aBc,abc,bbc]
58 | */
59 | static inline NSArray* kSort(NSArray* arr, id(^result)(id obj)){
60 | NSArray* sortArr = [arr sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
61 | return [result(obj1) compare:result(obj2)];
62 | }];
63 | return sortArr;
64 | }
65 |
66 | /**
67 | * 常用的reduce函数
68 | 示例:
69 | double ddd = kReduce(@[@1, @2, @3, @4, @5, @6], ^double(double Tvalue, double Nvalue) {
70 | return Tvalue * Nvalue;
71 | });
72 |
73 | 输出: ddd = 720.000000
74 | */
75 | static inline double kReduce(NSArray* arr, double(^func)(double Tvalue, double Nvalue)){
76 | __block double va;
77 | [arr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
78 | va = idx==0?[obj doubleValue] : func(va, [obj doubleValue]);
79 | }];
80 |
81 | return va;
82 | }
83 |
84 |
85 | #endif /* HYHigherOrderFunc_h */
86 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Macros/HYMacros.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYMacros.h
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #ifndef HYMacros_h
9 | #define HYMacros_h
10 |
11 | #ifdef DEBUG
12 | #define HYDebugLog(FORMAT, ...) fprintf(stderr,"%s:[%s]%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],__FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
13 | #else
14 | #define HYDebugLog(...)
15 | #endif
16 |
17 | //导航栏高度
18 | #define kTopBarHeight 64.5
19 |
20 | //App版本号
21 | #define kAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
22 |
23 | // 当前版本
24 | #define kFSystemVersion ([[[UIDevice currentDevice] systemVersion] floatValue])
25 | #define kDSystemVersion ([[[UIDevice currentDevice] systemVersion] doubleValue])
26 | #define kSSystemVersion ([[UIDevice currentDevice] systemVersion])
27 |
28 | // 是否空对象
29 | #define IS_NULL_CLASS(OBJECT) [OBJECT isKindOfClass:[NSNull class]]
30 |
31 | //AppDelegate对象
32 | #define AppDelegateInstance [[UIApplication sharedApplication] delegate]
33 |
34 | //缩写
35 | #define kApplication [UIApplication sharedApplication]
36 | #define kKeyWindow [UIApplication sharedApplication].keyWindow
37 | #define kNotificationCenter [NSNotificationCenter defaultCenter]
38 |
39 | //获取图片资源
40 | #define kGetImage(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]
41 |
42 | #define kRegisterNib(nibName) [UINib nibWithNibName:nibName bundle:[NSBundle mainBundle]]
43 |
44 | //字符串是否为空
45 | #define kStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
46 | //数组是否为空
47 | #define kArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
48 | //字典是否为空
49 | #define kDictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
50 | //是否是空对象
51 | #define kObjectIsEmpty(_object) (_object == nil \
52 | || [_object isKindOfClass:[NSNull class]] \
53 | || ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
54 | || ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))
55 |
56 | //在Global Queue上运行
57 | #define kDISPATCH_ON_GLOBAL_QUEUE_HIGH(globalQueueBlocl) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), globalQueueBlocl);
58 | #define kDISPATCH_ON_GLOBAL_QUEUE_DEFAULT(globalQueueBlocl) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), globalQueueBlocl);
59 | #define kDISPATCH_ON_GLOBAL_QUEUE_LOW(globalQueueBlocl) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), globalQueueBlocl);
60 | #define kDISPATCH_ON_GLOBAL_QUEUE_BACKGROUND(globalQueueBlocl) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), globalQueueBlocl);
61 |
62 | //快速调用主线程
63 | #define kdispatch_main_sync_safe(block)\
64 | if ([NSThread isMainThread]) {\
65 | block();\
66 | } else {\
67 | dispatch_sync(dispatch_get_main_queue(), block);\
68 | }
69 |
70 | #define kdispatch_main_async_safe(block)\
71 | if ([NSThread isMainThread]) {\
72 | block();\
73 | } else {\
74 | dispatch_async(dispatch_get_main_queue(), block);\
75 | }
76 |
77 | #define kWeakSelf(type) __weak typeof(type) weak##type = type;
78 | #define kStrongSelf(type) __strong typeof(type) type = weak##type;
79 |
80 | //傻逼刘海屏的判断
81 | static inline BOOL isIPhoneXSeries() {
82 | BOOL iPhoneXSeries = NO;
83 | if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
84 | return iPhoneXSeries;
85 | }
86 |
87 | if (@available(iOS 11.0, *)) {
88 | UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];
89 | if (mainWindow.safeAreaInsets.bottom > 0.0) {
90 | iPhoneXSeries = YES;
91 | }
92 | }
93 |
94 | return iPhoneXSeries;
95 | }
96 |
97 |
98 | #endif /* HYMacros_h */
99 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Macros/HYNotificationMacros.h:
--------------------------------------------------------------------------------
1 | //
2 | // TWNotificationMacros.h
3 | //
4 | // Created by hhuua on 2017/8/28.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #ifndef TWNotificationMacros_h
9 | #define TWNotificationMacros_h
10 |
11 | #define kNotifyAppDidBecomeActive @"HYNotify_applicationDidBecomeActive"
12 | #define kNotifyAppDidEnterBackground @"HYNotify_applicationDidEnterBackground"
13 |
14 | #define kNotifyReadContentTouchEnd @"HYNotifyReadContentTouchEnd"
15 | #define kNotifyReadChangeBookSource @"HYReadChangeBookSource"
16 |
17 | #endif /* TWNotificationMacros_h */
18 |
--------------------------------------------------------------------------------
/Book_Reader/Expand/Macros/HYRegulaStrMacro.h:
--------------------------------------------------------------------------------
1 | //
2 | // TWRegulaStrMacro.h
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #ifndef TWRegulaStrMacro_h
9 | #define TWRegulaStrMacro_h
10 |
11 | #define kPhoneNumRegulaStr @"^1[34578]\\d{9}$"
12 | #define kIsPhoneNum(str) [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", kPhoneNumRegulaStr] evaluateWithObject:str]
13 |
14 | #endif /* TWRegulaStrMacro_h */
15 |
--------------------------------------------------------------------------------
/Book_Reader/HYAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HYAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/Book_Reader/HYAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYAppDelegate.h"
10 | #import
11 | #import "MainBookListVC.h"
12 | #import "MainBookRightVC.h"
13 | #import
14 | #import
15 | #import "UnsplashImageVC.h"
16 |
17 | @interface HYAppDelegate ()
18 |
19 | @end
20 | @implementation HYAppDelegate
21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
22 |
23 | UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:[[MainBookListVC alloc] init]];
24 | MainBookRightVC* rightVC = [[MainBookRightVC alloc] init];
25 |
26 | MMDrawerController* drawerController = [[MMDrawerController alloc] initWithCenterViewController:navi rightDrawerViewController:rightVC];
27 | drawerController.maximumRightDrawerWidth = kScreenWidth * 0.8;
28 | drawerController.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;
29 |
30 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
31 | self.window.rootViewController = drawerController;
32 | [self.window makeKeyAndVisible];
33 |
34 | [self configureBoardManager];
35 |
36 | return YES;
37 | }
38 |
39 | #pragma mark 键盘收回管理
40 | -(void)configureBoardManager
41 | {
42 | IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
43 | manager.enable = YES;
44 | manager.shouldResignOnTouchOutside = YES;
45 | manager.shouldToolbarUsesTextFieldTintColor = YES;
46 | manager.keyboardDistanceFromTextField=60;
47 | manager.enableAutoToolbar = NO;
48 | }
49 |
50 | - (void)applicationWillResignActive:(UIApplication *)application {
51 |
52 | }
53 |
54 | - (void)applicationDidEnterBackground:(UIApplication *)application {
55 |
56 | }
57 |
58 | - (void)applicationWillEnterForeground:(UIApplication *)application {
59 |
60 | }
61 |
62 | - (void)applicationDidBecomeActive:(UIApplication *)application {
63 |
64 | }
65 |
66 | - (void)applicationWillTerminate:(UIApplication *)application {
67 |
68 | }
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/Book_Reader/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | zh_CN
7 | CFBundleDisplayName
8 | 小说阅读
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 |
30 | UILaunchStoryboardName
31 | LaunchScreen
32 | UIRequiredDeviceCapabilities
33 |
34 | armv7
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 |
40 | UISupportedInterfaceOrientations~ipad
41 |
42 | UIInterfaceOrientationPortrait
43 | UIInterfaceOrientationPortraitUpsideDown
44 | UIInterfaceOrientationLandscapeLeft
45 | UIInterfaceOrientationLandscapeRight
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Base/BaseController/HYBaseViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYBaseViewController.h
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import
9 | @interface HYBaseViewController : UIViewController
10 | @property (nonatomic, assign, getter=isFirstLoad) BOOL firstLoad;
11 |
12 | /**
13 | * 模态推出并使用Navi的push和pop动画
14 | */
15 | - (void)pushPresentViewController:(UIViewController *)viewControllerToPresent;
16 | - (void)pushPresentWithOutSwipeViewController:(UIViewController *)viewControllerToPresent;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Base/BaseController/HYBaseViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYBaseViewController.m
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "HYBaseViewController.h"
9 | #import "HYPresentPushAnimation.h"
10 | #import "HYDismissPopAnimation.h"
11 | #import "HYSwipeInteractiveTransition.h"
12 |
13 | @interface HYBaseViewController ()
14 | @property (nonatomic, strong) HYPresentPushAnimation *presentAnimation;
15 | @property (nonatomic, strong) HYDismissPopAnimation *dismissAnimation;
16 | @property (nonatomic, strong) HYSwipeInteractiveTransition *transitionController;
17 |
18 | @end
19 |
20 | @implementation HYBaseViewController
21 |
22 | - (instancetype)init
23 | {
24 | self = [super init];
25 | if(self){
26 | _presentAnimation = [HYPresentPushAnimation new];
27 | _dismissAnimation = [HYDismissPopAnimation new];
28 | _transitionController = [HYSwipeInteractiveTransition new];
29 | }
30 | return self;
31 | }
32 |
33 | - (void)viewDidLoad
34 | {
35 | [super viewDidLoad];
36 | }
37 |
38 | #pragma mark - navi返回动画
39 | - (void)viewWillAppear:(BOOL)animated
40 | {
41 | [super viewWillAppear:animated];
42 |
43 | if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
44 | self.navigationController.interactivePopGestureRecognizer.delegate = self;
45 | }
46 | }
47 |
48 | - (void)viewDidAppear:(BOOL)animated
49 | {
50 | [super viewDidAppear:animated];
51 |
52 | _firstLoad = YES;
53 | }
54 |
55 | - (void)viewWillDisappear:(BOOL)animated
56 | {
57 | [super viewWillDisappear:animated];
58 |
59 | if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]){
60 | self.navigationController.interactivePopGestureRecognizer.delegate = nil;
61 | }
62 |
63 | [self.view endEditing:YES];
64 | }
65 |
66 | - (void)pushPresentViewController:(UIViewController *)viewControllerToPresent
67 | {
68 | viewControllerToPresent.transitioningDelegate = self;
69 | [self.transitionController wireToViewController:viewControllerToPresent];
70 | [self presentViewController:viewControllerToPresent animated:YES completion:nil];
71 | }
72 |
73 | - (void)pushPresentWithOutSwipeViewController:(UIViewController *)viewControllerToPresent;
74 | {
75 | viewControllerToPresent.transitioningDelegate = self;
76 | [self presentViewController:viewControllerToPresent animated:YES completion:nil];
77 | }
78 |
79 | #pragma mark - UIViewControllerTransitioningDelegate
80 | - (id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
81 | {
82 | return self.presentAnimation;
83 | }
84 |
85 | -(id)animationControllerForDismissedController:(UIViewController *)dismissed
86 | {
87 | return self.dismissAnimation;
88 | }
89 |
90 | -(id)interactionControllerForDismissal:(id)animator {
91 | return self.transitionController.interacting ? self.transitionController : nil;
92 | }
93 |
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookAPIBaseModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookAPIBaseModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BookAPIBaseModel : NSObject
12 |
13 | - (id)initWithDic:(NSDictionary *)dic;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookAPIBaseModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookAPIBaseModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 | #import
11 |
12 | @implementation BookAPIBaseModel
13 |
14 | - (id)initWithDic:(NSDictionary *)dic
15 | {
16 | self = [super init];
17 | if(self){
18 | [self mj_setKeyValues:dic];
19 | }
20 | return self;
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookChapterModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 |
11 | @interface BookChapterModel : BookAPIBaseModel
12 |
13 | /* 章节名*/
14 | @property (nonatomic,copy) NSString* name;
15 | /* 章节url*/
16 | @property (nonatomic,copy) NSString* chapter_url;
17 | /* 书本的关联id*/
18 | @property (nonatomic,copy) NSString* book_id;
19 | /* 章节在书源处的id编号*/
20 | @property (nonatomic,copy) NSString* chapter_id;
21 | /* 章节来源的url*/
22 | @property (nonatomic,copy) NSString* source_url;
23 |
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookChapterModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterModel.h"
10 |
11 | @implementation BookChapterModel
12 |
13 | - (NSString *)description
14 | {
15 | return [NSString stringWithFormat:@"source_url:%@,chapter_url:%@,name:%@,chapter_id:%@",self.source_url,self.chapter_url,self.name,self.chapter_id];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookChapterTextModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterTextModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 |
11 | @interface BookChapterTextModel : BookAPIBaseModel
12 |
13 | /* 章节的具体内容*/
14 | @property (nonatomic,copy) NSString* info;
15 | /* 章节的url*/
16 | @property (nonatomic,copy) NSString* url;
17 | /* 章节所属书本的book_id*/
18 | @property (nonatomic,copy) NSString* book_id;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookChapterTextModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterTextModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterTextModel.h"
10 |
11 | @implementation BookChapterTextModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookInfoModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 |
11 | @interface BookInfoModel : BookAPIBaseModel
12 |
13 | /* 书本名称*/
14 | @property (nonatomic,copy) NSString* book_name;
15 | /* 作者*/
16 | @property (nonatomic,copy) NSString* author;
17 | /* 书本的关联id号码*/
18 | @property (nonatomic,copy) NSString* related_id;
19 | /* 书本更新时间(不太准)*/
20 | @property (nonatomic,copy) NSString* update_time;
21 | /* 书本简介*/
22 | @property (nonatomic,copy) NSString* book_desc;
23 | /* 书本图片url*/
24 | @property (nonatomic,copy) NSString* book_image;
25 | /* 当前所选书源的url*/
26 | @property (nonatomic,copy) NSString* book_url;
27 | /* 书本的书源名称*/
28 | @property (nonatomic,copy) NSString* source_name;
29 |
30 |
31 | /* 书本状态*/
32 | @property (nonatomic,copy) NSString* book_state;
33 | /* 书本分类*/
34 | @property (nonatomic,copy) NSString* book_sort;
35 | /* 书本最后章节*/
36 | @property (nonatomic,copy) NSString* book_last_chapter;
37 | /* 字数*/
38 | @property (nonatomic,assign) NSInteger book_word_count;
39 | /* 收藏人数*/
40 | @property (nonatomic,assign) NSInteger collection_num;
41 |
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookInfoModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookInfoModel.h"
10 |
11 | @implementation BookInfoModel
12 |
13 | - (NSString *)description
14 | {
15 | return [NSString stringWithFormat:@"书名:%@,作者:%@,id:%@,更新时间:%@,当前源:%@,简介:%@",self.book_name,self.author,self.related_id,self.update_time,self.book_url,self.book_desc];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookRecordModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookRecordModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BookRecordModel : NSObject
12 |
13 | @property (nonatomic,copy) NSString* book_id;
14 | @property (nonatomic,assign) NSInteger chapter_index;
15 | @property (nonatomic,copy) NSString* chapter_name;
16 | @property (nonatomic,copy) NSString* record_text;
17 | @property (nonatomic,strong) NSDate* record_time;
18 |
19 | - (instancetype)initWithId:(NSString*)book_id
20 | index:(NSInteger)index
21 | record:(NSString*)record
22 | chapterName:(NSString*)chapterName;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookRecordModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookRecordModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookRecordModel.h"
10 |
11 | @implementation BookRecordModel
12 |
13 | - (instancetype)initWithId:(NSString*)book_id
14 | index:(NSInteger)index
15 | record:(NSString*)record
16 | chapterName:(NSString*)chapterName
17 | {
18 | self = [super init];
19 | if (self){
20 | self.book_id = book_id;
21 | self.chapter_index = index;
22 | self.record_text = record;
23 | self.chapter_name = chapterName;
24 | }
25 | return self;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookSaveInfoModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSaveInfoModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 | #import "BookInfoModel.h"
11 | #import "BookRecordModel.h"
12 |
13 | @interface BookSaveInfoModel : BookAPIBaseModel
14 |
15 | @property (nonatomic,strong) BookInfoModel* bookInfo;
16 | @property (nonatomic,strong) BookRecordModel* bookRecord;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BookSaveInfoModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookSaveInfoModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookSaveInfoModel.h"
10 |
11 | @implementation BookSaveInfoModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BooksourceModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BooksourceModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/19.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookAPIBaseModel.h"
10 |
11 | @interface BooksourceModel : BookAPIBaseModel
12 |
13 | /* 关联id*/
14 | @property (nonatomic,copy) NSString* related_id;
15 | /* 更新时间*/
16 | @property (nonatomic,copy) NSString* update_time;
17 | /* 书源url*/
18 | @property (nonatomic,copy) NSString* book_url;
19 | /* 书源名称*/
20 | @property (nonatomic,copy) NSString* source_name;
21 | /* 最后章节*/
22 | @property (nonatomic,copy) NSString* book_last_chapter;
23 |
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookAPIModel/BooksourceModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BooksourceModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/19.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BooksourceModel.h"
10 |
11 | @implementation BooksourceModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookReadContentModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadContentModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/2/21.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface BookReadContentModel : NSObject
14 |
15 | /* 该"页"需要显示的文本内容*/
16 | @property (nonatomic,copy) NSString* text;
17 | /* 章节名称*/
18 | @property (nonatomic,copy) NSString* chapterName;
19 | /* 总页数*/
20 | @property (nonatomic,assign) NSInteger totalNum;
21 | /* 当前页数*/
22 | @property (nonatomic,assign) NSInteger index;
23 |
24 | - (instancetype)initWithText:(NSString*)text
25 | chapterName:(NSString*)chapterName
26 | totalNum:(NSInteger)totalNum
27 | index:(NSInteger)index;
28 |
29 | @end
30 |
31 | NS_ASSUME_NONNULL_END
32 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/BookReadContentModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadContentModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/2/21.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookReadContentModel.h"
10 |
11 | @implementation BookReadContentModel
12 |
13 | - (instancetype)initWithText:(NSString*)text
14 | chapterName:(NSString*)chapterName
15 | totalNum:(NSInteger)totalNum
16 | index:(NSInteger)index
17 | {
18 | self = [super init];
19 | if(self){
20 | self.text = text;
21 | self.chapterName = chapterName;
22 | self.totalNum = totalNum;
23 | self.index = index;
24 | }
25 | return self;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/UnsplashImageModel/UnsplashImageModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashImageModel.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 | @class UnsplashUserModel;
13 | @interface UnsplashImageModel : NSObject
14 | - (UnsplashImageModel*)initWithDic:(NSDictionary *)dic;
15 |
16 | /* id*/
17 | @property (nonatomic, copy) NSString* imageId;
18 | /* 创建时间*/
19 | @property (nonatomic, copy) NSString* created_at;
20 | /* 上传时间*/
21 | @property (nonatomic, copy) NSString* updated_at;
22 | /* 宽*/
23 | @property (nonatomic, assign) NSInteger width;
24 | /* 高*/
25 | @property (nonatomic, assign) NSInteger height;
26 | /* 主色*/
27 | @property (nonatomic, copy) NSString* color;
28 | /* 描述*/
29 | @property (nonatomic, copy) NSString* imgDescription;
30 | /* 喜欢数*/
31 | @property (nonatomic, assign) NSInteger likes;
32 | /* 作者信息*/
33 | @property (nonatomic, copy) UnsplashUserModel* user;
34 | /* 图片列表(raw,full,regular,small,thumb)*/
35 | @property (nonatomic, copy) NSDictionary* urls;
36 |
37 | @end
38 |
39 | @interface UnsplashUserModel : NSObject
40 | /* 作者id*/
41 | @property (nonatomic, copy) NSString* userId;
42 | /* 最后上传时间*/
43 | @property (nonatomic, copy) NSString* updated_at;
44 | /* 用户名称*/
45 | @property (nonatomic, copy) NSString* username;
46 | /* 名称*/
47 | @property (nonatomic, copy) NSString* name;
48 | /* fristname*/
49 | @property (nonatomic, copy) NSString* first_name;
50 | /* lastname*/
51 | @property (nonatomic, copy) NSString* last_name;
52 | /* Twitter名称*/
53 | @property (nonatomic, copy) NSString* twitter_username;
54 | /* 页面*/
55 | @property (nonatomic, copy) NSString* portfolio_url;
56 | /* 个人简历*/
57 | @property (nonatomic, copy) NSString* bio;
58 | /* 位置*/
59 | @property (nonatomic, copy) NSString* location;
60 | /* 用户头像(small,medium,large)*/
61 | @property (nonatomic, copy) NSDictionary* profile_image;
62 | /* instagram用户名*/
63 | @property (nonatomic, copy) NSString* instagram_username;
64 | /* 总收藏数*/
65 | @property (nonatomic, assign) NSInteger total_collections;
66 | /* 总喜欢数*/
67 | @property (nonatomic, assign) NSInteger total_likes;
68 | /* 总照片数*/
69 | @property (nonatomic, assign) NSInteger total_photos;
70 |
71 | @end
72 |
73 | NS_ASSUME_NONNULL_END
74 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Model/UnsplashImageModel/UnsplashImageModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashImageModel.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "UnsplashImageModel.h"
10 | #import
11 |
12 | @implementation UnsplashImageModel
13 | - (UnsplashImageModel*)initWithDic:(NSDictionary *)dic
14 | {
15 | self = [super init];
16 | if(self){
17 | [self mj_setKeyValues:dic];
18 | self.imageId = [dic objectForKey:@"id"];
19 | self.imgDescription = [dic objectForKey:@"description"];
20 | }
21 | return self;
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/BookAPIs/HYBookAPIs.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYBookAPIs.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookInfoModel.h"
11 | #import "BookChapterModel.h"
12 | #import "BookChapterTextModel.h"
13 | #import "BooksourceModel.h"
14 |
15 | typedef void (^BookInfosSuccess)(NSArray* books);
16 | typedef void (^BookRandomSuccess)(BookInfoModel* book);
17 | typedef void (^BookChapterSuccess)(NSArray* chapters);
18 | typedef void (^BookChapterTextSuccess)(BookChapterTextModel* chapterText);
19 | typedef void (^BookNameSuccess)(NSArray* names);
20 | typedef void (^BookSourceSuccess)(NSArray* models);
21 | typedef void (^BookSortSuccess)(NSArray* array);
22 |
23 | typedef void (^Fail)(NSError* err);
24 | @interface HYBookAPIs : NSObject
25 |
26 | /**
27 | * 根据书名搜索书本信息
28 | */
29 | - (void)searchBookWithKeyWord:(NSString*)kw
30 | Start:(NSInteger)start
31 | Success:(BookInfosSuccess)success
32 | Fail:(Fail)fail;
33 |
34 |
35 | /**
36 | * 根据作者名搜索书本信息
37 | */
38 | - (void)searchBookWithAuthor:(NSString*)author
39 | Start:(NSInteger)start
40 | Success:(BookInfosSuccess)success
41 | Fail:(Fail)fail;
42 |
43 | /**
44 | * 根据分类名称进行搜索
45 | */
46 | - (void)searchBookWithSortName:(NSString*)sortName
47 | Start:(NSInteger)start
48 | Success:(BookInfosSuccess)success
49 | Fail:(Fail)fail;
50 |
51 |
52 | /**
53 | * 搜索书本分类
54 | * map k-v:
55 | * book_sort: 分类名
56 | * sort_count: 分类书本数量
57 | */
58 | - (void)searchBookSortWithSuccess:(BookSortSuccess)success
59 | Fail:(Fail)fail;
60 |
61 |
62 | /**
63 | * 随机获取一本书
64 | */
65 | - (void)randomSearchBookInfoWithSuccess:(BookRandomSuccess)success
66 | Fail:(Fail)fail;
67 |
68 | /**
69 | * 获取书本目录
70 | */
71 | - (void)chapterListWithBook:(BookInfoModel*)book
72 | Success:(BookChapterSuccess)success
73 | Fail:(Fail)fail;
74 |
75 | /**
76 | * 获取章节内容
77 | */
78 | - (void)chapterTextWithChapter:(BookChapterModel*)chapter
79 | Success:(BookChapterTextSuccess)success
80 | Fail:(Fail)fail;
81 |
82 | /**
83 | * 根据输入的关键字搜索书名
84 | */
85 | - (void)searchBookNamesWithKeyWord:(NSString*)kw
86 | Success:(BookNameSuccess)success
87 | Fail:(Fail)fail;
88 |
89 |
90 | /**
91 | * 搜索热门小说名
92 | */
93 | - (void)searchHotBookWithSuccess:(BookNameSuccess)success
94 | Fail:(Fail)fail;
95 |
96 |
97 | /**
98 | * 搜索书本书源
99 | */
100 | - (void)searchBookSourceWithRelatedId:(NSString*)relatedId
101 | Success:(BookSourceSuccess)success
102 | Fail:(Fail)fail;
103 |
104 |
105 | /**
106 | * 根据rela_id查找书本信息
107 | */
108 | - (void)searchBookInfoWithRela_id:(NSString*)rela_id
109 | Success:(BookRandomSuccess)success
110 | Fail:(Fail)fail;
111 |
112 |
113 | /**
114 | * 预加载章节
115 | */
116 | - (void)advanceLoadChapters:(NSArray*)chapters;
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/HYDatabase.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYDatabase.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookInfoModel.h"
11 | #import "BookChapterTextModel.h"
12 | #import "BookChapterModel.h"
13 | #import "BookRecordModel.h"
14 | #import "BookInfoModel.h"
15 | #import "BookSaveInfoModel.h"
16 | @interface HYDatabase : NSObject
17 |
18 | + (instancetype)sharedDatabase;
19 |
20 | /* 书本记录*/
21 | - (BOOL)saveBookInfoWithModel:(BookInfoModel*)model;
22 | - (NSArray*)selectBookInfos;
23 | - (BookInfoModel*)selectBookInfoWithRelatedId:(NSString*)relatedId;
24 | - (void)deleteBookInfoWithRelatedId:(NSString*)relatedId;
25 | - (BOOL)updateBookSourceWithRelatedId:(NSString*)relatedId Name:(NSString*)name SourceUrl:(NSString*)sourceUrl;
26 |
27 | /* 阅读记录*/
28 | - (BOOL)saveRecordWithChapterModel:(BookRecordModel*)model;
29 | - (BookRecordModel*)selectBookRecordWithBookId:(NSString*)bookId;
30 | - (void)deleteBookRecordWithBookId:(NSString*)bookId;
31 |
32 | /* 章节信息*/
33 | - (BOOL)saveChapterWithModel:(BookChapterModel*)model;
34 | - (void)saveChaptersWithModelArray:(NSArray*)modelArr;
35 | - (NSArray*)selectChapterWithSourceUrl:(NSString*)url;
36 | - (NSArray*)testSelectAllChapter;
37 |
38 | /* 章节内容*/
39 | - (BOOL)saveChapterTextWithModel:(BookChapterTextModel*)model;
40 | - (BookChapterTextModel*)selectChapterTextWithUrl:(NSString*)url;
41 | - (BOOL)deleteChapterTextWithUrl:(NSString*)url;
42 | - (BOOL)deleteChapterTextWithBookId:(NSString*)bookid;
43 |
44 | /* 搜索历史*/
45 | - (BOOL)saveSearchHistoryWithName:(NSString*)name;
46 | - (NSArray*)selectSearchHistorys;
47 | - (BOOL)deleteSearchWithName:(NSString*)name;
48 | - (void)deleteAllSearch;
49 |
50 | /* 查找用于主页显示的booksavemodel*/
51 | - (NSArray*)selectSaveBookInfos;
52 | - (BOOL)deleteSaveBookInfoWith:(BookSaveInfoModel*)model;
53 |
54 |
55 | - (instancetype)init __attribute__((unavailable("请使用sharedDatabase,以保证该类为单例")));
56 | + (instancetype)new __attribute__((unavailable("请使用sharedDatabase,以保证该类为单例")));
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookChapterModel+database.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterModel+database.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterModel.h"
10 | #import
11 |
12 | @interface BookChapterModel (database)
13 |
14 | - (instancetype)initWithFMResult:(FMResultSet*)result;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookChapterModel+database.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterModel+database.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterModel+database.h"
10 |
11 | @implementation BookChapterModel (database)
12 |
13 | - (instancetype)initWithFMResult:(FMResultSet *)result
14 | {
15 | self = [super init];
16 | if (self){
17 | self.name = [result stringForColumn:@"chapter_name"];
18 | self.chapter_url = [result stringForColumn:@"chapter_url"];
19 | self.book_id = [result stringForColumn:@"book_id"];
20 | self.chapter_id = [result stringForColumn:@"chapter_id"];
21 | self.source_url = [result stringForColumn:@"source_url"];
22 | }
23 | return self;
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookChapterTextModel+database.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterTextModel+database.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterTextModel.h"
10 | #import
11 |
12 | @interface BookChapterTextModel (database)
13 |
14 | - (instancetype)initWithFMResult:(FMResultSet*)result;
15 |
16 | #pragma mark - db
17 | @property (nonatomic,strong) NSDate* time;
18 | @property (nonatomic,assign) NSInteger dbId;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookChapterTextModel+database.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterTextModel+database.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookChapterTextModel+database.h"
10 | #import
11 |
12 | #define kTimeKey @"ChapterTextModel_Time"
13 | #define kDbIdKey @"ChapterTextModel_DbId"
14 |
15 | @implementation BookChapterTextModel (database)
16 |
17 | - (instancetype)initWithFMResult:(FMResultSet *)result
18 | {
19 | self = [super init];
20 | if (self){
21 | self.url = [result stringForColumn:@"chapter_url"];
22 | self.info = [result stringForColumn:@"chapter_text"];
23 | self.dbId = [result intForColumn:@"id"];
24 | self.time = [result dateForColumn:@"time"];
25 | }
26 | return self;
27 | }
28 |
29 | #pragma mark - db
30 | - (NSDate *)time
31 | {
32 | if(objc_getAssociatedObject(self, kTimeKey) == nil){
33 | objc_setAssociatedObject(self, kTimeKey, [NSDate date], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
34 | }
35 | return objc_getAssociatedObject(self, kTimeKey);
36 | }
37 |
38 | - (void)setTime:(NSDate *)time
39 | {
40 | objc_setAssociatedObject(self, kTimeKey, time, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
41 | }
42 |
43 | - (NSInteger)dbId
44 | {
45 | if(objc_getAssociatedObject(self, kDbIdKey) == nil){
46 | objc_setAssociatedObject(self, kDbIdKey, @(0), OBJC_ASSOCIATION_ASSIGN);
47 | }
48 | return [objc_getAssociatedObject(self, kDbIdKey) integerValue];
49 | }
50 |
51 | - (void)setDbId:(NSInteger)dbId
52 | {
53 | objc_setAssociatedObject(self, kDbIdKey, @(dbId), OBJC_ASSOCIATION_ASSIGN);
54 | }
55 |
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookInfoModel+database.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoModel+database.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookInfoModel.h"
10 | #import
11 |
12 | @interface BookInfoModel (database)
13 |
14 | - (instancetype)initWithFMResult:(FMResultSet*)result;
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookInfoModel+database.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoModel+database.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookInfoModel+database.h"
10 |
11 | @implementation BookInfoModel (database)
12 |
13 | - (instancetype)initWithFMResult:(FMResultSet *)result
14 | {
15 | self = [super init];
16 | if (self){
17 | self.book_name = [result stringForColumn:@"book_name"];
18 | self.author = [result stringForColumn:@"author"];
19 | self.related_id = [result stringForColumn:@"related_id"];
20 | self.update_time = [result stringForColumn:@"update_time"];
21 | self.book_desc = [result stringForColumn:@"book_desc"];
22 | self.book_image = [result stringForColumn:@"book_image"];
23 | self.book_url = [result stringForColumn:@"book_url"];
24 | self.source_name = [result stringForColumn:@"source_name"];
25 | self.book_state = [result stringForColumn:@"book_state"];
26 | self.book_sort = [result stringForColumn:@"book_sort"];
27 | self.book_last_chapter = [result stringForColumn:@"book_last_chapter"];
28 | self.book_word_count = [result intForColumn:@"book_word_count"];
29 | self.collection_num = [result intForColumn:@"collection_num"];
30 | }
31 | return self;
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookRecordModel+database.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookRecordModel+database.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookRecordModel.h"
10 | #import
11 |
12 | @interface BookRecordModel (database)
13 |
14 | - (instancetype)initWithFMResult:(FMResultSet*)result;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookRecordModel+database.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookRecordModel+database.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookRecordModel+database.h"
10 |
11 | @implementation BookRecordModel (database)
12 |
13 | - (instancetype)initWithFMResult:(FMResultSet *)result
14 | {
15 | self = [super init];
16 | if (self) {
17 | self.book_id = [result stringForColumn:@"book_id"];
18 | self.chapter_index = [result intForColumn:@"chapter_index"];
19 | self.record_text = [result stringForColumn:@"record_text"];
20 | self.chapter_name = [result stringForColumn:@"chapter_name"];
21 | self.record_time = [result objectForColumn:@"record_time"];
22 | }
23 | return self;
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookSaveInfoModel+database.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSaveInfoModel+database.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookSaveInfoModel.h"
11 | #import "BookInfoModel+database.h"
12 | #import "BookRecordModel+database.h"
13 |
14 | @interface BookSaveInfoModel (database)
15 |
16 | - (instancetype)initWithFMResult:(FMResultSet*)result;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/Database/Model_Catepory/BookSaveInfoModel+database.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookSaveInfoModel+database.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookSaveInfoModel+database.h"
10 |
11 | @implementation BookSaveInfoModel (database)
12 |
13 | - (instancetype)initWithFMResult:(FMResultSet*)result
14 | {
15 | self = [super init];
16 | if (self){
17 | self.bookInfo = [[BookInfoModel alloc] initWithFMResult:result];
18 | self.bookRecord = [[BookRecordModel alloc] initWithFMResult:result];
19 | }
20 | return self;
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/HYHTTPSessionManager/HYHTTPSessionManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYHTTPSessionManager.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface HYHTTPSessionManager : AFHTTPSessionManager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/HYHTTPSessionManager/HYHTTPSessionManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYHTTPSessionManager.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYHTTPSessionManager.h"
10 |
11 | @implementation HYHTTPSessionManager
12 |
13 | + (instancetype)manager
14 | {
15 | HYHTTPSessionManager* manager = [super manager];
16 | manager.requestSerializer = [AFHTTPRequestSerializer new];
17 |
18 | [manager.requestSerializer setValue:@"application/x-www-form-urlencoded;charset=utf-8" forHTTPHeaderField:@"Content-Type"];
19 | manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain",nil];
20 |
21 | [manager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
22 | manager.requestSerializer.timeoutInterval = 30.f;
23 | [manager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
24 |
25 |
26 | return manager;
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/UnsplashAPI/UnsplashAPI.h:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashAPI.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UnsplashImageModel.h"
11 |
12 | typedef NS_ENUM(NSInteger, kGetImageListOrder){
13 | GetImageListOrderLatest = 0, /* 最新*/
14 | GetImageListOrderOldest, /* 最旧*/
15 | GetImageListOrderPopular, /* 最受欢迎*/
16 | };
17 |
18 | typedef void (^getImageListSuccess)(NSArray* images, NSInteger page);
19 | typedef void (^UnsplashFail)(NSError* error);
20 |
21 | @interface UnsplashAPI : NSObject
22 |
23 | - (void)getImageListWithPage:(NSInteger)page
24 | order:(enum kGetImageListOrder)order
25 | success:(getImageListSuccess)success
26 | Fail:(UnsplashFail)fail;
27 |
28 | - (void)getImageListWithPage:(NSInteger)page
29 | success:(getImageListSuccess)success
30 | Fail:(UnsplashFail)fail;
31 |
32 | - (void)searchImageListWithKeyWord:(NSString*)kw
33 | page:(NSInteger)page
34 | success:(getImageListSuccess)success
35 | Fail:(UnsplashFail)fail;
36 |
37 | @end
38 |
39 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/UnsplashAPI/UnsplashAPI.m:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashAPI.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "UnsplashAPI.h"
10 | #import
11 | #import "NSError+HYError.h"
12 |
13 | @interface UnsplashAPI()
14 |
15 | @end
16 |
17 | @implementation UnsplashAPI
18 |
19 | - (void)searchImageListWithKeyWord:(NSString*)kw
20 | page:(NSInteger)page
21 | success:(getImageListSuccess)success
22 | Fail:(UnsplashFail)fail
23 | {
24 | AFHTTPSessionManager* manager = [self UnsplashManager];
25 |
26 | NSString* url = @"https://api.unsplash.com/search/photos?";
27 | NSDictionary* dic = @{
28 | @"page" : @(page),
29 | @"per_page" : @(30),
30 | @"query" : kw
31 | };
32 |
33 | [manager GET:url parameters:dic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
34 | NSMutableArray* arr = [NSMutableArray array];
35 |
36 | if ([responseObject isKindOfClass:[NSDictionary class]]){
37 | NSArray* results = [responseObject objectForKey:@"results"];
38 |
39 | for (NSDictionary* dic in results) {
40 | UnsplashImageModel* model = [[UnsplashImageModel alloc] initWithDic:dic];
41 | if (model){
42 | [arr addObject:model];
43 | }
44 | }
45 |
46 | if (success){
47 | success(arr, page);
48 | }
49 | }else{
50 | NSError* err = [NSError errorWithDescription:@"responseObject 类型错误,与接口文档不符!"];
51 | if (fail){
52 | fail(err);
53 | }
54 | }
55 | } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
56 | if (fail){
57 | fail(error);
58 | }
59 | }];
60 |
61 | }
62 |
63 | - (void)getImageListWithPage:(NSInteger)page
64 | order:(enum kGetImageListOrder)order
65 | success:(getImageListSuccess)success
66 | Fail:(UnsplashFail)fail
67 | {
68 | AFHTTPSessionManager* manager = [self UnsplashManager];
69 |
70 | NSString* url = @"https://api.unsplash.com/photos?";
71 | NSString* orderType;
72 | switch (order) {
73 | case GetImageListOrderLatest:
74 | orderType = @"latest";
75 | break;
76 | case GetImageListOrderOldest:
77 | orderType = @"oldest";
78 | break;
79 | case GetImageListOrderPopular:
80 | orderType = @"popular";
81 | break;
82 |
83 | default:
84 | break;
85 | }
86 | NSDictionary* dic = @{
87 | @"page" : @(page),
88 | @"per_page" : @(30),
89 | @"order_by" : orderType
90 | };
91 |
92 | [manager GET:url parameters:dic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
93 | NSMutableArray* arr = [NSMutableArray array];
94 | if ([responseObject isKindOfClass:[NSArray class]]){
95 | for (NSDictionary* dic in responseObject) {
96 | UnsplashImageModel* model = [[UnsplashImageModel alloc] initWithDic:dic];
97 | if (model){
98 | [arr addObject:model];
99 | }
100 | }
101 |
102 | if (success){
103 | success(arr, page);
104 | }
105 | }else{
106 | NSError* err = [NSError errorWithDescription:@"responseObject 类型错误,与接口文档不符!"];
107 | if (fail){
108 | fail(err);
109 | }
110 | }
111 | } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
112 | if (fail){
113 | fail(error);
114 | }
115 | }];
116 | }
117 |
118 | - (void)getImageListWithPage:(NSInteger)page
119 | success:(getImageListSuccess)success
120 | Fail:(UnsplashFail)fail
121 | {
122 | [self getImageListWithPage:page order:GetImageListOrderLatest success:success Fail:fail];
123 | }
124 |
125 | - (AFHTTPSessionManager*)UnsplashManager
126 | {
127 | AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];
128 |
129 | manager.requestSerializer = [AFHTTPRequestSerializer new];
130 | [manager.requestSerializer setValue:@"Client-ID fa60305aa82e74134cabc7093ef54c8e2c370c47e73152f72371c828daedfcd7" forHTTPHeaderField:@"Authorization"];
131 |
132 | return manager;
133 | }
134 |
135 | @end
136 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/UserDefaults/GVUserDefaults+HYUserDefaults.h:
--------------------------------------------------------------------------------
1 | //
2 | // GVUserDefaults+HYUserDefaults.h
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "GVUserDefaults.h"
9 |
10 | #define HYUserDefault [GVUserDefaults standardUserDefaults]
11 |
12 | @interface GVUserDefaults (HYUserDefaults)
13 |
14 | /* 用户手机号码*/
15 | @property (nonatomic,copy) NSString* userPhoneNum;
16 | /* 用户名*/
17 | @property (nonatomic,copy) NSString* userName;
18 | /* 邮箱*/
19 | @property (nonatomic,copy) NSString* userEmail;
20 |
21 | # pragma mark - 用户阅读配置信息
22 | /* 预加载的章节数量*/
23 | @property (nonatomic,assign) NSInteger adLoadChapters;
24 | /* 用户阅读的富文本设置(字号,间距,颜色等信息)*/
25 | @property (nonatomic,strong) NSDictionary* userReadAttConfig;
26 | @property (nonatomic,strong) NSData* userReadAttConfigData;
27 | /* 阅读器的翻页方向(右<->左 下<->上)*/
28 | @property (nonatomic,assign) enum UIPageViewControllerNavigationDirection PageNaviDirection;
29 | /* 翻页方式(页面卷曲 滚动)*/
30 | @property (nonatomic,assign) enum UIPageViewControllerTransitionStyle PageTransitionStyle;
31 |
32 | @property (nonatomic,assign) enum UIPageViewControllerNavigationOrientation PageNaviOrientation;
33 | /* 阅读界面背景颜色*/
34 | @property (nonatomic,strong) UIColor* readBackColor;
35 | @property (nonatomic,strong) NSData* readBackColorData;
36 | /* 阅读界面章节等附属信息颜色*/
37 | @property (nonatomic,strong) UIColor* readInfoColor;
38 | /* 是否是夜间模式*/
39 | @property (nonatomic,assign) BOOL isNightStyle;
40 | /* 阅读界面亮度*/
41 | @property (nonatomic,assign) float readBrightness;
42 |
43 |
44 | #pragma mark - 借助userDeaults缓存部分轻量信息
45 | /* 搜索热词*/
46 | @property (nonatomic,strong) NSArray* hotWordArr;
47 |
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Book_Reader/Main/Public/UserDefaults/GVUserDefaults+HYUserDefaults.m:
--------------------------------------------------------------------------------
1 | //
2 | // GVUserDefaults+HYUserDefaults.m
3 | //
4 | // Created by hhuua on 2017/8/10.
5 | // Copyright © 2017年 hhuua. All rights reserved.
6 | //
7 |
8 | #import "GVUserDefaults+HYUserDefaults.h"
9 |
10 | @implementation GVUserDefaults (HYUserDefaults)
11 |
12 | @dynamic userPhoneNum;
13 | @dynamic userName;
14 | @dynamic userEmail;
15 | @dynamic PageNaviDirection;
16 | @dynamic PageTransitionStyle;
17 | @dynamic PageNaviOrientation;
18 | @dynamic userReadAttConfigData;
19 | @dynamic isNightStyle;
20 | @dynamic adLoadChapters;
21 | @dynamic readInfoColor;
22 | @dynamic readBrightness;
23 | @dynamic readBackColorData;
24 | @dynamic hotWordArr;
25 |
26 | - (NSDictionary *)userReadAttConfig
27 | {
28 | return [NSKeyedUnarchiver unarchiveObjectWithData:self.userReadAttConfigData];
29 | }
30 |
31 | - (void)setUserReadAttConfig:(NSDictionary *)userReadAttConfig
32 | {
33 | self.userReadAttConfigData = [NSKeyedArchiver archivedDataWithRootObject:userReadAttConfig];
34 | }
35 |
36 | - (UIColor *)readBackColor
37 | {
38 | return [NSKeyedUnarchiver unarchiveObjectWithData:self.readBackColorData];
39 | }
40 |
41 | - (void)setReadBackColor:(UIColor *)readBackColor
42 | {
43 | self.readBackColorData = [NSKeyedArchiver archivedDataWithRootObject:readBackColor];
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookListView/BookInfoCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoCell.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/29.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookInfoModel.h"
11 | /* 书本信息cell*/
12 | @interface BookInfoCell : UITableViewCell
13 |
14 | @property (nonatomic,strong) BookInfoModel* model;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookListView/BookInfoCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoCell.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/29.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookInfoCell.h"
10 | #import
11 |
12 | @interface BookInfoCell()
13 | @property (weak, nonatomic) IBOutlet UIImageView *imageV;
14 | @property (weak, nonatomic) IBOutlet UILabel *bookNameLabel;
15 | @property (weak, nonatomic) IBOutlet UILabel *authorLabel;
16 | @property (weak, nonatomic) IBOutlet UILabel *descriptionLabel;
17 |
18 |
19 | @end
20 | @implementation BookInfoCell
21 | - (void)setModel:(BookInfoModel *)model
22 | {
23 | _model = model;
24 |
25 | if (!kStringIsEmpty(model.book_image)){
26 | [_imageV yy_setImageWithURL:[NSURL URLWithString:_model.book_image] placeholder:nil options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
27 | if (error){
28 | [self.imageV setImage:kGetImage(@"placeholder_empty")];
29 | }
30 | }];
31 | }
32 |
33 | _bookNameLabel.text = model.book_name;
34 | _authorLabel.text = model.author;
35 | _descriptionLabel.text = model.book_desc;
36 | }
37 |
38 | - (void)awakeFromNib
39 | {
40 | [super awakeFromNib];
41 |
42 | }
43 |
44 | - (void)drawRect:(CGRect)rect
45 | {
46 |
47 | }
48 |
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BarButtonView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BarButtonView.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/27.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /* toolbar按钮(上图下字)*/
12 | @interface BarButtonView : UIView
13 |
14 | - (instancetype)initWithImageName:(NSString*)imageName Title:(NSString*)title;
15 | - (void)changeImageName:(NSString*)imageName Title:(NSString*)title;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BarButtonView.m:
--------------------------------------------------------------------------------
1 | //
2 | // BarButtonView.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/27.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BarButtonView.h"
10 |
11 | @interface BarButtonView()
12 | @property (nonatomic,strong) UIImageView* imageV;
13 | @property (nonatomic,strong) UILabel* label;
14 | @end
15 | @implementation BarButtonView
16 |
17 | - (instancetype)initWithImageName:(NSString*)imageName Title:(NSString*)title
18 | {
19 | self = [super init];
20 | if (self){
21 | self.frame = CGRectMake(0, 0, 40, 40);
22 |
23 | UIImageView* imageV = [[UIImageView alloc] initWithImage:kGetImage(imageName)];
24 | [self addSubview:imageV];
25 | UILabel* label = [[UILabel alloc] init];
26 | label.font = [UIFont systemFontOfSize:11];
27 | label.text = title;
28 | label.textAlignment = NSTextAlignmentCenter;
29 | label.textColor = UIHexColor(0x696969);
30 | [self addSubview:label];
31 |
32 | imageV.frame = CGRectMake(12.5, 3, 15, 15);
33 | label.frame = CGRectMake(0, 18, 45, 20);
34 |
35 | self.imageV = imageV;
36 | self.label = label;
37 | }
38 | return self;
39 | }
40 |
41 | - (void)changeImageName:(NSString*)imageName Title:(NSString*)title
42 | {
43 | self.imageV.image = kGetImage(imageName);
44 | self.label.text = title;
45 | }
46 |
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BookChapterView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookChapterView.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/28.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookChapterModel.h"
11 |
12 | /* 目录界面*/
13 | typedef void (^select)(NSInteger index);
14 |
15 | @interface BookChapterView : UIView
16 |
17 | @property (nonatomic,copy) NSString* bookName;
18 |
19 | @property (nonatomic,strong) NSArray* chapters;
20 | @property (nonatomic,assign) BOOL isShowMulu;
21 | @property (nonatomic,assign) NSInteger currentIndex;
22 |
23 | @property (nonatomic,strong) select didSelectChapter;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BookReadTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadTextView.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /* 用于文本渲染的view*/
12 | @interface BookReadTextView : UIView
13 |
14 | /* 需要渲染的文本*/
15 | @property (nonatomic,copy) NSString* text;
16 | - (instancetype)initWithText:(NSString*)text;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BookReadTextView.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadTextView.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookReadTextView.h"
10 | #import
11 |
12 | @implementation BookReadTextView
13 |
14 | - (instancetype)initWithText:(NSString*)text
15 | {
16 | self = [super init];
17 | if (self){
18 | self.text = text;
19 | self.backgroundColor = HYUserDefault.readBackColor?:UIHexColor(0xa39e8b);
20 | }
21 | return self;
22 | }
23 |
24 | - (void)setText:(NSString *)text
25 | {
26 | _text = text;
27 | [self setNeedsDisplay];
28 | }
29 |
30 | - (void)drawRect:(CGRect)rect
31 | {
32 | [super drawRect:rect];
33 |
34 | CGContextRef context = UIGraphicsGetCurrentContext();
35 |
36 | /* 翻转坐标系*/
37 | CGContextSetTextMatrix(context, CGAffineTransformIdentity);
38 | CGContextTranslateCTM(context, 0, self.bounds.size.height);
39 | CGContextScaleCTM(context, 1.0, -1.0);
40 |
41 | NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:HYUserDefault.userReadAttConfig];
42 | if (HYUserDefault.isNightStyle){
43 | [dic setObject:UIHexColor(0x576071) forKey:NSForegroundColorAttributeName];
44 | }
45 |
46 | NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:self.text?:@"" attributes:dic];
47 |
48 | CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attrString);
49 | CGPathRef path = CGPathCreateWithRect(CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height), NULL);
50 | CTFrameRef frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(0, [attrString length]), path, NULL);
51 |
52 | /* 绘制文本*/
53 | CTFrameDraw(frame, context);
54 |
55 | CFRelease(frame);
56 | CFRelease(path);
57 | CFRelease(frameSetter);
58 | }
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookReadView/BookSetingView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSetingView.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/28.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | /* 设置界面*/
11 | typedef void (^reloadView)(void);
12 | @interface BookSetingView : UIView
13 |
14 | @property (nonatomic,strong) reloadView block;
15 | @property (nonatomic,strong) reloadView sliderValueBlock;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookSearchView/BookSearchHotView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSearchHotView.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/28.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /* 搜索热词的显示页面*/
12 | typedef void (^select)(NSString* title);
13 | @interface BookSearchHotView : UIView
14 |
15 | @property (nonatomic, strong) NSArray *historyWordsArr;
16 | @property (nonatomic,strong) select selectBlock;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/BookSearchView/BookSearchHotView.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookSearchHotView.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/28.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookSearchHotView.h"
10 |
11 | @interface BookSearchHotView()
12 | @property(nonatomic, strong) NSMutableArray *rowsContainer;
13 | @property(nonatomic, assign) CGFloat selfHeight;
14 | @property(nonatomic, assign) CGRect selfFrame;
15 |
16 | @end
17 | /// button 文字两边空隙
18 | CGFloat const btnEnhanceW = 18;
19 | /// button 左右之间间距
20 | CGFloat const btnMargin = 12;
21 | /// button 上下间距
22 | CGFloat const btnMarginTB = 10;
23 | /// button 高度
24 | CGFloat const btnH = 25;
25 |
26 | @implementation BookSearchHotView
27 |
28 | #pragma mark - Setter
29 |
30 | - (void)setHistoryWordsArr:(NSArray *)historyWordsArr {
31 | _historyWordsArr = historyWordsArr;
32 | [self.rowsContainer
33 | enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx,
34 | BOOL *_Nonnull stop) {
35 | [obj enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx,
36 | BOOL *_Nonnull stop) {
37 | [obj removeFromSuperview];
38 | }];
39 | }];
40 | [self.rowsContainer removeAllObjects];
41 |
42 | NSUInteger count = historyWordsArr.count;
43 | CGFloat tempSum = 0;
44 |
45 | NSMutableArray *btnsArr = [NSMutableArray array];
46 | [self.rowsContainer addObject:btnsArr];
47 |
48 | for (int i = 0; i < count; i++) {
49 | NSString *hitoryWord = historyWordsArr[i];
50 |
51 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
52 |
53 | [button setTitle:hitoryWord forState:UIControlStateNormal];
54 | [button addTarget:self
55 | action:@selector(keywordBtnDidClick:)
56 | forControlEvents:UIControlEventTouchUpInside];
57 | button.tag = 20;
58 | [button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
59 | button.backgroundColor = [UIColor whiteColor];
60 | [button.layer setBorderWidth:0.3];
61 | [button.layer setCornerRadius:5.0];
62 | [button.layer setBorderColor:[UIColor lightGrayColor].CGColor];
63 | [button sizeToFit];
64 | [self addSubview:button];
65 | CGFloat btnW = button.bounds.size.width + btnEnhanceW + btnMargin;
66 |
67 | tempSum += btnW;
68 |
69 | if (tempSum < self.bounds.size.width + btnMargin) {
70 | [btnsArr addObject:button];
71 | } else {
72 | tempSum = btnW;
73 | btnsArr = [NSMutableArray array];
74 | [btnsArr addObject:button];
75 | [_rowsContainer addObject:btnsArr];
76 | }
77 | }
78 |
79 | CGFloat btnY = 0;
80 | for (int index = 0; index < self.rowsContainer.count; index++) {
81 | NSArray *btnsArr = self.rowsContainer[index];
82 | if (index == 0) {
83 | btnY = 15;
84 | } else {
85 | btnY = 15 + (btnH + btnMarginTB) * index;
86 | }
87 | for (int i = 0; i < btnsArr.count; i++) {
88 |
89 | UIButton *button = (UIButton *)[btnsArr objectAtIndex:i];
90 | button.titleLabel.font = [UIFont systemFontOfSize:14];
91 | [button sizeToFit];
92 | if (i == 0) {
93 | button.frame =
94 | CGRectMake(20, btnY, button.bounds.size.width + btnEnhanceW, btnH);
95 | } else {
96 | button.frame =
97 | CGRectMake(CGRectGetMaxX(btnsArr[i - 1].frame) + btnMargin, btnY,
98 | button.bounds.size.width + btnEnhanceW, btnH);
99 | }
100 | if (index == self.rowsContainer.count - 1 && i == btnsArr.count - 1) {
101 | _selfHeight = CGRectGetMaxY(button.frame);
102 | [self setNeedsLayout];
103 | }
104 | }
105 | }
106 | }
107 | - (void)setFrame:(CGRect)frame {
108 | [super setFrame:frame];
109 | _selfFrame = frame;
110 | }
111 | #pragma mark - getter
112 |
113 | - (NSMutableArray *)rowsContainer {
114 | if (!_rowsContainer) {
115 | _rowsContainer = [[NSMutableArray alloc] init];
116 | }
117 | return _rowsContainer;
118 | }
119 | #pragma mark - private method
120 | - (void)keywordBtnDidClick:(UIButton *)sender {
121 | NSString *title = sender.titleLabel.text;
122 |
123 | if (self.selectBlock){
124 | self.selectBlock(title);
125 | }
126 | }
127 |
128 | - (void)layoutSubviews {
129 | [super layoutSubviews];
130 | self.frame = CGRectMake(_selfFrame.origin.x, _selfFrame.origin.y,
131 | _selfFrame.size.width, _selfHeight + 8);
132 | }
133 |
134 | @end
135 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/MainBookListView/MainBookInfoCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookInfoCell.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookSaveInfoModel.h"
11 |
12 | @interface MainBookInfoCell : UITableViewCell
13 |
14 | @property (nonatomic,strong) BookSaveInfoModel* model;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/MainBookListView/MainBookInfoCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookInfoCell.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "MainBookInfoCell.h"
10 | #import
11 |
12 | @interface MainBookInfoCell()
13 | @property (weak, nonatomic) IBOutlet UIImageView *bookImageV;
14 | @property (weak, nonatomic) IBOutlet UILabel *bookNameLabel;
15 | @property (weak, nonatomic) IBOutlet UILabel *bookRecordLabel;
16 |
17 | @end
18 | @implementation MainBookInfoCell
19 | - (void)setModel:(BookSaveInfoModel *)model
20 | {
21 | _model = model;
22 |
23 | [_bookImageV yy_setImageWithURL:[NSURL URLWithString:_model.bookInfo.book_image] placeholder:nil options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
24 | if (error){
25 | [self.bookImageV setImage:kGetImage(@"placeholder_empty")];
26 | }
27 | }];
28 |
29 |
30 | _bookNameLabel.text = _model.bookInfo.book_name;
31 | NSString* rc = _model.bookRecord.chapter_name?:@"还未开始阅读";
32 | _bookRecordLabel.text = [NSString stringWithFormat:@"已阅读到:%@",rc];
33 | }
34 |
35 | - (void)awakeFromNib
36 | {
37 | [super awakeFromNib];
38 |
39 | }
40 |
41 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
42 | {
43 | [super setSelected:selected animated:animated];
44 |
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/MainBookListView/MainBookRightCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookRightCell.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MainBookRightCell : UITableViewCell
12 |
13 | - (void)changeBackColor:(UIColor*)color Image:(UIImage*)image Name:(NSString*)name;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/MainBookListView/MainBookRightCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookRightCell.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "MainBookRightCell.h"
10 |
11 | @interface MainBookRightCell()
12 | @property (weak, nonatomic) IBOutlet UIView *imageBackView;
13 | @property (weak, nonatomic) IBOutlet UIImageView *imageV;
14 | @property (weak, nonatomic) IBOutlet UILabel *nameLabel;
15 |
16 |
17 | @end
18 | @implementation MainBookRightCell
19 | - (void)changeBackColor:(UIColor*)color Image:(UIImage*)image Name:(NSString*)name
20 | {
21 | self.imageBackView.backgroundColor = color;
22 | self.imageV.image = image;
23 | self.nameLabel.text = name;
24 | }
25 |
26 | - (void)awakeFromNib {
27 | [super awakeFromNib];
28 |
29 | self.imageBackView.layer.cornerRadius = 3;
30 | self.imageBackView.clipsToBounds = YES;
31 | }
32 |
33 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
34 | [super setSelected:selected animated:animated];
35 |
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/UnsplashImageView/Layout/HYFlowLayout.h:
--------------------------------------------------------------------------------
1 | //
2 | // HYFlowLayout.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface HYFlowLayout : UICollectionViewFlowLayout
14 |
15 | @property (nonatomic,assign) NSInteger colCount;
16 | /* 传入的sizeList应该是一个CGSize转换的NSValue的数组*/
17 | @property (nonatomic,strong) NSArray* sizeList;
18 |
19 | @property (nonatomic,assign) float itemMinHeight;
20 | @property (nonatomic,assign) float itemMaxHeight;
21 | @property (nonatomic,assign) UIEdgeInsets edgeInsets;
22 | @property (nonatomic,assign) CGSize headerSize;
23 |
24 | @end
25 |
26 | NS_ASSUME_NONNULL_END
27 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/UnsplashImageView/Layout/HYFlowLayout.m:
--------------------------------------------------------------------------------
1 | //
2 | // HYFlowLayout.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYFlowLayout.h"
10 | #import "HYHigherOrderFunc.h"
11 |
12 | @interface HYFlowLayout()
13 | @property (nonatomic,strong) NSMutableArray *dataArr;
14 | @property (nonatomic,strong) NSMutableArray *eachColumnMaxHight;
15 |
16 | @end
17 |
18 | @implementation HYFlowLayout
19 |
20 | -(void)prepareLayout
21 | {
22 | /* 清空之前计算的值*/
23 | self.dataArr = nil;
24 | self.eachColumnMaxHight = nil;
25 |
26 | if (_headerSize.height > 0){
27 | UICollectionViewLayoutAttributes * layoutHeader = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader withIndexPath:[NSIndexPath indexPathWithIndex:0]];
28 | layoutHeader.frame = CGRectMake(0,0, _headerSize.width, _headerSize.height);
29 | [self.dataArr addObject:layoutHeader];
30 | }
31 |
32 | NSInteger itemNum= [self.collectionView numberOfItemsInSection:0];
33 | for (NSInteger i = 0; i < itemNum; i++) {
34 |
35 | NSIndexPath *indexpath = [NSIndexPath indexPathForItem:i inSection:0];
36 | UICollectionViewLayoutAttributes *attr = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexpath];
37 |
38 | CGFloat contentW = self.collectionView.bounds.size.width - self.sectionInset.left - self.sectionInset.right;
39 | CGFloat itemW = (contentW - (self.colCount - 1) * self.minimumInteritemSpacing - _edgeInsets.left - _edgeInsets.right) / self.colCount;
40 |
41 | CGSize iSize = [(NSValue*)self.sizeList[i] CGSizeValue];
42 | CGFloat itemH = itemW * ((float)iSize.height /(float)iSize.width);
43 |
44 | if (_itemMinHeight > 0 && itemH < _itemMinHeight)
45 | itemH = _itemMinHeight;
46 |
47 | if (_itemMaxHeight > 0 && itemH > _itemMaxHeight)
48 | itemH = _itemMaxHeight;
49 |
50 | /* 选择行数的时候,优先选择当前行高较为低的一列*/
51 | NSInteger colNum = 0;
52 | float maxH = MAXFLOAT;
53 | for (NSInteger i = 0; i < _eachColumnMaxHight.count; i++) {
54 | NSNumber* num = _eachColumnMaxHight[i];
55 | if (num.floatValue < maxH){
56 | maxH = num.floatValue;
57 | colNum = i;
58 | }
59 | }
60 |
61 | CGFloat itemX = self.sectionInset.left + (itemW + self.minimumInteritemSpacing) * colNum;
62 | CGFloat itemY = [self.eachColumnMaxHight[colNum] floatValue];
63 |
64 | if (itemY == 0){
65 | itemY += _edgeInsets.top;
66 | if (_headerSize.height > 0)
67 | itemY += _headerSize.height;
68 | }
69 |
70 | attr.frame = CGRectMake(itemX, itemY, itemW, itemH);
71 |
72 | self.eachColumnMaxHight[colNum] = @(itemY + itemH + self.minimumLineSpacing);
73 | [self.dataArr addObject:attr];
74 | }
75 | }
76 |
77 | -(CGSize)collectionViewContentSize
78 | {
79 | NSInteger maxCol = [self calculateMaxHeightCol];
80 | CGFloat insetsTop = _edgeInsets.top;
81 | CGFloat insetsBot = _edgeInsets.bottom;
82 | return CGSizeMake(0, [self.eachColumnMaxHight[maxCol] floatValue] - self.minimumLineSpacing + insetsTop + insetsBot);
83 | }
84 |
85 | -(NSInteger)calculateMaxHeightCol
86 | {
87 | NSInteger maxCol = 0;
88 | CGFloat maxHeight = 0;
89 |
90 | for (NSInteger i = 0; i < self.colCount; i++) {
91 | if (maxHeight < [self.eachColumnMaxHight[i] floatValue]) {
92 | maxHeight = [self.eachColumnMaxHight[i] floatValue];
93 | maxCol = i;
94 | }
95 | }
96 | return maxCol;
97 | }
98 |
99 | -(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
100 | {
101 | return self.dataArr;
102 | }
103 |
104 | #pragma mark - lazyload
105 | -(NSMutableArray *)dataArr
106 | {
107 | if (_dataArr == nil) {
108 | _dataArr = [NSMutableArray array];
109 | }
110 | return _dataArr;
111 | }
112 |
113 | - (NSMutableArray *)eachColumnMaxHight
114 | {
115 | if (_eachColumnMaxHight == nil) {
116 | _eachColumnMaxHight = [NSMutableArray arrayWithCapacity:self.colCount];
117 | for (NSInteger i = 0; i < self.colCount; i++) {
118 | _eachColumnMaxHight[i] = @(self.sectionInset.top);
119 | }
120 | }
121 | return _eachColumnMaxHight;
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/UnsplashImageView/UnsplashImageCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashImageCell.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UnsplashImageModel.h"
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface UnsplashImageCell : UICollectionViewCell
15 |
16 | @property (nonatomic,strong) UnsplashImageModel* model;
17 | - (BOOL)reloadImage;
18 |
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/Book_Reader/Main/View/UnsplashImageView/UnsplashImageCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashImageCell.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "UnsplashImageCell.h"
10 | #import
11 | #import "UIColor+random.h"
12 |
13 | @interface UnsplashImageCell()
14 | @property (weak, nonatomic) IBOutlet UIImageView *imageV;
15 | @property (weak, nonatomic) IBOutlet UIView *backView;
16 | @property (weak, nonatomic) IBOutlet UIView *loadFailView;
17 | @property (weak, nonatomic) IBOutlet UILabel *loadFailLabel;
18 |
19 | @end
20 |
21 | @implementation UnsplashImageCell
22 |
23 | - (void)setModel:(UnsplashImageModel *)model
24 | {
25 | _model = model;
26 |
27 | [self loadImage];
28 | }
29 |
30 | - (void)loadImage
31 | {
32 | self.loadFailView.hidden = YES;
33 |
34 | NSString* url = [_model.urls objectForKey:@"small"];
35 |
36 | _imageV.image = nil;
37 | [_imageV yy_setImageWithURL:[NSURL URLWithString:url] placeholder:nil options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
38 | if (error){
39 | self.imageV.image = nil;
40 | self.loadFailView.hidden = NO;
41 | }
42 | }];
43 | }
44 |
45 | - (BOOL)reloadImage
46 | {
47 | if (!self.loadFailView.hidden){
48 | self.loadFailView.hidden = YES;
49 |
50 | [self loadImage];
51 |
52 | return YES;
53 | }
54 |
55 | return NO;
56 | }
57 |
58 | - (void)awakeFromNib {
59 | [super awakeFromNib];
60 |
61 | self.backView.layer.cornerRadius = 5;
62 | self.loadFailView.layer.cornerRadius = 5;
63 | self.backView.clipsToBounds = YES;
64 | self.backView.backgroundColor = [UIColor randomLightColor];
65 | }
66 |
67 | - (IBAction)reloadTap:(UITapGestureRecognizer *)sender
68 | {
69 | [self loadImage];
70 | }
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookInfoVC/BookInfoVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookInfoVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/29.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 | #import "BookInfoModel.h"
11 |
12 | /* 书本详情页面*/
13 | @interface BookInfoVC : HYBaseViewController
14 |
15 | - (instancetype)initWithModel:(BookInfoModel*)model;
16 |
17 | /* 标记字段,当从作者列表跳转过来时,在点击作者名时返回而不是跳转*/
18 | @property (nonatomic,copy) NSString* author;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookReadVC/BookReadContentVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadContentVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /* 阅读界面中的"一页"*/
12 | @interface BookReadContentVC : UIViewController
13 |
14 | /* 该"页"需要显示的文本内容*/
15 | @property (nonatomic,copy) NSString* text;
16 | /* 章节名称*/
17 | @property (nonatomic,copy) NSString* chapterName;
18 | /* 总页数*/
19 | @property (nonatomic,assign) NSInteger totalNum;
20 | /* 当前页数*/
21 | @property (nonatomic,assign) NSInteger index;
22 |
23 | - (instancetype)initWithText:(NSString*)text
24 | chapterName:(NSString*)chapterName
25 | totalNum:(NSInteger)totalNum
26 | index:(NSInteger)index;
27 |
28 | @property (nonatomic,strong,readonly) UIViewController* backVC;
29 | @end
30 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookReadVC/BookReadVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | //#import "HYBaseViewController.h"
10 | #import
11 | #import "BookReadVMDelegate.h"
12 |
13 | /* 阅读界面*/
14 | @interface BookReadVC : UIViewController
15 | /* ViewModel*/
16 | @property (nonatomic,strong) id viewModel;
17 |
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookReadVC/PageVC/BookPageVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookPageVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/2/20.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | typedef void (^touchBlock)(void);
14 | @interface BookPageVC : UIPageViewController
15 |
16 | @property (nonatomic, strong) touchBlock block;
17 |
18 | @end
19 |
20 | NS_ASSUME_NONNULL_END
21 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookReadVC/PageVC/BookPageVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookPageVC.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/2/20.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookPageVC.h"
10 |
11 | @interface BookPageVC ()
12 |
13 | @end
14 |
15 | @implementation BookPageVC
16 |
17 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
18 | {
19 | CGPoint point = [[touches anyObject] locationInView:self.view];
20 | CGRect center = CGRectMake(kScreenWidth/3, 0, kScreenWidth/3, kScreenHeight);
21 |
22 | if (CGRectContainsPoint(center, point)){
23 | if (_block){
24 | _block();
25 | }
26 | }
27 | }
28 |
29 | - (void)viewDidLoad
30 | {
31 | [super viewDidLoad];
32 |
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookSearchListVC/BookSearchListVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSearchListVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/29.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 |
11 | /* 展示搜索结果的页面*/
12 | @interface BookSearchListVC : HYBaseViewController
13 |
14 | /* 根据书名关键字进行搜索*/
15 | - (instancetype)initWithKeyWord:(NSString*)kw;
16 |
17 | /* 根据分类名称进行搜索*/
18 | - (instancetype)initWithSortName:(NSString*)sort;
19 |
20 | /* 根据作者名称进行搜索*/
21 | - (instancetype)initWithAuthorName:(NSString*)author;
22 |
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookSearchVC/BookSearchVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSearchVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/28.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 |
11 | /* 书本搜索页面*/
12 | @interface BookSearchVC : HYBaseViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookSortVC/BookSortVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookSortVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/20.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 |
11 | /* 书本分类列表界面*/
12 | @interface BookSortVC : HYBaseViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/BookSortVC/BookSortVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookSortVC.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/20.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookSortVC.h"
10 | #import "UIImage+Color.h"
11 | #import "HYBookAPIs.h"
12 | #import "BookSearchListVC.h"
13 |
14 | @interface BookSortVC ()
15 | @property (nonatomic,strong) HYBookAPIs* bookAPI;
16 | @property (nonatomic,strong) UITableView* tableView;
17 | @property (nonatomic,strong) NSArray* dataArr;
18 | @end
19 |
20 | @implementation BookSortVC
21 |
22 | - (void)viewDidLoad
23 | {
24 | [super viewDidLoad];
25 |
26 | [self initialNavi];
27 | [self initialSubViews];
28 | [self initialData];
29 | }
30 |
31 | - (void)initialNavi
32 | {
33 | self.navigationItem.title = @"分类";
34 |
35 | self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
36 | [self.navigationController.navigationBar setShadowImage:[UIImage new]];
37 | [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:UIHexColor(0xa60014)] forBarMetrics:UIBarMetricsDefault];
38 | self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
39 |
40 | UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithImage:kGetImage(@"navi_backbtnImage_white") style:UIBarButtonItemStylePlain target:self action:@selector(leftBarItemClick)];
41 | item.tintColor = [UIColor whiteColor];
42 | self.navigationItem.leftBarButtonItem = item;
43 | }
44 |
45 | - (void)initialSubViews
46 | {
47 | self.view.backgroundColor = [UIColor whiteColor];
48 |
49 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
50 | _tableView.delegate = self;
51 | _tableView.dataSource = self;
52 | [self.view addSubview:_tableView];
53 |
54 | [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
55 | make.top.left.right.bottom.mas_equalTo(0);
56 | }];
57 | }
58 |
59 | - (void)initialData
60 | {
61 | self.bookAPI = [[HYBookAPIs alloc] init];
62 |
63 | [MBProgressHUD showMessage:@"搜索中" toView:self.view];
64 |
65 | [self.bookAPI searchBookSortWithSuccess:^(NSArray *array) {
66 | [MBProgressHUD hideHUDForView:self.view];
67 | self.dataArr = [NSArray arrayWithArray:array];
68 | [self.tableView reloadData];
69 | } Fail:^(NSError *err) {
70 | [MBProgressHUD hideHUDForView:self.view];
71 | [MBProgressHUD showError:@"搜索错误" toView:self.view];
72 | }];
73 | }
74 |
75 | #pragma mark - target
76 | - (void)leftBarItemClick
77 | {
78 | if (![self.navigationController popViewControllerAnimated:YES]){
79 | [self dismissViewControllerAnimated:YES completion:nil];
80 | }
81 | }
82 |
83 | #pragma mark - UITableViewDataSource
84 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
85 | {
86 | return self.dataArr.count;
87 | }
88 |
89 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
90 | {
91 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"sort_cell"];
92 | if (!cell){
93 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"sort_cell"];
94 | }
95 |
96 | if (indexPath.row
16 | @property (nonatomic,strong) UITableView* tableView;
17 | @property (nonatomic,strong) NSMutableArray* dataArray;
18 | @property (nonatomic,strong) HYDatabase* database;
19 | @property (nonatomic,strong) HYBookAPIs* bookApi;
20 |
21 | @end
22 |
23 | @implementation BookSourceListVC
24 | - (instancetype)initWithModel:(BookInfoModel*)model
25 | {
26 | self = [super init];
27 | if (self){
28 | self.mode = model;
29 | }
30 | return self;
31 | }
32 |
33 | - (void)viewDidLoad
34 | {
35 | [super viewDidLoad];
36 |
37 | [self initialNavi];
38 | [self initialSubViews];
39 | [self initialData];
40 | }
41 |
42 | - (void)initialNavi
43 | {
44 | self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
45 | [self.navigationController.navigationBar setShadowImage:[UIImage new]];
46 | self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
47 |
48 | UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithImage:kGetImage(@"navi_backbtnImage_white") style:UIBarButtonItemStylePlain target:self action:@selector(leftBarItemClick)];
49 | item.tintColor = [UIColor whiteColor];
50 | self.navigationItem.leftBarButtonItem = item;
51 |
52 | self.navigationItem.title = [NSString stringWithFormat:@"%@书源",_mode.book_name];
53 | }
54 |
55 | - (void)initialSubViews
56 | {
57 | self.view.backgroundColor = [UIColor whiteColor];
58 |
59 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
60 | _tableView.delegate = self;
61 | _tableView.dataSource = self;
62 | [self.view addSubview:_tableView];
63 |
64 |
65 | [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
66 | make.top.left.right.bottom.mas_equalTo(0);
67 | }];
68 |
69 | }
70 |
71 | - (void)initialData
72 | {
73 | self.database = [HYDatabase sharedDatabase];
74 | self.bookApi = [[HYBookAPIs alloc] init];
75 |
76 | BookInfoModel* dbModel = [self.database selectBookInfoWithRelatedId:self.mode.related_id];
77 | if (!dbModel){
78 | [MBProgressHUD showError:@"加入书架后才能开启换源功能~" toView:self.view];
79 | return;
80 | }
81 |
82 | [MBProgressHUD showMessage:@"书源搜索中" toView:self.view];
83 | [self.bookApi searchBookSourceWithRelatedId:_mode.related_id Success:^(NSArray *models) {
84 | [MBProgressHUD hideHUDForView:self.view];
85 | self.dataArray = [NSMutableArray arrayWithArray:models];
86 | [self.tableView reloadData];
87 | } Fail:^(NSError *err) {
88 | [MBProgressHUD hideHUDForView:self.view];
89 | [MBProgressHUD showError:@"书源搜索错误" toView:self.view];
90 | }];
91 | }
92 |
93 | #pragma mark - target
94 | - (void)leftBarItemClick
95 | {
96 | if (![self.navigationController popViewControllerAnimated:YES]){
97 | [self dismissViewControllerAnimated:YES completion:nil];
98 | }
99 | }
100 |
101 | #pragma mark - UITableViewDataSource
102 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
103 | {
104 | return self.dataArray.count;
105 | }
106 |
107 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
108 | {
109 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"source_cell"];
110 | if (!cell){
111 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"source_cell"];
112 | }
113 |
114 | BooksourceModel* model = self.dataArray[indexPath.row];
115 | if ([model.source_name isEqualToString:_mode.source_name]){
116 | cell.textLabel.text = [NSString stringWithFormat:@"%@(当前源)",model.source_name];
117 | cell.textLabel.textColor = [UIColor redColor];
118 | }
119 | else{
120 | cell.textLabel.text = model.source_name;
121 | cell.textLabel.textColor = [UIColor blackColor];
122 | }
123 | cell.textLabel.font = [UIFont systemFontOfSize:15];
124 | cell.detailTextLabel.font = [UIFont systemFontOfSize:11];
125 | cell.detailTextLabel.text = [NSString stringWithFormat:@"最新章节:%@",model.book_last_chapter];
126 | cell.selectionStyle = UITableViewCellSelectionStyleNone;
127 | return cell;
128 | }
129 |
130 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
131 | {
132 | BooksourceModel* model = self.dataArray[indexPath.row];
133 | if ([model.source_name isEqualToString:_mode.source_name])
134 | [self leftBarItemClick];
135 | else{
136 | [self.database updateBookSourceWithRelatedId:_mode.related_id Name:model.source_name SourceUrl:model.book_url];
137 | if (self.block){
138 | self.block();
139 | }
140 | [self leftBarItemClick];
141 | }
142 | }
143 |
144 |
145 | @end
146 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/MainBookListVC/MainBookListVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookListVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 |
11 | /* 展示收藏书籍的"首页"*/
12 | @interface MainBookListVC : HYBaseViewController
13 |
14 |
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/MainBookListVC/MainBookRightVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookRightVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "HYBaseViewController.h"
10 |
11 |
12 | @interface MainBookRightVC : HYBaseViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/MainBookListVC/MainBookRightVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // MainBookRightVC.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/7/3.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "MainBookRightVC.h"
10 | #import "MainBookRightCell.h"
11 | #import "BookSearchVC.h"
12 | #import "BookSortVC.h"
13 | #import "HYBookAPIs.h"
14 | #import "BookReadAPIVM.h"
15 | #import "BookReadVC.h"
16 | #import "UnsplashImageVC.h"
17 |
18 | @interface MainBookRightVC ()
19 | @property (nonatomic,strong) UITableView* tableView;
20 | @property (nonatomic,strong) HYBookAPIs* bookApi;
21 | @end
22 |
23 | @implementation MainBookRightVC
24 |
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 |
28 | [self initialSubViews];
29 | [self initialData];
30 | }
31 |
32 | - (void)initialSubViews
33 | {
34 | self.view.backgroundColor = UIHexColor(0x1b1b1b);
35 |
36 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
37 | _tableView.delegate = self;
38 | _tableView.dataSource = self;
39 | _tableView.separatorColor = UIHexColor(0x1b1b1b);
40 | _tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
41 | _tableView.backgroundColor = UIHexColor(0x1b1b1b);
42 | [self.view addSubview:_tableView];
43 |
44 | [_tableView registerNib:kRegisterNib(@"MainBookRightCell") forCellReuseIdentifier:@"MainBookRightCell"];
45 |
46 | [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
47 | make.left.right.bottom.mas_equalTo(0);
48 | make.top.mas_equalTo(40);
49 | }];
50 | }
51 |
52 | - (void)initialData
53 | {
54 | self.bookApi = [[HYBookAPIs alloc] init];
55 | }
56 |
57 | - (UIStatusBarStyle)preferredStatusBarStyle
58 | {
59 | return UIStatusBarStyleLightContent;
60 | }
61 |
62 | #pragma mark - UITableViewDataSource
63 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
64 | {
65 | return 5;
66 | }
67 |
68 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
69 | {
70 | MainBookRightCell* cell = [tableView dequeueReusableCellWithIdentifier:@"MainBookRightCell"];
71 |
72 | switch (indexPath.row) {
73 | case 0:
74 | [cell changeBackColor:[UIColor whiteColor] Image:kGetImage(@"main_search") Name:@"搜索"];
75 | break;
76 | case 1:
77 | [cell changeBackColor:UIHexColor(0xff0035) Image:kGetImage(@"main_paihang") Name:@"排行榜"];
78 | break;
79 | case 2:
80 | [cell changeBackColor:UIHexColor(0x40b0df) Image:kGetImage(@"main_fenlei") Name:@"分类"];
81 | break;
82 | case 3:
83 | [cell changeBackColor:UIHexColor(0x679f37) Image:kGetImage(@"main_random") Name:@"随机看书"];
84 | break;
85 | case 4:
86 | [cell changeBackColor:UIHexColor(0xff0035) Image:kGetImage(@"main_unsplash ") Name:@"unsplash"];
87 | break;
88 | default:
89 | break;
90 | }
91 |
92 | return cell;
93 | }
94 |
95 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
96 | {
97 | return 50;
98 | }
99 |
100 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
101 | {
102 | UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
103 | [cell setSelected:NO animated:YES];
104 |
105 | if (indexPath.row==0){
106 | BookSearchVC* vc = [[BookSearchVC alloc] init];
107 | UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc];
108 | [self pushPresentViewController:navi];
109 | }else if (indexPath.row==2){
110 | BookSortVC* vc = [[BookSortVC alloc] init];
111 | UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc];
112 | [self pushPresentViewController:navi];
113 | }else if (indexPath.row==3){
114 | [MBProgressHUD showMessage:@"随机找书中~" toView:self.view];
115 | [self.bookApi randomSearchBookInfoWithSuccess:^(BookInfoModel *book) {
116 | [MBProgressHUD hideHUDForView:self.view];
117 |
118 | BookReadAPIVM* vm = [[BookReadAPIVM alloc] initWithBookModel:book];
119 | BookReadVC* vc = [[BookReadVC alloc] init];
120 | vc.viewModel = vm;
121 |
122 | UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc];
123 | [self pushPresentWithOutSwipeViewController:navi];
124 |
125 | } Fail:^(NSError *err) {
126 | [MBProgressHUD hideHUDForView:self.view];
127 | [MBProgressHUD showError:@"没找到书~再试一下" toView:self.view];
128 | }];
129 | }else if (indexPath.row==4){
130 | UnsplashImageVC* vc = [[UnsplashImageVC alloc] init];
131 | UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc];
132 | [self pushPresentViewController:navi];
133 | }
134 |
135 | }
136 |
137 | @end
138 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/UnsplashImageVC/UnsplashImageVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashImageVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/4.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface UnsplashImageVC : UIViewController
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewController/UnsplashSearchVC/UnsplashSearchVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // UnsplashSearchVC.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2019/3/5.
6 | // Copyright © 2019 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface UnsplashSearchVC : UISearchController
14 |
15 | - (void)reloadView;
16 |
17 | @end
18 |
19 | NS_ASSUME_NONNULL_END
20 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewModel/BookReadVM/BookReadAPIVM/BookReadAPIVM.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadAPIVM.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BookReadVMDelegate.h"
11 | #import "BookInfoModel.h"
12 |
13 | /* 网络接口API书源ViewModel*/
14 | @interface BookReadAPIVM : NSObject
15 |
16 | /* 从书本model初始化*/
17 | - (instancetype)initWithBookModel:(BookInfoModel*)model;
18 | @property (nonatomic,strong,readonly) BookInfoModel* model;
19 |
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewModel/BookReadVM/BookReadLocalVM/BookReadLocalVM.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadLocalVM.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /* 本地书源或网络下载书源的ViewModel*/
12 | @interface BookReadLocalVM : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewModel/BookReadVM/BookReadLocalVM/BookReadLocalVM.m:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadLocalVM.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookReadLocalVM.h"
10 |
11 | @implementation BookReadLocalVM
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Book_Reader/Main/ViewModel/BookReadVM/BookReadVMDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // BookReadVMDelegate.h
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/26.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import "BookInfoModel.h"
10 |
11 | #ifndef BookReadVMDelegate_h
12 | #define BookReadVMDelegate_h
13 |
14 | typedef void (^block)(void);
15 | typedef void (^LoadSuccess)(UIViewController* currentVC);
16 | typedef void (^Fail)(NSError* err);
17 |
18 | typedef void (^HubSuccess)(NSString* text);
19 | typedef void (^HubFail)(NSString* text);
20 |
21 | @protocol BookReadVMDelegate
22 | @required
23 |
24 | /* 开始初始化*/
25 | - (void)startInit;
26 |
27 | /* 获取前一个界面*/
28 | - (UIViewController*)viewControllerBeforeViewController:(UIViewController *)viewController DoubleSided:(BOOL)doubleSided;
29 |
30 | /* 获取后一界面*/
31 | - (UIViewController*)viewControllerAfterViewController:(UIViewController *)viewController DoubleSided:(BOOL)doubleSided;
32 |
33 | /* 按照序号加载章节*/
34 | - (void)loadChapterWithIndex:(NSInteger)index;
35 |
36 | /* 获取书名*/
37 | - (NSString*)getBookName;
38 |
39 | /* 获取所有的章节名称*/
40 | - (NSArray*)getAllChapters;
41 |
42 | /* 获取当前章节的index*/
43 | - (NSInteger)getCurrentChapterIndex;
44 |
45 | - (NSInteger)getCurrentVCIndexWithVC:(UIViewController*)vc;
46 | - (NSInteger)getCurrentVCIndex;
47 |
48 | /* 刷新所有页面*/
49 | - (void)reloadContentViews;
50 |
51 | #pragma mark - 用于viewmodel与vc的反向交互
52 | /**
53 | * 初始化
54 | * 该方法在ReadVC开始加载某一章节时调用
55 | */
56 | - (void)startLoadData:(block)block;
57 |
58 | /**
59 | * 该方法给VM传入block,用于VM与VC的方向交互
60 | */
61 | - (void)loadDataWithSuccess:(LoadSuccess)success Fail:(Fail)fail;
62 |
63 | /**
64 | * 该方法用于VM控制VC显示相对应的hub
65 | */
66 | - (void)showHubWithSuccess:(HubSuccess)success Fail:(HubSuccess)fail;
67 |
68 | @optional
69 | /* 获取所有的界面*/
70 | - (NSArray *)viewModelGetAllVCs;
71 |
72 | /* 获取书本信息model*/
73 | - (BookInfoModel*)getBookInfoModel;
74 |
75 | /* 删除当前章节的缓存*/
76 | - (void)deleteChapterSave;
77 |
78 | /* 删除全书章节缓存*/
79 | - (void)deleteBookChapterSave;
80 |
81 |
82 | @end
83 |
84 |
85 | #endif /* BookReadVMDelegate_h */
86 |
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-Spotlight-40.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-60.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-Small@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-Small@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-Spotlight-40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-Spotlight-40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-Spotlight-40@3x-1.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-60@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "size" : "1024x1024",
53 | "idiom" : "ios-marketing",
54 | "filename" : "icon_1024.png",
55 | "scale" : "1x"
56 | }
57 | ],
58 | "info" : {
59 | "version" : 1,
60 | "author" : "xcode"
61 | }
62 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-60.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x-1.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/Assets.xcassets/AppIcon.appiconset/icon_1024.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_ascending.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "mulu_ascending.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_ascending.imageset/mulu_ascending.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_ascending.imageset/mulu_ascending.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_descending.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "mulu_descending.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_descending.imageset/mulu_descending.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/mulu_descending.imageset/mulu_descending.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_color_select.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "setting_color_select.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_color_select.imageset/setting_color_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_color_select.imageset/setting_color_select.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_l.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "setting_sun_l.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_l.imageset/setting_sun_l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_l.imageset/setting_sun_l.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_s.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "setting_sun_s.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_s.imageset/setting_sun_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/setting_sun_s.imageset/setting_sun_s.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_1.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "space_1.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_1.imageset/space_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_1.imageset/space_1.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "space_2.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_2.imageset/space_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_2.imageset/space_2.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_3.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "space_3.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_3.imageset/space_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/space_3.imageset/space_3.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_caching.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "toolbar_caching.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_caching.imageset/toolbar_caching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_caching.imageset/toolbar_caching.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_day.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "toolbar_day.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_day.imageset/toolbar_day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_day.imageset/toolbar_day.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_feedback.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "toolbar_feedback.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_feedback.imageset/toolbar_feedback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_feedback.imageset/toolbar_feedback.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_mulu.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "toolbar_mulu.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_mulu.imageset/toolbar_mulu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_mulu.imageset/toolbar_mulu.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_night.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "toolbar_night.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_night.imageset/toolbar_night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_night.imageset/toolbar_night.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_setting.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "toolbar_setting.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_setting.imageset/toolbar_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/BookReadVC/toolbar_setting.imageset/toolbar_setting.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_fenlei.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "main_fenlei.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_fenlei.imageset/main_fenlei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_fenlei.imageset/main_fenlei.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_paihang.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "main_paihang.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_paihang.imageset/main_paihang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_paihang.imageset/main_paihang.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_random.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "main_random.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_random.imageset/main_random.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_random.imageset/main_random.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_search.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "main_search.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_search.imageset/main_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_search.imageset/main_search.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_showright.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "main_showright.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_showright.imageset/main_showright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_showright.imageset/main_showright.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_unsplash .imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "main_unsplash .png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/MainVC/main_unsplash .imageset/main_unsplash .png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/MainVC/main_unsplash .imageset/main_unsplash .png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/HomeView_navi_back.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "HomeView_navi_back.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/HomeView_navi_back.imageset/HomeView_navi_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/HomeView_navi_back.imageset/HomeView_navi_back.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "back.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage.imageset/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage.imageset/back.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_black.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "Navi_backImage_black.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_black.imageset/Navi_backImage_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_black.imageset/Navi_backImage_black.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_blue.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "Navi_backImage_blue.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_blue.imageset/Navi_backImage_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_blue.imageset/Navi_backImage_blue.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_white.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "navi_back_white.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_white.imageset/navi_back_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/Navi_backImage_white.imageset/navi_back_white.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/grade_line.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "grade_line.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/grade_line.imageset/grade_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/grade_line.imageset/grade_line.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/navi_backbtnImage_white.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x"
10 | },
11 | {
12 | "idiom" : "universal",
13 | "filename" : "navi_backImage_white.png",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/navi_backbtnImage_white.imageset/navi_backImage_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/navi_backbtnImage_white.imageset/navi_backImage_white.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/navi_head.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "navi_head@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "navi_head@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/navi_head.imageset/navi_head@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/navi_head.imageset/navi_head@2x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/Navi/navi_head.imageset/navi_head@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/Navi/navi_head.imageset/navi_head@3x.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/author.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "author.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/author.imageset/author.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/SearchVC/author.imageset/author.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/book.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "book.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/book.imageset/book.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/SearchVC/book.imageset/book.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/delete.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "delete.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/delete.imageset/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/SearchVC/delete.imageset/delete.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_empty.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "placeholder_empty.jpg",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_empty.imageset/placeholder_empty.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_empty.imageset/placeholder_empty.jpg
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_loding.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "placeholder_loding.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_loding.imageset/placeholder_loding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hhuua123/Book_Reader/b537bfa7cf6318413e040e31b3f97f60fec3b30d/Book_Reader/Resource/image/images.xcassets/SearchVC/placeholder_loding.imageset/placeholder_loding.png
--------------------------------------------------------------------------------
/Book_Reader/Resource/public/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | #import "MBProgressHUD+NJ.h"
13 | #import "NSDate+Utils.h"
14 | #import "UIView+HYView.h"
15 | #import "HYMacros.h"
16 | #import "HYRegulaStrMacro.h"
17 | #import "GVUserDefaults+HYUserDefaults.h"
18 | #import "HYNotificationMacros.h"
19 | #import
20 |
21 |
22 | #endif /* PrefixHeader_pch */
23 |
--------------------------------------------------------------------------------
/Book_Reader/Vender/GVUserDefaults/GVUserDefaults.h:
--------------------------------------------------------------------------------
1 | //
2 | // GVUserDefaults.h
3 | // GVUserDefaults
4 | //
5 | // Created by Kevin Renskers on 18-12-12.
6 | // Copyright (c) 2012 Gangverk. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GVUserDefaults : NSObject
12 |
13 | + (instancetype)standardUserDefaults;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Book_Reader/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIPlaceHolderTextView.h
3 | // MobileProject 带有提示输入的TextView
4 | //
5 | // Created by wujunyang on 16/1/14.
6 | // Copyright © 2016年 wujunyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIPlaceHolderTextView : UITextView
12 | @property (nonatomic, strong) NSString *placeholder;
13 | @property (nonatomic, strong) UIColor *placeholderColor;
14 |
15 | -(void)textChanged:(NSNotification*)notification;
16 | @end
17 |
--------------------------------------------------------------------------------
/Book_Reader/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIPlaceHolderTextView.m
3 | // MobileProject
4 | //
5 | // Created by wujunyang on 16/1/14.
6 | // Copyright © 2016年 wujunyang. All rights reserved.
7 | //
8 |
9 | #import "UIPlaceHolderTextView.h"
10 |
11 | @interface UIPlaceHolderTextView()
12 | @property (nonatomic, strong) UILabel *placeHolderLabel;
13 | @end
14 |
15 | @implementation UIPlaceHolderTextView
16 | CGFloat const UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION = 0.25;
17 |
18 | - (void)dealloc
19 | {
20 | [[NSNotificationCenter defaultCenter] removeObserver:self];
21 | #if __has_feature(objc_arc)
22 | #else
23 | [_placeHolderLabel release]; _placeHolderLabel = nil;
24 | [_placeholderColor release]; _placeholderColor = nil;
25 | [_placeholder release]; _placeholder = nil;
26 | [super dealloc];
27 | #endif
28 | }
29 |
30 | - (void)awakeFromNib
31 | {
32 | [super awakeFromNib];
33 |
34 | if (!self.placeholder) {
35 | _placeholder = @"";
36 | }
37 |
38 | if (!self.placeholderColor) {
39 | [self setPlaceholderColor:[UIColor lightGrayColor]];
40 | }
41 |
42 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil];
43 | }
44 |
45 | - (id)initWithFrame:(CGRect)frame
46 | {
47 | if( (self = [super initWithFrame:frame]) )
48 | {
49 | _placeholder = @"";
50 | [self setPlaceholderColor:[UIColor lightGrayColor]];
51 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil];
52 | }
53 | return self;
54 | }
55 |
56 | - (void)textChanged:(NSNotification *)notification
57 | {
58 | if([[self placeholder] length] == 0)
59 | {
60 | return;
61 | }
62 |
63 | [UIView animateWithDuration:UI_PLACEHOLDER_TEXT_CHANGED_ANIMATION_DURATION animations:^{
64 | if([[self text] length] == 0)
65 | {
66 | [[self viewWithTag:999] setAlpha:1];
67 | }
68 | else
69 | {
70 | [[self viewWithTag:999] setAlpha:0];
71 | }
72 | }];
73 | }
74 |
75 | - (void)setText:(NSString *)text {
76 | [super setText:text];
77 | [self textChanged:nil];
78 | }
79 |
80 | - (void)drawRect:(CGRect)rect
81 | {
82 | if( [[self placeholder] length] > 0 )
83 | {
84 | UIEdgeInsets insets = self.textContainerInset;
85 | if (_placeHolderLabel == nil )
86 | {
87 |
88 | _placeHolderLabel = [[UILabel alloc] initWithFrame:CGRectMake(insets.left+5,insets.top,self.bounds.size.width - (insets.left +insets.right+10),1.0)];
89 | _placeHolderLabel.lineBreakMode = NSLineBreakByWordWrapping;
90 | _placeHolderLabel.font = self.font;
91 | _placeHolderLabel.backgroundColor = [UIColor clearColor];
92 | _placeHolderLabel.textColor = self.placeholderColor;
93 | _placeHolderLabel.alpha = 0;
94 | _placeHolderLabel.tag = 999;
95 | [self addSubview:_placeHolderLabel];
96 | }
97 | _placeHolderLabel.text = self.placeholder;
98 | [_placeHolderLabel sizeToFit];
99 | [_placeHolderLabel setFrame:CGRectMake(insets.left+5,insets.top,self.bounds.size.width - (insets.left +insets.right+10),CGRectGetHeight(_placeHolderLabel.frame))];
100 | [self sendSubviewToBack:_placeHolderLabel];
101 | }
102 |
103 | if( [[self text] length] == 0 && [[self placeholder] length] > 0 )
104 | {
105 | [[self viewWithTag:999] setAlpha:1];
106 | }
107 |
108 | [super drawRect:rect];
109 | }
110 | - (void)setPlaceholder:(NSString *)placeholder{
111 | if (_placeholder != placeholder) {
112 | _placeholder = placeholder;
113 | [self setNeedsDisplay];
114 | }
115 |
116 | }
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/Book_Reader/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // Book_Reader
4 | //
5 | // Created by hhuua on 2018/6/25.
6 | // Copyright © 2018年 hhuua. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HYAppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([HYAppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | target 'Book_Reader' do
2 | platform:ios,'8.0'
3 | use_frameworks!
4 |
5 | pod 'Masonry'
6 | pod 'IQKeyboardManager'
7 | pod 'AFNetworking'
8 | pod 'YYWebImage'
9 | pod 'MJExtension'
10 | pod 'FMDB'
11 | pod 'MMDrawerController'
12 | pod 'MJRefresh'
13 |
14 | end
15 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AFNetworking (3.2.1):
3 | - AFNetworking/NSURLSession (= 3.2.1)
4 | - AFNetworking/Reachability (= 3.2.1)
5 | - AFNetworking/Security (= 3.2.1)
6 | - AFNetworking/Serialization (= 3.2.1)
7 | - AFNetworking/UIKit (= 3.2.1)
8 | - AFNetworking/NSURLSession (3.2.1):
9 | - AFNetworking/Reachability
10 | - AFNetworking/Security
11 | - AFNetworking/Serialization
12 | - AFNetworking/Reachability (3.2.1)
13 | - AFNetworking/Security (3.2.1)
14 | - AFNetworking/Serialization (3.2.1)
15 | - AFNetworking/UIKit (3.2.1):
16 | - AFNetworking/NSURLSession
17 | - FMDB (2.7.5):
18 | - FMDB/standard (= 2.7.5)
19 | - FMDB/standard (2.7.5)
20 | - IQKeyboardManager (6.2.0)
21 | - Masonry (1.1.0)
22 | - MJExtension (3.0.15.1)
23 | - MJRefresh (3.1.15.7)
24 | - MMDrawerController (0.6.0):
25 | - MMDrawerController/Core (= 0.6.0)
26 | - MMDrawerController/MMDrawerBarButtonItem (= 0.6.0)
27 | - MMDrawerController/MMDrawerVisualStates (= 0.6.0)
28 | - MMDrawerController/Subclass (= 0.6.0)
29 | - MMDrawerController/Core (0.6.0)
30 | - MMDrawerController/MMDrawerBarButtonItem (0.6.0):
31 | - MMDrawerController/Core
32 | - MMDrawerController/MMDrawerVisualStates (0.6.0):
33 | - MMDrawerController/Core
34 | - MMDrawerController/Subclass (0.6.0):
35 | - MMDrawerController/Core
36 | - YYCache (1.0.4)
37 | - YYImage (1.0.4):
38 | - YYImage/Core (= 1.0.4)
39 | - YYImage/Core (1.0.4)
40 | - YYWebImage (1.0.5):
41 | - YYCache
42 | - YYImage
43 |
44 | DEPENDENCIES:
45 | - AFNetworking
46 | - FMDB
47 | - IQKeyboardManager
48 | - Masonry
49 | - MJExtension
50 | - MJRefresh
51 | - MMDrawerController
52 | - YYWebImage
53 |
54 | SPEC REPOS:
55 | https://github.com/cocoapods/specs.git:
56 | - AFNetworking
57 | - FMDB
58 | - IQKeyboardManager
59 | - Masonry
60 | - MJExtension
61 | - MJRefresh
62 | - MMDrawerController
63 | - YYCache
64 | - YYImage
65 | - YYWebImage
66 |
67 | SPEC CHECKSUMS:
68 | AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
69 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
70 | IQKeyboardManager: 6194101620b73af5e67900b8f89707a99de0b804
71 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
72 | MJExtension: 19bc33ce2eee2d319760f5622562cf581a6ff756
73 | MJRefresh: 697f8ec75ebdbe9207767bb682cf0f51b0d8a41f
74 | MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0
75 | YYCache: 8105b6638f5e849296c71f331ff83891a4942952
76 | YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
77 | YYWebImage: 5f7f36aee2ae293f016d418c7d6ba05c4863e928
78 |
79 | PODFILE CHECKSUM: 38b47941ff29ef0915ef759a2f1bbfc8c2fb4046
80 |
81 | COCOAPODS: 1.5.3
82 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 一款小说阅读器
2 |
3 | 该项目为小说阅读器的iOS客户端,实现基础的小说搜索,阅读,收藏功能。
4 | 项目相关的爬虫部分及服务端部分正在整理中,之后可能会开源。
5 |
6 | 项目目前已经可用,数据库大概有几十万本书,还是比较全的,绝大部分的小说都可以搜到。有需要的可以下载用于看小说,后台1h1g单机,请勿乱用接口,否则可能分分钟挂掉。
7 |
--------------------------------------------------------------------------------