diff --git a/BigShow1949.xcodeproj/project.pbxproj b/BigShow1949.xcodeproj/project.pbxproj index 30aa359..6885636 100644 --- a/BigShow1949.xcodeproj/project.pbxproj +++ b/BigShow1949.xcodeproj/project.pbxproj @@ -686,14 +686,6 @@ 18E525D41F443EF200514693 /* NSObject+MJCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523171F443EEE00514693 /* NSObject+MJCoding.m */; }; 18E525D51F443EF200514693 /* NSObject+MJKeyValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523191F443EEE00514693 /* NSObject+MJKeyValue.m */; }; 18E525D61F443EF200514693 /* NSObject+MJMember.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E5231B1F443EEE00514693 /* NSObject+MJMember.m */; }; - 18E525D71F443EF200514693 /* MJRefresh.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 18E5231D1F443EEE00514693 /* MJRefresh.bundle */; }; - 18E525D81F443EF200514693 /* MJRefreshBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523201F443EEE00514693 /* MJRefreshBaseView.m */; }; - 18E525D91F443EF200514693 /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523221F443EEE00514693 /* MJRefreshConst.m */; }; - 18E525DA1F443EF200514693 /* MJRefreshFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523241F443EEE00514693 /* MJRefreshFooterView.m */; }; - 18E525DB1F443EF200514693 /* MJRefreshHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523261F443EEE00514693 /* MJRefreshHeaderView.m */; }; - 18E525DC1F443EF200514693 /* UIScrollView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523281F443EEE00514693 /* UIScrollView+Extension.m */; }; - 18E525DD1F443EF200514693 /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E5232A1F443EEE00514693 /* UIScrollView+MJRefresh.m */; }; - 18E525DE1F443EF200514693 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E5232C1F443EEE00514693 /* UIView+Extension.m */; }; 18E525EF1F443EF200514693 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523511F443EEE00514693 /* AppDelegate.m */; }; 18E525F01F443EF200514693 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523521F443EEE00514693 /* main.m */; }; 18E525F11F443EF200514693 /* YFAuthorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E523541F443EEE00514693 /* YFAuthorViewController.m */; }; @@ -722,6 +714,44 @@ F8177DCA21077322005E5109 /* GCDBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F8177DC921077322005E5109 /* GCDBaseViewController.m */; }; F8177DCC2107781E005E5109 /* 队列&同步.png in Resources */ = {isa = PBXBuildFile; fileRef = F8177DCB2107781E005E5109 /* 队列&同步.png */; }; F8177DCE21078573005E5109 /* 终端命令.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F8177DCD21078573005E5109 /* 终端命令.rtf */; }; + F83F20FD216BAFD400DFA548 /* YNSuspendTopPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20D2216BAFD400DFA548 /* YNSuspendTopPageVC.m */; }; + F83F20FE216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20D3216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.m */; }; + F83F20FF216BAFD400DFA548 /* YNLoadPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20D8216BAFD400DFA548 /* YNLoadPageVC.m */; }; + F83F2100216BAFD400DFA548 /* BaseCollectionViewVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20DA216BAFD400DFA548 /* BaseCollectionViewVC.m */; }; + F83F2101216BAFD400DFA548 /* BasePageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20DB216BAFD400DFA548 /* BasePageViewController.m */; }; + F83F2102216BAFD400DFA548 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20DD216BAFD400DFA548 /* BaseViewController.m */; }; + F83F2103216BAFD400DFA548 /* BaseTableViewVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20DF216BAFD400DFA548 /* BaseTableViewVC.m */; }; + F83F2104216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20E3216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.m */; }; + F83F2105216BAFD400DFA548 /* DemosListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20E5216BAFD400DFA548 /* DemosListVC.m */; }; + F83F2106216BAFD400DFA548 /* YNNavPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20E7216BAFD400DFA548 /* YNNavPageVC.m */; }; + F83F2107216BAFD400DFA548 /* YNScrollMenuStyleVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20EA216BAFD400DFA548 /* YNScrollMenuStyleVC.m */; }; + F83F2108216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20EF216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.m */; }; + F83F2109216BAFD400DFA548 /* YNSuspendTopPausePageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20F0216BAFD400DFA548 /* YNSuspendTopPausePageVC.m */; }; + F83F210A216BAFD400DFA548 /* YNSuspendCenterPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20F3216BAFD400DFA548 /* YNSuspendCenterPageVC.m */; }; + F83F210B216BAFD400DFA548 /* YNTopPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20F6216BAFD400DFA548 /* YNTopPageVC.m */; }; + F83F210C216BAFD400DFA548 /* YNTestBaseVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20FA216BAFD400DFA548 /* YNTestBaseVC.m */; }; + F83F210D216BAFD400DFA548 /* YNTestPageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F20FB216BAFD400DFA548 /* YNTestPageVC.m */; }; + F83F2111216BB69700DFA548 /* FTPopOverMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2110216BB69700DFA548 /* FTPopOverMenu.m */; }; + F83F2141216BB8C400DFA548 /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2113216BB8C400DFA548 /* UIScrollView+MJRefresh.m */; }; + F83F2142216BB8C400DFA548 /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2114216BB8C400DFA548 /* MJRefreshConst.m */; }; + F83F2143216BB8C400DFA548 /* MJRefresh.bundle in Resources */ = {isa = PBXBuildFile; fileRef = F83F2118216BB8C400DFA548 /* MJRefresh.bundle */; }; + F83F2144216BB8C400DFA548 /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F211A216BB8C400DFA548 /* UIScrollView+MJExtension.m */; }; + F83F2145216BB8C400DFA548 /* NSBundle+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F211D216BB8C400DFA548 /* NSBundle+MJRefresh.m */; }; + F83F2146216BB8C400DFA548 /* UIView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F211E216BB8C400DFA548 /* UIView+MJExtension.m */; }; + F83F2147216BB8C400DFA548 /* MJRefreshBackGifFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2125216BB8C400DFA548 /* MJRefreshBackGifFooter.m */; }; + F83F2148216BB8C400DFA548 /* MJRefreshBackStateFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2126216BB8C400DFA548 /* MJRefreshBackStateFooter.m */; }; + F83F2149216BB8C400DFA548 /* MJRefreshBackNormalFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2127216BB8C400DFA548 /* MJRefreshBackNormalFooter.m */; }; + F83F214A216BB8C400DFA548 /* MJRefreshAutoStateFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F212C216BB8C400DFA548 /* MJRefreshAutoStateFooter.m */; }; + F83F214B216BB8C400DFA548 /* MJRefreshAutoGifFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F212D216BB8C400DFA548 /* MJRefreshAutoGifFooter.m */; }; + F83F214C216BB8C400DFA548 /* MJRefreshAutoNormalFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F212E216BB8C400DFA548 /* MJRefreshAutoNormalFooter.m */; }; + F83F214D216BB8C400DFA548 /* MJRefreshNormalHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2130216BB8C400DFA548 /* MJRefreshNormalHeader.m */; }; + F83F214E216BB8C400DFA548 /* MJRefreshStateHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2134216BB8C400DFA548 /* MJRefreshStateHeader.m */; }; + F83F214F216BB8C400DFA548 /* MJRefreshGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2135216BB8C400DFA548 /* MJRefreshGifHeader.m */; }; + F83F2150216BB8C400DFA548 /* MJRefreshFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2137216BB8C400DFA548 /* MJRefreshFooter.m */; }; + F83F2151216BB8C400DFA548 /* MJRefreshHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F2139216BB8C400DFA548 /* MJRefreshHeader.m */; }; + F83F2152216BB8C400DFA548 /* MJRefreshBackFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F213B216BB8C400DFA548 /* MJRefreshBackFooter.m */; }; + F83F2153216BB8C400DFA548 /* MJRefreshAutoFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F213C216BB8C400DFA548 /* MJRefreshAutoFooter.m */; }; + F83F2154216BB8C400DFA548 /* MJRefreshComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = F83F213E216BB8C400DFA548 /* MJRefreshComponent.m */; }; F84A4DBD215804610025D4EB /* UIViewController+YNPageExtend.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DA8215804610025D4EB /* UIViewController+YNPageExtend.m */; }; F84A4DBE215804610025D4EB /* UIView+YNPageExtend.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DA9215804610025D4EB /* UIView+YNPageExtend.m */; }; F84A4DBF215804610025D4EB /* UIScrollView+YNPageExtend.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DAD215804610025D4EB /* UIScrollView+YNPageExtend.m */; }; @@ -733,7 +763,6 @@ F84A4DC5215804610025D4EB /* YNPageCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DB7215804610025D4EB /* YNPageCollectionView.m */; }; F84A4DC6215804610025D4EB /* YNPageScrollMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DB9215804610025D4EB /* YNPageScrollMenuView.m */; }; F84A4DCA215804B80025D4EB /* YNPageViewDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DC9215804B80025D4EB /* YNPageViewDemoController.m */; }; - F84A4DCD2158C4ED0025D4EB /* YFPageViewOneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DCC2158C4ED0025D4EB /* YFPageViewOneViewController.m */; }; F84A4DDE2158CDD00025D4EB /* SDCycleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DD22158CDD00025D4EB /* SDCycleScrollView.m */; }; F84A4DDF2158CDD00025D4EB /* UIView+SDExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DD32158CDD00025D4EB /* UIView+SDExtension.m */; }; F84A4DE02158CDD00025D4EB /* SDCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F84A4DD42158CDD00025D4EB /* SDCollectionViewCell.m */; }; @@ -1996,22 +2025,6 @@ 18E523191F443EEE00514693 /* NSObject+MJKeyValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+MJKeyValue.m"; sourceTree = ""; }; 18E5231A1F443EEE00514693 /* NSObject+MJMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+MJMember.h"; sourceTree = ""; }; 18E5231B1F443EEE00514693 /* NSObject+MJMember.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+MJMember.m"; sourceTree = ""; }; - 18E5231D1F443EEE00514693 /* MJRefresh.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = MJRefresh.bundle; sourceTree = ""; }; - 18E5231E1F443EEE00514693 /* MJRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefresh.h; sourceTree = ""; }; - 18E5231F1F443EEE00514693 /* MJRefreshBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshBaseView.h; sourceTree = ""; }; - 18E523201F443EEE00514693 /* MJRefreshBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshBaseView.m; sourceTree = ""; }; - 18E523211F443EEE00514693 /* MJRefreshConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshConst.h; sourceTree = ""; }; - 18E523221F443EEE00514693 /* MJRefreshConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshConst.m; sourceTree = ""; }; - 18E523231F443EEE00514693 /* MJRefreshFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshFooterView.h; sourceTree = ""; }; - 18E523241F443EEE00514693 /* MJRefreshFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshFooterView.m; sourceTree = ""; }; - 18E523251F443EEE00514693 /* MJRefreshHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshHeaderView.h; sourceTree = ""; }; - 18E523261F443EEE00514693 /* MJRefreshHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshHeaderView.m; sourceTree = ""; }; - 18E523271F443EEE00514693 /* UIScrollView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+Extension.h"; sourceTree = ""; }; - 18E523281F443EEE00514693 /* UIScrollView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+Extension.m"; sourceTree = ""; }; - 18E523291F443EEE00514693 /* UIScrollView+MJRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+MJRefresh.h"; sourceTree = ""; }; - 18E5232A1F443EEE00514693 /* UIScrollView+MJRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefresh.m"; sourceTree = ""; }; - 18E5232B1F443EEE00514693 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = ""; }; - 18E5232C1F443EEE00514693 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = ""; }; 18E523501F443EEE00514693 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 18E523511F443EEE00514693 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 18E523521F443EEE00514693 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -2064,6 +2077,82 @@ F8177DC921077322005E5109 /* GCDBaseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GCDBaseViewController.m; sourceTree = ""; }; F8177DCB2107781E005E5109 /* 队列&同步.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "队列&同步.png"; sourceTree = ""; }; F8177DCD21078573005E5109 /* 终端命令.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = "终端命令.rtf"; sourceTree = ""; }; + F83F20D2216BAFD400DFA548 /* YNSuspendTopPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendTopPageVC.m; sourceTree = ""; }; + F83F20D3216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendTopBaseTableViewVC.m; sourceTree = ""; }; + F83F20D4216BAFD400DFA548 /* YNSuspendTopPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendTopPageVC.h; sourceTree = ""; }; + F83F20D5216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendTopBaseTableViewVC.h; sourceTree = ""; }; + F83F20D7216BAFD400DFA548 /* YNLoadPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNLoadPageVC.h; sourceTree = ""; }; + F83F20D8216BAFD400DFA548 /* YNLoadPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNLoadPageVC.m; sourceTree = ""; }; + F83F20DA216BAFD400DFA548 /* BaseCollectionViewVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseCollectionViewVC.m; sourceTree = ""; }; + F83F20DB216BAFD400DFA548 /* BasePageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BasePageViewController.m; sourceTree = ""; }; + F83F20DC216BAFD400DFA548 /* BaseTableViewVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTableViewVC.h; sourceTree = ""; }; + F83F20DD216BAFD400DFA548 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = ""; }; + F83F20DE216BAFD400DFA548 /* BaseCollectionViewVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseCollectionViewVC.h; sourceTree = ""; }; + F83F20DF216BAFD400DFA548 /* BaseTableViewVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseTableViewVC.m; sourceTree = ""; }; + F83F20E0216BAFD400DFA548 /* BasePageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasePageViewController.h; sourceTree = ""; }; + F83F20E1216BAFD400DFA548 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = ""; }; + F83F20E3216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendCustomNavOrSuspendPositionVC.m; sourceTree = ""; }; + F83F20E4216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendCustomNavOrSuspendPositionVC.h; sourceTree = ""; }; + F83F20E5216BAFD400DFA548 /* DemosListVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemosListVC.m; sourceTree = ""; }; + F83F20E7216BAFD400DFA548 /* YNNavPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNNavPageVC.m; sourceTree = ""; }; + F83F20E8216BAFD400DFA548 /* YNNavPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNNavPageVC.h; sourceTree = ""; }; + F83F20EA216BAFD400DFA548 /* YNScrollMenuStyleVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNScrollMenuStyleVC.m; sourceTree = ""; }; + F83F20EB216BAFD400DFA548 /* YNScrollMenuStyleVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNScrollMenuStyleVC.h; sourceTree = ""; }; + F83F20ED216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendTopPauseBaseTableViewVC.h; sourceTree = ""; }; + F83F20EE216BAFD400DFA548 /* YNSuspendTopPausePageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendTopPausePageVC.h; sourceTree = ""; }; + F83F20EF216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendTopPauseBaseTableViewVC.m; sourceTree = ""; }; + F83F20F0216BAFD400DFA548 /* YNSuspendTopPausePageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendTopPausePageVC.m; sourceTree = ""; }; + F83F20F2216BAFD400DFA548 /* YNSuspendCenterPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNSuspendCenterPageVC.h; sourceTree = ""; }; + F83F20F3216BAFD400DFA548 /* YNSuspendCenterPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNSuspendCenterPageVC.m; sourceTree = ""; }; + F83F20F5216BAFD400DFA548 /* YNTopPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNTopPageVC.h; sourceTree = ""; }; + F83F20F6216BAFD400DFA548 /* YNTopPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNTopPageVC.m; sourceTree = ""; }; + F83F20F8216BAFD400DFA548 /* YNTestBaseVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNTestBaseVC.h; sourceTree = ""; }; + F83F20F9216BAFD400DFA548 /* YNTestPageVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNTestPageVC.h; sourceTree = ""; }; + F83F20FA216BAFD400DFA548 /* YNTestBaseVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNTestBaseVC.m; sourceTree = ""; }; + F83F20FB216BAFD400DFA548 /* YNTestPageVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YNTestPageVC.m; sourceTree = ""; }; + F83F20FC216BAFD400DFA548 /* DemosListVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemosListVC.h; sourceTree = ""; }; + F83F210F216BB69700DFA548 /* FTPopOverMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPopOverMenu.h; sourceTree = ""; }; + F83F2110216BB69700DFA548 /* FTPopOverMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTPopOverMenu.m; sourceTree = ""; }; + F83F2113216BB8C400DFA548 /* UIScrollView+MJRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefresh.m"; sourceTree = ""; }; + F83F2114216BB8C400DFA548 /* MJRefreshConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshConst.m; sourceTree = ""; }; + F83F2115216BB8C400DFA548 /* UIScrollView+MJExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+MJExtension.h"; sourceTree = ""; }; + F83F2116216BB8C400DFA548 /* MJRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefresh.h; sourceTree = ""; }; + F83F2117216BB8C400DFA548 /* NSBundle+MJRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+MJRefresh.h"; sourceTree = ""; }; + F83F2118216BB8C400DFA548 /* MJRefresh.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = MJRefresh.bundle; sourceTree = ""; }; + F83F2119216BB8C400DFA548 /* UIView+MJExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MJExtension.h"; sourceTree = ""; }; + F83F211A216BB8C400DFA548 /* UIScrollView+MJExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJExtension.m"; sourceTree = ""; }; + F83F211B216BB8C400DFA548 /* MJRefreshConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshConst.h; sourceTree = ""; }; + F83F211C216BB8C400DFA548 /* UIScrollView+MJRefresh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+MJRefresh.h"; sourceTree = ""; }; + F83F211D216BB8C400DFA548 /* NSBundle+MJRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+MJRefresh.m"; sourceTree = ""; }; + F83F211E216BB8C400DFA548 /* UIView+MJExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MJExtension.m"; sourceTree = ""; }; + F83F2122216BB8C400DFA548 /* MJRefreshBackGifFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshBackGifFooter.h; sourceTree = ""; }; + F83F2123216BB8C400DFA548 /* MJRefreshBackStateFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshBackStateFooter.h; sourceTree = ""; }; + F83F2124216BB8C400DFA548 /* MJRefreshBackNormalFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshBackNormalFooter.h; sourceTree = ""; }; + F83F2125216BB8C400DFA548 /* MJRefreshBackGifFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshBackGifFooter.m; sourceTree = ""; }; + F83F2126216BB8C400DFA548 /* MJRefreshBackStateFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshBackStateFooter.m; sourceTree = ""; }; + F83F2127216BB8C400DFA548 /* MJRefreshBackNormalFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshBackNormalFooter.m; sourceTree = ""; }; + F83F2129216BB8C400DFA548 /* MJRefreshAutoStateFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshAutoStateFooter.h; sourceTree = ""; }; + F83F212A216BB8C400DFA548 /* MJRefreshAutoNormalFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshAutoNormalFooter.h; sourceTree = ""; }; + F83F212B216BB8C400DFA548 /* MJRefreshAutoGifFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshAutoGifFooter.h; sourceTree = ""; }; + F83F212C216BB8C400DFA548 /* MJRefreshAutoStateFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshAutoStateFooter.m; sourceTree = ""; }; + F83F212D216BB8C400DFA548 /* MJRefreshAutoGifFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshAutoGifFooter.m; sourceTree = ""; }; + F83F212E216BB8C400DFA548 /* MJRefreshAutoNormalFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshAutoNormalFooter.m; sourceTree = ""; }; + F83F2130216BB8C400DFA548 /* MJRefreshNormalHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshNormalHeader.m; sourceTree = ""; }; + F83F2131216BB8C400DFA548 /* MJRefreshStateHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshStateHeader.h; sourceTree = ""; }; + F83F2132216BB8C400DFA548 /* MJRefreshGifHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshGifHeader.h; sourceTree = ""; }; + F83F2133216BB8C400DFA548 /* MJRefreshNormalHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshNormalHeader.h; sourceTree = ""; }; + F83F2134216BB8C400DFA548 /* MJRefreshStateHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshStateHeader.m; sourceTree = ""; }; + F83F2135216BB8C400DFA548 /* MJRefreshGifHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshGifHeader.m; sourceTree = ""; }; + F83F2137216BB8C400DFA548 /* MJRefreshFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshFooter.m; sourceTree = ""; }; + F83F2138216BB8C400DFA548 /* MJRefreshComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshComponent.h; sourceTree = ""; }; + F83F2139216BB8C400DFA548 /* MJRefreshHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshHeader.m; sourceTree = ""; }; + F83F213A216BB8C400DFA548 /* MJRefreshAutoFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshAutoFooter.h; sourceTree = ""; }; + F83F213B216BB8C400DFA548 /* MJRefreshBackFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshBackFooter.m; sourceTree = ""; }; + F83F213C216BB8C400DFA548 /* MJRefreshAutoFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshAutoFooter.m; sourceTree = ""; }; + F83F213D216BB8C400DFA548 /* MJRefreshHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshHeader.h; sourceTree = ""; }; + F83F213E216BB8C400DFA548 /* MJRefreshComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshComponent.m; sourceTree = ""; }; + F83F213F216BB8C400DFA548 /* MJRefreshFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshFooter.h; sourceTree = ""; }; + F83F2140216BB8C400DFA548 /* MJRefreshBackFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJRefreshBackFooter.h; sourceTree = ""; }; F84A4DA8215804610025D4EB /* UIViewController+YNPageExtend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+YNPageExtend.m"; sourceTree = ""; }; F84A4DA9215804610025D4EB /* UIView+YNPageExtend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+YNPageExtend.m"; sourceTree = ""; }; F84A4DAA215804610025D4EB /* UIScrollView+YNPageExtend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+YNPageExtend.h"; sourceTree = ""; }; @@ -2086,8 +2175,6 @@ F84A4DBC215804610025D4EB /* YNPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YNPageViewController.h; sourceTree = ""; }; F84A4DC8215804B80025D4EB /* YNPageViewDemoController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YNPageViewDemoController.h; sourceTree = ""; }; F84A4DC9215804B80025D4EB /* YNPageViewDemoController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YNPageViewDemoController.m; sourceTree = ""; }; - F84A4DCB2158C4ED0025D4EB /* YFPageViewOneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YFPageViewOneViewController.h; sourceTree = ""; }; - F84A4DCC2158C4ED0025D4EB /* YFPageViewOneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YFPageViewOneViewController.m; sourceTree = ""; }; F84A4DCF2158CDD00025D4EB /* UIView+SDExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+SDExtension.h"; sourceTree = ""; }; F84A4DD02158CDD00025D4EB /* SDCycleScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDCycleScrollView.h; sourceTree = ""; }; F84A4DD12158CDD00025D4EB /* SDCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDCollectionViewCell.h; sourceTree = ""; }; @@ -5266,6 +5353,8 @@ 18E522B51F443EEE00514693 /* Lib */ = { isa = PBXGroup; children = ( + F83F2112216BB8C400DFA548 /* MJRefresh */, + F83F210E216BB69700DFA548 /* FTPopOverMenu */, F84A4DE52158CEC20025D4EB /* SDWebImage */, F84A4DCE2158CDD00025D4EB /* SDCycleScrollView */, F84A4DA6215804610025D4EB /* YNPageViewController */, @@ -5273,7 +5362,6 @@ 18E522DD1F443EEE00514693 /* FMDB */, 18E522E91F443EEE00514693 /* Masonry */, 18E523041F443EEE00514693 /* MJExtension */, - 18E5231C1F443EEE00514693 /* MJRefresh */, ); path = Lib; sourceTree = ""; @@ -5418,29 +5506,6 @@ path = MJExtension; sourceTree = ""; }; - 18E5231C1F443EEE00514693 /* MJRefresh */ = { - isa = PBXGroup; - children = ( - 18E5231D1F443EEE00514693 /* MJRefresh.bundle */, - 18E5231E1F443EEE00514693 /* MJRefresh.h */, - 18E5231F1F443EEE00514693 /* MJRefreshBaseView.h */, - 18E523201F443EEE00514693 /* MJRefreshBaseView.m */, - 18E523211F443EEE00514693 /* MJRefreshConst.h */, - 18E523221F443EEE00514693 /* MJRefreshConst.m */, - 18E523231F443EEE00514693 /* MJRefreshFooterView.h */, - 18E523241F443EEE00514693 /* MJRefreshFooterView.m */, - 18E523251F443EEE00514693 /* MJRefreshHeaderView.h */, - 18E523261F443EEE00514693 /* MJRefreshHeaderView.m */, - 18E523271F443EEE00514693 /* UIScrollView+Extension.h */, - 18E523281F443EEE00514693 /* UIScrollView+Extension.m */, - 18E523291F443EEE00514693 /* UIScrollView+MJRefresh.h */, - 18E5232A1F443EEE00514693 /* UIScrollView+MJRefresh.m */, - 18E5232B1F443EEE00514693 /* UIView+Extension.h */, - 18E5232C1F443EEE00514693 /* UIView+Extension.m */, - ); - path = MJRefresh; - sourceTree = ""; - }; 18E5234F1F443EEE00514693 /* Other */ = { isa = PBXGroup; children = ( @@ -5565,6 +5630,231 @@ name = Pods; sourceTree = ""; }; + F83F20D0216BAFD400DFA548 /* Demos */ = { + isa = PBXGroup; + children = ( + F83F20E5216BAFD400DFA548 /* DemosListVC.m */, + F83F20D1216BAFD400DFA548 /* SuspendTopPageVC */, + F83F20D6216BAFD400DFA548 /* LoadPageVC */, + F83F20D9216BAFD400DFA548 /* BaseVC */, + F83F20E2216BAFD400DFA548 /* SuspendCustomNavOrSuspendPositionVC */, + F83F20E6216BAFD400DFA548 /* NavPageVC */, + F83F20E9216BAFD400DFA548 /* ScrollMenuStyleVC */, + F83F20EC216BAFD400DFA548 /* SuspendTopPausePageVC */, + F83F20F1216BAFD400DFA548 /* SuspendCenterPageVC */, + F83F20F4216BAFD400DFA548 /* TopPageVC */, + F83F20F7216BAFD400DFA548 /* TestPageVC */, + F83F20FC216BAFD400DFA548 /* DemosListVC.h */, + ); + path = Demos; + sourceTree = ""; + }; + F83F20D1216BAFD400DFA548 /* SuspendTopPageVC */ = { + isa = PBXGroup; + children = ( + F83F20D5216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.h */, + F83F20D3216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.m */, + F83F20D4216BAFD400DFA548 /* YNSuspendTopPageVC.h */, + F83F20D2216BAFD400DFA548 /* YNSuspendTopPageVC.m */, + ); + path = SuspendTopPageVC; + sourceTree = ""; + }; + F83F20D6216BAFD400DFA548 /* LoadPageVC */ = { + isa = PBXGroup; + children = ( + F83F20D7216BAFD400DFA548 /* YNLoadPageVC.h */, + F83F20D8216BAFD400DFA548 /* YNLoadPageVC.m */, + ); + path = LoadPageVC; + sourceTree = ""; + }; + F83F20D9216BAFD400DFA548 /* BaseVC */ = { + isa = PBXGroup; + children = ( + F83F20DA216BAFD400DFA548 /* BaseCollectionViewVC.m */, + F83F20DB216BAFD400DFA548 /* BasePageViewController.m */, + F83F20DC216BAFD400DFA548 /* BaseTableViewVC.h */, + F83F20DD216BAFD400DFA548 /* BaseViewController.m */, + F83F20DE216BAFD400DFA548 /* BaseCollectionViewVC.h */, + F83F20DF216BAFD400DFA548 /* BaseTableViewVC.m */, + F83F20E0216BAFD400DFA548 /* BasePageViewController.h */, + F83F20E1216BAFD400DFA548 /* BaseViewController.h */, + ); + path = BaseVC; + sourceTree = ""; + }; + F83F20E2216BAFD400DFA548 /* SuspendCustomNavOrSuspendPositionVC */ = { + isa = PBXGroup; + children = ( + F83F20E3216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.m */, + F83F20E4216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.h */, + ); + path = SuspendCustomNavOrSuspendPositionVC; + sourceTree = ""; + }; + F83F20E6216BAFD400DFA548 /* NavPageVC */ = { + isa = PBXGroup; + children = ( + F83F20E7216BAFD400DFA548 /* YNNavPageVC.m */, + F83F20E8216BAFD400DFA548 /* YNNavPageVC.h */, + ); + path = NavPageVC; + sourceTree = ""; + }; + F83F20E9216BAFD400DFA548 /* ScrollMenuStyleVC */ = { + isa = PBXGroup; + children = ( + F83F20EA216BAFD400DFA548 /* YNScrollMenuStyleVC.m */, + F83F20EB216BAFD400DFA548 /* YNScrollMenuStyleVC.h */, + ); + path = ScrollMenuStyleVC; + sourceTree = ""; + }; + F83F20EC216BAFD400DFA548 /* SuspendTopPausePageVC */ = { + isa = PBXGroup; + children = ( + F83F20ED216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.h */, + F83F20EE216BAFD400DFA548 /* YNSuspendTopPausePageVC.h */, + F83F20EF216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.m */, + F83F20F0216BAFD400DFA548 /* YNSuspendTopPausePageVC.m */, + ); + path = SuspendTopPausePageVC; + sourceTree = ""; + }; + F83F20F1216BAFD400DFA548 /* SuspendCenterPageVC */ = { + isa = PBXGroup; + children = ( + F83F20F2216BAFD400DFA548 /* YNSuspendCenterPageVC.h */, + F83F20F3216BAFD400DFA548 /* YNSuspendCenterPageVC.m */, + ); + path = SuspendCenterPageVC; + sourceTree = ""; + }; + F83F20F4216BAFD400DFA548 /* TopPageVC */ = { + isa = PBXGroup; + children = ( + F83F20F5216BAFD400DFA548 /* YNTopPageVC.h */, + F83F20F6216BAFD400DFA548 /* YNTopPageVC.m */, + ); + path = TopPageVC; + sourceTree = ""; + }; + F83F20F7216BAFD400DFA548 /* TestPageVC */ = { + isa = PBXGroup; + children = ( + F83F20F8216BAFD400DFA548 /* YNTestBaseVC.h */, + F83F20F9216BAFD400DFA548 /* YNTestPageVC.h */, + F83F20FA216BAFD400DFA548 /* YNTestBaseVC.m */, + F83F20FB216BAFD400DFA548 /* YNTestPageVC.m */, + ); + path = TestPageVC; + sourceTree = ""; + }; + F83F210E216BB69700DFA548 /* FTPopOverMenu */ = { + isa = PBXGroup; + children = ( + F83F210F216BB69700DFA548 /* FTPopOverMenu.h */, + F83F2110216BB69700DFA548 /* FTPopOverMenu.m */, + ); + path = FTPopOverMenu; + sourceTree = ""; + }; + F83F2112216BB8C400DFA548 /* MJRefresh */ = { + isa = PBXGroup; + children = ( + F83F2113216BB8C400DFA548 /* UIScrollView+MJRefresh.m */, + F83F2114216BB8C400DFA548 /* MJRefreshConst.m */, + F83F2115216BB8C400DFA548 /* UIScrollView+MJExtension.h */, + F83F2116216BB8C400DFA548 /* MJRefresh.h */, + F83F2117216BB8C400DFA548 /* NSBundle+MJRefresh.h */, + F83F2118216BB8C400DFA548 /* MJRefresh.bundle */, + F83F2119216BB8C400DFA548 /* UIView+MJExtension.h */, + F83F211A216BB8C400DFA548 /* UIScrollView+MJExtension.m */, + F83F211B216BB8C400DFA548 /* MJRefreshConst.h */, + F83F211C216BB8C400DFA548 /* UIScrollView+MJRefresh.h */, + F83F211D216BB8C400DFA548 /* NSBundle+MJRefresh.m */, + F83F211E216BB8C400DFA548 /* UIView+MJExtension.m */, + F83F211F216BB8C400DFA548 /* Custom */, + F83F2136216BB8C400DFA548 /* Base */, + ); + path = MJRefresh; + sourceTree = ""; + }; + F83F211F216BB8C400DFA548 /* Custom */ = { + isa = PBXGroup; + children = ( + F83F2120216BB8C400DFA548 /* Footer */, + F83F212F216BB8C400DFA548 /* Header */, + ); + path = Custom; + sourceTree = ""; + }; + F83F2120216BB8C400DFA548 /* Footer */ = { + isa = PBXGroup; + children = ( + F83F2121216BB8C400DFA548 /* Back */, + F83F2128216BB8C400DFA548 /* Auto */, + ); + path = Footer; + sourceTree = ""; + }; + F83F2121216BB8C400DFA548 /* Back */ = { + isa = PBXGroup; + children = ( + F83F2122216BB8C400DFA548 /* MJRefreshBackGifFooter.h */, + F83F2123216BB8C400DFA548 /* MJRefreshBackStateFooter.h */, + F83F2124216BB8C400DFA548 /* MJRefreshBackNormalFooter.h */, + F83F2125216BB8C400DFA548 /* MJRefreshBackGifFooter.m */, + F83F2126216BB8C400DFA548 /* MJRefreshBackStateFooter.m */, + F83F2127216BB8C400DFA548 /* MJRefreshBackNormalFooter.m */, + ); + path = Back; + sourceTree = ""; + }; + F83F2128216BB8C400DFA548 /* Auto */ = { + isa = PBXGroup; + children = ( + F83F2129216BB8C400DFA548 /* MJRefreshAutoStateFooter.h */, + F83F212A216BB8C400DFA548 /* MJRefreshAutoNormalFooter.h */, + F83F212B216BB8C400DFA548 /* MJRefreshAutoGifFooter.h */, + F83F212C216BB8C400DFA548 /* MJRefreshAutoStateFooter.m */, + F83F212D216BB8C400DFA548 /* MJRefreshAutoGifFooter.m */, + F83F212E216BB8C400DFA548 /* MJRefreshAutoNormalFooter.m */, + ); + path = Auto; + sourceTree = ""; + }; + F83F212F216BB8C400DFA548 /* Header */ = { + isa = PBXGroup; + children = ( + F83F2130216BB8C400DFA548 /* MJRefreshNormalHeader.m */, + F83F2131216BB8C400DFA548 /* MJRefreshStateHeader.h */, + F83F2132216BB8C400DFA548 /* MJRefreshGifHeader.h */, + F83F2133216BB8C400DFA548 /* MJRefreshNormalHeader.h */, + F83F2134216BB8C400DFA548 /* MJRefreshStateHeader.m */, + F83F2135216BB8C400DFA548 /* MJRefreshGifHeader.m */, + ); + path = Header; + sourceTree = ""; + }; + F83F2136216BB8C400DFA548 /* Base */ = { + isa = PBXGroup; + children = ( + F83F2137216BB8C400DFA548 /* MJRefreshFooter.m */, + F83F2138216BB8C400DFA548 /* MJRefreshComponent.h */, + F83F2139216BB8C400DFA548 /* MJRefreshHeader.m */, + F83F213A216BB8C400DFA548 /* MJRefreshAutoFooter.h */, + F83F213B216BB8C400DFA548 /* MJRefreshBackFooter.m */, + F83F213C216BB8C400DFA548 /* MJRefreshAutoFooter.m */, + F83F213D216BB8C400DFA548 /* MJRefreshHeader.h */, + F83F213E216BB8C400DFA548 /* MJRefreshComponent.m */, + F83F213F216BB8C400DFA548 /* MJRefreshFooter.h */, + F83F2140216BB8C400DFA548 /* MJRefreshBackFooter.h */, + ); + path = Base; + sourceTree = ""; + }; F84A4DA6215804610025D4EB /* YNPageViewController */ = { isa = PBXGroup; children = ( @@ -5611,10 +5901,9 @@ F84A4DC7215804760025D4EB /* YNPageView */ = { isa = PBXGroup; children = ( + F83F20D0216BAFD400DFA548 /* Demos */, F84A4DC8215804B80025D4EB /* YNPageViewDemoController.h */, F84A4DC9215804B80025D4EB /* YNPageViewDemoController.m */, - F84A4DCB2158C4ED0025D4EB /* YFPageViewOneViewController.h */, - F84A4DCC2158C4ED0025D4EB /* YFPageViewOneViewController.m */, ); path = YNPageView; sourceTree = ""; @@ -5806,6 +6095,7 @@ 18E5251D1F443EF100514693 /* bg_yaoyao_under.png in Resources */, 18E5235A1F443EEF00514693 /* button_bg@2x.png in Resources */, 18E524F11F443EF100514693 /* RAViewController.storyboard in Resources */, + F83F2143216BB8C400DFA548 /* MJRefresh.bundle in Resources */, 18E523921F443EEF00514693 /* paul_george.png in Resources */, 18E523B41F443EEF00514693 /* YFShopCell.xib in Resources */, F8177DCE21078573005E5109 /* 终端命令.rtf in Resources */, @@ -5841,7 +6131,6 @@ 18E524DA1F443EF100514693 /* 10.jpg in Resources */, 18E524D61F443EF100514693 /* TabBar_MyLottery_new@2x.png in Resources */, 18E523B71F443EEF00514693 /* 3.plist in Resources */, - 18E525D71F443EF200514693 /* MJRefresh.bundle in Resources */, 18E523951F443EEF00514693 /* YFHalfCircleLayoutViewController.storyboard in Resources */, 18E5256E1F443EF100514693 /* placeholder_fancy@2x.png in Resources */, 18E5250A1F443EF100514693 /* RootViewController.xib in Resources */, @@ -6005,7 +6294,6 @@ 18E525401F443EF100514693 /* Reachability.m in Sources */, 1868EEA62066419B00EEE713 /* JS_UIWebViewJSBridgeViewController.m in Sources */, 18E5249E1F443EF000514693 /* YFWaterWaveViewController.m in Sources */, - 18E525DB1F443EF200514693 /* MJRefreshHeaderView.m in Sources */, 18E524B91F443EF000514693 /* CATransitionViewController.m in Sources */, 18E525CE1F443EF200514693 /* MJFoundation.m in Sources */, 18E524081F443EEF00514693 /* Book_KVC.m in Sources */, @@ -6025,7 +6313,6 @@ 18E5236A1F443EEF00514693 /* NSObject+KVC.m in Sources */, 18E523D71F443EEF00514693 /* ITRSecondViewController.m in Sources */, 18E525731F443EF100514693 /* UIImage+CJZ.m in Sources */, - 18E525DD1F443EF200514693 /* UIScrollView+MJRefresh.m in Sources */, 18E5253C1F443EF100514693 /* HomePresenter.m in Sources */, 18E525361F443EF100514693 /* YFNeteaseViewController.m in Sources */, 18E523BB1F443EEF00514693 /* TempViewController.m in Sources */, @@ -6055,6 +6342,7 @@ 18E523771F443EEF00514693 /* ZTypewriteEffectLabel.m in Sources */, 18E5253F1F443EF100514693 /* HttpPresenter.m in Sources */, 18E524641F443EF000514693 /* YFLittleProjectViewController.m in Sources */, + F83F2149216BB8C400DFA548 /* MJRefreshBackNormalFooter.m in Sources */, 18E524281F443EEF00514693 /* MultipleDelegate.m in Sources */, 18E5248B1F443EF000514693 /* BMWaveButton.m in Sources */, 18E523EA1F443EEF00514693 /* RZShrinkZoomAnimationController.m in Sources */, @@ -6076,6 +6364,7 @@ 18E524A01F443EF000514693 /* YFGradientViewController.m in Sources */, 18E523E61F443EEF00514693 /* RZCardSlideAnimationController.m in Sources */, 18E525A41F443EF200514693 /* SwiftViewController.m in Sources */, + F83F2151216BB8C400DFA548 /* MJRefreshHeader.m in Sources */, 18E523B21F443EEF00514693 /* YFShop.m in Sources */, 18E525581F443EF100514693 /* MyDataSourceViewController.m in Sources */, 18E524F81F443EF100514693 /* UINTDraggableView.m in Sources */, @@ -6084,6 +6373,7 @@ 18E525D41F443EF200514693 /* NSObject+MJCoding.m in Sources */, 18E5240D1F443EEF00514693 /* Person_KVC.m in Sources */, 18E524BA1F443EF000514693 /* CoreAnimationViewController.m in Sources */, + F83F2104216BAFD400DFA548 /* YNSuspendCustomNavOrSuspendPositionVC.m in Sources */, 18E5246D1F443EF000514693 /* UPStackMenu.m in Sources */, 18E524371F443EEF00514693 /* QRCodeGenerateViewController.m in Sources */, 18CCA1952090221400300966 /* NSMutableDictionary+Safe.m in Sources */, @@ -6132,6 +6422,7 @@ 18E525AF1F443EF200514693 /* AFSecurityPolicy.m in Sources */, 18E5253B1F443EF100514693 /* HomeModel.m in Sources */, 18E525211F443EF100514693 /* YFAnswerBox.m in Sources */, + F83F214E216BB8C400DFA548 /* MJRefreshStateHeader.m in Sources */, 18E526021F4442EC00514693 /* JLROptionalRouteParser.m in Sources */, 18E525EF1F443EF200514693 /* AppDelegate.m in Sources */, 18E523BA1F443EEF00514693 /* YFViewLayoutViewController.m in Sources */, @@ -6144,6 +6435,7 @@ 18E525C01F443EF200514693 /* FMResultSet.m in Sources */, 18E525711F443EF100514693 /* YFEmptyDataSetViewController.m in Sources */, 18E524B51F443EF000514693 /* CABasicAnimationViewController.m in Sources */, + F83F2147216BB8C400DFA548 /* MJRefreshBackGifFooter.m in Sources */, 18E525291F443EF100514693 /* JLSubjectDataController.m in Sources */, 18E523641F443EEF00514693 /* SKTag.m in Sources */, 18E5241B1F443EEF00514693 /* Case8DataEntity.m in Sources */, @@ -6153,6 +6445,7 @@ 18E526031F4442EC00514693 /* JLRoutes.m in Sources */, 18E525341F443EF100514693 /* YFTableNodeViewController.m in Sources */, 18E525741F443EF100514693 /* UIImage+EXtension.m in Sources */, + F83F2106216BAFD400DFA548 /* YNNavPageVC.m in Sources */, 18E524AB1F443EF000514693 /* YFNormalAnimationsViewController.m in Sources */, 18E523AB1F443EEF00514693 /* RGCollectionViewCell.m in Sources */, 18E524571F443EF000514693 /* SYEmotion.m in Sources */, @@ -6162,7 +6455,6 @@ 18E5249D1F443EF000514693 /* YFWaterRipple2ViewController.m in Sources */, 18E523C71F443EEF00514693 /* YSLDraggableCardContainer.m in Sources */, 18E524221F443EEF00514693 /* Student_MC.m in Sources */, - 18E525DA1F443EF200514693 /* MJRefreshFooterView.m in Sources */, 18E524941F443EF000514693 /* RippleView.m in Sources */, 18E5258F1F443EF200514693 /* W3CViewController.m in Sources */, 18E524AF1F443EF000514693 /* KYPopTransition.m in Sources */, @@ -6180,6 +6472,7 @@ 18E525441F443EF100514693 /* LoginPresenter.m in Sources */, 18E5240A1F443EEF00514693 /* Dog_KVC.m in Sources */, 1868EE952066263800EEE713 /* JS_MessageHandlerViewController.m in Sources */, + F83F214F216BB8C400DFA548 /* MJRefreshGifHeader.m in Sources */, 18E5242E1F443EEF00514693 /* Teacher_MMF.m in Sources */, 18E5257F1F443EF100514693 /* QueryTableViewController.m in Sources */, 18E5237E1F443EEF00514693 /* YFSphereTagCloud.m in Sources */, @@ -6191,8 +6484,10 @@ 18E5245E1F443EF000514693 /* YFLabel.m in Sources */, 18E523E91F443EEF00514693 /* RZSegmentControlMoveFadeAnimationController.m in Sources */, 18E524F51F443EF100514693 /* YFDynamicItemViewController.m in Sources */, + F83F2103216BAFD400DFA548 /* BaseTableViewVC.m in Sources */, F8177DCA21077322005E5109 /* GCDBaseViewController.m in Sources */, 18E523D41F443EEF00514693 /* ITRAirSideMenu.m in Sources */, + F83F210B216BAFD400DFA548 /* YNTopPageVC.m in Sources */, 18E5242B1F443EEF00514693 /* Doctor_MMF.m in Sources */, 18E524FE1F443EF100514693 /* YFFlexViewController.m in Sources */, 18E5245A1F443EF000514693 /* SYEmotionContentView.m in Sources */, @@ -6208,6 +6503,7 @@ 18E5236E1F443EEF00514693 /* YFLazyInViewController.m in Sources */, 18E525F01F443EF200514693 /* main.m in Sources */, 18E523DA1F443EEF00514693 /* LTSlidingViewCoverflowTransition.m in Sources */, + F83F214C216BB8C400DFA548 /* MJRefreshAutoNormalFooter.m in Sources */, 18E5259E1F443EF200514693 /* HelpTableCell.swift in Sources */, 18E523FE1F443EEF00514693 /* ZWIntroductionViewController.m in Sources */, 18E524401F443EF000514693 /* UILabel+Associate.m in Sources */, @@ -6239,6 +6535,7 @@ 18E524261F443EEF00514693 /* MultipleCombination.m in Sources */, 18E525BB1F443EF200514693 /* UIWebView+AFNetworking.m in Sources */, 18E5253A1F443EF100514693 /* MVPCounterViewController.m in Sources */, + F83F2108216BAFD400DFA548 /* YNSuspendTopPauseBaseTableViewVC.m in Sources */, F84A4E0E2158CEC30025D4EB /* UIImageView+WebCache.m in Sources */, 18E523731F443EEF00514693 /* YFCycleView.m in Sources */, F84A4DE22158CDD00025D4EB /* TAPageControl.m in Sources */, @@ -6250,9 +6547,11 @@ 18E524201F443EEF00514693 /* Dancer_MC.m in Sources */, 18E524311F443EEF00514693 /* Fish_MP.m in Sources */, 18E5244F1F443EF000514693 /* YFStatisticalCodeViewController.m in Sources */, + F83F2146216BB8C400DFA548 /* UIView+MJExtension.m in Sources */, 18E525111F443EF100514693 /* UIImage+ImageEffects.m in Sources */, 18E523BC1F443EEF00514693 /* YFBaiduViewTransitionViewController.m in Sources */, 18E525551F443EF100514693 /* ModelOne.m in Sources */, + F83F210A216BAFD400DFA548 /* YNSuspendCenterPageVC.m in Sources */, 18E5242C1F443EEF00514693 /* Lawyer_MMF.m in Sources */, 18E5242F1F443EEF00514693 /* Bird_MP.m in Sources */, 18E525CB1F443EF200514693 /* ViewController+MASAdditions.m in Sources */, @@ -6266,6 +6565,7 @@ 18E524C01F443EF000514693 /* HyLoglnButton.m in Sources */, 18E523D91F443EEF00514693 /* LTSlidingViewController.m in Sources */, 18E5239B1F443EEF00514693 /* YFHealineViewController.m in Sources */, + F83F2150216BB8C400DFA548 /* MJRefreshFooter.m in Sources */, 18E523C81F443EEF00514693 /* JCFlipPage.m in Sources */, 18E525C41F443EF200514693 /* MASConstraintMaker.m in Sources */, F84A4E062158CEC30025D4EB /* SDWebImageDownloader.m in Sources */, @@ -6278,6 +6578,8 @@ 18E5256F1F443EF100514693 /* UIScrollView+EmptyDataSet.m in Sources */, 18E524171F443EEF00514693 /* Case6ItemView.m in Sources */, 18E524C11F443EF000514693 /* HyTransitions.m in Sources */, + F83F2154216BB8C400DFA548 /* MJRefreshComponent.m in Sources */, + F83F20FF216BAFD400DFA548 /* YNLoadPageVC.m in Sources */, 18E523B91F443EEF00514693 /* YFWaterflowViewController.m in Sources */, 18E523581F443EEF00514693 /* YFAllRoundButtonVC.m in Sources */, 18E5249A1F443EF000514693 /* RippleTableViewController.m in Sources */, @@ -6302,6 +6604,7 @@ 18E5240C1F443EEF00514693 /* Nure_KVO.m in Sources */, 18E5247B1F443EF000514693 /* XRPopMenuView.m in Sources */, 18E5252C1F443EF100514693 /* JLHomePracticeBannerView.m in Sources */, + F83F214D216BB8C400DFA548 /* MJRefreshNormalHeader.m in Sources */, 1868EE9C2066269C00EEE713 /* HLAudioPlayer.m in Sources */, F84A4E052158CEC30025D4EB /* UIImageView+HighlightedWebCache.m in Sources */, 18E525261F443EF100514693 /* YFResizableView.m in Sources */, @@ -6312,6 +6615,7 @@ 18E523661F443EEF00514693 /* SKTagView.m in Sources */, 18E5254B1F443EF100514693 /* YiRefreshFooter.m in Sources */, 18E5253D1F443EF100514693 /* MVPHomeViewController.m in Sources */, + F83F210C216BAFD400DFA548 /* YNTestBaseVC.m in Sources */, 18E525B01F443EF200514693 /* AFURLConnectionOperation.m in Sources */, 18E524431F443EF000514693 /* YFPerson.m in Sources */, 18E5237D1F443EEF00514693 /* DBSphereView.m in Sources */, @@ -6322,7 +6626,6 @@ 18E523DB1F443EEF00514693 /* LTSlidingViewZoomTransition.m in Sources */, 18E525281F443EF100514693 /* JLHomePracticeDataController.m in Sources */, 18E5245F1F443EF000514693 /* YFLittleProjectVC03.m in Sources */, - 18E525D81F443EF200514693 /* MJRefreshBaseView.m in Sources */, 18E525CF1F443EF200514693 /* MJIvar.m in Sources */, 18E523CA1F443EEF00514693 /* JCFlipViewAnimationHelper.m in Sources */, 18E525641F443EF100514693 /* EcoRouter.m in Sources */, @@ -6334,21 +6637,27 @@ 18CCA1942090221400300966 /* NSMutableArray+Safe.m in Sources */, 18E523861F443EEF00514693 /* AWCollectionViewDialLayout.m in Sources */, 18E5254F1F443EF100514693 /* YiTableViewDataSource.m in Sources */, + F83F210D216BAFD400DFA548 /* YNTestPageVC.m in Sources */, 18E524121F443EEF00514693 /* Case3ViewController.m in Sources */, + F83F214B216BB8C400DFA548 /* MJRefreshAutoGifFooter.m in Sources */, 18E524141F443EEF00514693 /* Case4DataEntity.m in Sources */, 18E523761F443EEF00514693 /* YFPrinterEffectViewController.m in Sources */, 18E523C61F443EEF00514693 /* YSLCardView.m in Sources */, + F83F2141216BB8C400DFA548 /* UIScrollView+MJRefresh.m in Sources */, 18E524391F443EEF00514693 /* QRCodeViewController.m in Sources */, 18E523DF1F443EEF00514693 /* RZUniqueTransition.m in Sources */, 18E523EE1F443EEF00514693 /* UIImage+RZTransitionsFastImageBlur.m in Sources */, 18E526191F4442F600514693 /* ThreeViewController.m in Sources */, 18E525411F443EF100514693 /* Presenter.m in Sources */, 18E525971F443EF200514693 /* YFEightQueensVC.m in Sources */, + F83F214A216BB8C400DFA548 /* MJRefreshAutoStateFooter.m in Sources */, 18E525D01F443EF200514693 /* MJMember.m in Sources */, F84A4DC4215804610025D4EB /* YNPageHeaderScrollView.m in Sources */, + F83F2111216BB69700DFA548 /* FTPopOverMenu.m in Sources */, F84A4DC0215804610025D4EB /* YNPageViewController.m in Sources */, 18E524601F443EF000514693 /* YFRecordData.m in Sources */, 18E5248A1F443EF000514693 /* YFRippleViewController.m in Sources */, + F83F2109216BAFD400DFA548 /* YNSuspendTopPausePageVC.m in Sources */, 18E5247D1F443EF000514693 /* YFPopMenuViewController.m in Sources */, 18E523EB1F443EEF00514693 /* RZZoomAlphaAnimationController.m in Sources */, 18E525BD1F443EF200514693 /* FMDatabaseAdditions.m in Sources */, @@ -6361,10 +6670,11 @@ 18E523611F443EEF00514693 /* UIButton+touch.m in Sources */, 18E524FA1F443EF100514693 /* UINTViewController.m in Sources */, 18E524AE1F443EF000514693 /* KYPopInteractiveTransition.m in Sources */, + F83F2101216BAFD400DFA548 /* BasePageViewController.m in Sources */, 18E524231F443EEF00514693 /* ClassA.m in Sources */, + F83F2153216BB8C400DFA548 /* MJRefreshAutoFooter.m in Sources */, 18E525751F443EF100514693 /* YFImageCategoryViewController.m in Sources */, 18E525131F443EF100514693 /* YFBlurtView.m in Sources */, - 18E525D91F443EF200514693 /* MJRefreshConst.m in Sources */, 18E523F31F443EEF00514693 /* RZSimpleColorViewController.m in Sources */, 18E524251F443EEF00514693 /* ClassC.m in Sources */, 18E523B81F443EEF00514693 /* YFWaterflowLayout.m in Sources */, @@ -6391,6 +6701,7 @@ 18E524871F443EF000514693 /* YFSnowViewController.m in Sources */, 18E523D61F443EEF00514693 /* ITRLeftMenuController.m in Sources */, 18E524701F443EF000514693 /* YFAnimationVC04.m in Sources */, + F83F2145216BB8C400DFA548 /* NSBundle+MJRefresh.m in Sources */, 18E523651F443EEF00514693 /* SKTagButton.m in Sources */, 18E523EC1F443EEF00514693 /* RZZoomBlurAnimationController.m in Sources */, 18E524071F443EEF00514693 /* Author_KVC.m in Sources */, @@ -6400,14 +6711,17 @@ 18E525091F443EF100514693 /* RootViewController.m in Sources */, 18E525981F443EF200514693 /* YFFalseCoinVC.m in Sources */, 18E523671F443EEF00514693 /* YFAutolayoutTagViewController.m in Sources */, + F83F2148216BB8C400DFA548 /* MJRefreshBackStateFooter.m in Sources */, 18E523CC1F443EEF00514693 /* YFFlipPageViewController.m in Sources */, 18E525B61F443EF200514693 /* UIAlertView+AFNetworking.m in Sources */, 18E523CE1F443EEF00514693 /* HHContentScrollView.m in Sources */, + F83F2144216BB8C400DFA548 /* UIScrollView+MJExtension.m in Sources */, 18E524CC1F443EF100514693 /* SYTabBar.m in Sources */, 18E524F01F443EF100514693 /* RAViewController.m in Sources */, 18E523D51F443EEF00514693 /* ITRFirstViewController.m in Sources */, 18E525911F443EF200514693 /* DemoDetailViewController.m in Sources */, F84A4DC1215804610025D4EB /* YNPageConfigration.m in Sources */, + F83F2100216BAFD400DFA548 /* BaseCollectionViewVC.m in Sources */, 18E525941F443EF200514693 /* YFNetworkRequestViewController.m in Sources */, F84A4DDF2158CDD00025D4EB /* UIView+SDExtension.m in Sources */, 18E524B71F443EF000514693 /* CATransformViewController.m in Sources */, @@ -6423,12 +6737,14 @@ 18E5254D1F443EF100514693 /* YiTableViewController.m in Sources */, 18E523D21F443EEF00514693 /* HHHorizontalPagingView.m in Sources */, 18E5253E1F443EF100514693 /* HttpClient.m in Sources */, + F83F2107216BAFD400DFA548 /* YNScrollMenuStyleVC.m in Sources */, 18E525C51F443EF200514693 /* MASLayoutConstraint.m in Sources */, 18E524711F443EF000514693 /* YFRadialMenu.m in Sources */, 18E5243B1F443EF000514693 /* YFQuartz2DViewController.m in Sources */, 18E524611F443EF000514693 /* YFCard.m in Sources */, 18E524191F443EEF00514693 /* Case7ViewController.m in Sources */, 1868EEA02066349000EEE713 /* JS_JavaScriptCoreViewController.m in Sources */, + F83F2102216BAFD400DFA548 /* BaseViewController.m in Sources */, 18E525001F443EF100514693 /* YFPushBehaviorViewController.m in Sources */, 18E524271F443EEF00514693 /* Business.m in Sources */, 18E524B11F443EF000514693 /* YFPushTransitionViewController.m in Sources */, @@ -6438,27 +6754,28 @@ 18E525081F443EF100514693 /* SecondMenuData.m in Sources */, 18E523811F443EEF00514693 /* YFSphereViewController.m in Sources */, 18E5258C1F443EF200514693 /* LccButton.m in Sources */, + F83F20FE216BAFD400DFA548 /* YNSuspendTopBaseTableViewVC.m in Sources */, 18E5259B1F443EF200514693 /* YFSortVC.m in Sources */, 18E523DE1F443EEF00514693 /* RZTransitionsNavigationController.m in Sources */, 18E525691F443EF100514693 /* YFDesignPatternViewController.m in Sources */, 18E5249F1F443EF000514693 /* YFCircleViewController.m in Sources */, 18E525A71F443EF200514693 /* UIView+Extension.m in Sources */, - F84A4DCD2158C4ED0025D4EB /* YFPageViewOneViewController.m in Sources */, 18E525771F443EF100514693 /* FMDBBaseUseViewController.m in Sources */, 18E5259A1F443EF200514693 /* YFMonkeyKingVC.m in Sources */, 18E525F21F443EF200514693 /* YFHomeViewController.m in Sources */, 18E5237F1F443EEF00514693 /* PFGoldenSectionSpiral.m in Sources */, + F83F20FD216BAFD400DFA548 /* YNSuspendTopPageVC.m in Sources */, 18E523991F443EEF00514693 /* HWLineLayout.m in Sources */, 18E523FD1F443EEF00514693 /* YFGradualChangeViewController.m in Sources */, 18E524861F443EF000514693 /* YFEmitterSnowCell.m in Sources */, 18E523D81F443EEF00514693 /* YFITRAirSideViewController.m in Sources */, + F83F2105216BAFD400DFA548 /* DemosListVC.m in Sources */, 18E525371F443EF100514693 /* YFAliViewController.m in Sources */, 18E524C41F443EF000514693 /* YFLoginSecondViewController.m in Sources */, F84A4DC5215804610025D4EB /* YNPageCollectionView.m in Sources */, 18E523E11F443EEF00514693 /* RZHorizontalInteractionController.m in Sources */, 18E524CA1F443EF100514693 /* SYMineViewController.m in Sources */, 18E524241F443EEF00514693 /* ClassB.m in Sources */, - 18E525DC1F443EF200514693 /* UIScrollView+Extension.m in Sources */, 18E5255B1F443EF100514693 /* SecondTableViewCell.m in Sources */, 18E5248E1F443EF000514693 /* YFOneWaterWaveViewController.m in Sources */, 18E524ED1F443EF100514693 /* RACollectionViewCell.m in Sources */, @@ -6508,6 +6825,7 @@ 18E5242A1F443EEF00514693 /* MultipleInheritanceViewController.m in Sources */, 18E523C91F443EEF00514693 /* JCFlipPageView.m in Sources */, 18E525B41F443EF200514693 /* AFNetworkActivityIndicatorManager.m in Sources */, + F83F2142216BB8C400DFA548 /* MJRefreshConst.m in Sources */, 18E524981F443EF000514693 /* GLIRViewController.m in Sources */, 18E524821F443EF000514693 /* YFPublicParticleCell.m in Sources */, 18E524EF1F443EF100514693 /* RACollectionViewTripletLayout.m in Sources */, @@ -6551,13 +6869,13 @@ 18E525D31F443EF200514693 /* MJTypeEncoding.m in Sources */, 18CCA1972090221400300966 /* NSDictionary+Safe.m in Sources */, 18E523781F443EEF00514693 /* YFRatingBar.m in Sources */, - 18E525DE1F443EF200514693 /* UIView+Extension.m in Sources */, 18E523CF1F443EEF00514693 /* HHContentTableView.m in Sources */, 18E525271F443EF100514693 /* JLBaseDataController.m in Sources */, 18E5245B1F443EF000514693 /* SYEmotionKeyboard.m in Sources */, 18E5244C1F443EF000514693 /* MsgForwardingViewController.m in Sources */, 18E524881F443EF000514693 /* YFEmitterViewController.m in Sources */, 18E524131F443EEF00514693 /* Case4Cell.m in Sources */, + F83F2152216BB8C400DFA548 /* MJRefreshBackFooter.m in Sources */, 18E5252B1F443EF100514693 /* JLHomePracticeActivityView.m in Sources */, 18E523AE1F443EEF00514693 /* SSStackedPageView.m in Sources */, 18E5243F1F443EF000514693 /* YFAddMethodViewController.m in Sources */, diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/.DS_Store" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/.DS_Store" index adba3fd..3f06909 100644 Binary files "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/.DS_Store" and "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/.DS_Store" differ diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/HorizontalScroll/HWCollectionViewCell.xib" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/HorizontalScroll/HWCollectionViewCell.xib" index 29b39d3..542df85 100644 --- "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/HorizontalScroll/HWCollectionViewCell.xib" +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/HorizontalScroll/HWCollectionViewCell.xib" @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -12,6 +16,7 @@ + - - + diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/Waterflow/YFWaterflowViewController.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/Waterflow/YFWaterflowViewController.m" index 14335ec..158a414 100644 --- "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/Waterflow/YFWaterflowViewController.m" +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/Waterflow/YFWaterflowViewController.m" @@ -57,8 +57,9 @@ - (void)viewDidLoad { // [self.collectionView addFooterWithCallback:^{ // NSLog(@"进入shang拉刷新状态"); // }]; - [self.collectionView addHeaderWithTarget:self action:@selector(loadNewShops)]; - [self.collectionView addFooterWithTarget:self action:@selector(loadMoreShops)]; + + self.collectionView.mj_header = [MJRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewShops)]; + self.collectionView.mj_footer = [MJRefreshFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreShops)]; } - (void)loadNewShops @@ -69,7 +70,8 @@ - (void)loadNewShops [self.collectionView reloadData]; // stop refresh - [self.collectionView headerEndRefreshing]; +// [self.collectionView headerEndRefreshing]; + [self.collectionView.mj_header endRefreshing]; }); } @@ -81,7 +83,7 @@ - (void)loadMoreShops [self.collectionView reloadData]; // stop refresh - [self.collectionView footerEndRefreshing]; + [self.collectionView.mj_footer endRefreshing]; }); } @@ -134,4 +136,4 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa -@end \ No newline at end of file +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.h" new file mode 100755 index 0000000..f33cf3d --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.h" @@ -0,0 +1,15 @@ +// +// BaseCollectionViewVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface BaseCollectionViewVC : UIViewController + +@property (nonatomic, strong) UICollectionView *collectionView; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.m" new file mode 100755 index 0000000..91911e6 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseCollectionViewVC.m" @@ -0,0 +1,110 @@ +// +// BaseCollectionViewVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseCollectionViewVC.h" +#import "MJRefresh.h" +#define randomColor random(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) +#define random(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0] +@interface BaseCollectionViewVC () + +@end + +@implementation BaseCollectionViewVC + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"id"]; + [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:HeaderID]; + [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:FooterID]; + [self.view addSubview:self.collectionView]; + [self addCollectionViewRefresh]; +} + +- (void)addCollectionViewRefresh { + + __weak typeof (self) weakSelf = self; + + self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.collectionView.mj_header endRefreshing]; + }); + }]; + + self.collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.collectionView.mj_footer endRefreshing]; + }); + }]; +} + +#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource + +static NSString *HeaderID = @"header"; + +static NSString *FooterID = @"footer"; + +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { + if (kind == UICollectionElementKindSectionHeader) { + UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:HeaderID forIndexPath:indexPath]; + headerView.backgroundColor = randomColor; + return headerView; + } else { // 返回每一组的尾部视图 + UICollectionReusableView *footerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:FooterID forIndexPath:indexPath]; + + footerView.backgroundColor = randomColor; + return footerView; + } +} + +/// collectinView section header 在高版本存在系统BUG,需要设置zPosition = 0.0 +- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath { + view.layer.zPosition = 0.0; +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { + return (CGSize){YFScreen.width * 0.5, 22}; +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { + return (CGSize){YFScreen.width, 22}; +} + +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 3; +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return 20; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"id" forIndexPath:indexPath]; + cell.backgroundColor = randomColor; + return cell; +} + +- (UICollectionView *)collectionView { + if (!_collectionView) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(100, 100); + + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) collectionViewLayout:layout]; + _collectionView.dataSource = self; + _collectionView.delegate = self; + _collectionView.backgroundColor = [UIColor whiteColor]; + } + return _collectionView; +} + +- (void)dealloc { + NSLog(@"----- %@ delloc", self.class); +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.h" new file mode 100755 index 0000000..b375578 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.h" @@ -0,0 +1,13 @@ +// +// BasePageViewController.h +// YNPageViewController +// +// Created by ZYN on 2018/7/27. +// Copyright © 2018年 yongneng. All rights reserved. +// 中间层 - 为了演示API功能操作 + +#import "YNPageViewController.h" + +@interface BasePageViewController : YNPageViewController + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.m" new file mode 100755 index 0000000..2f733b8 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BasePageViewController.m" @@ -0,0 +1,122 @@ +// +// BasePageViewController.m +// YNPageViewController +// +// Created by ZYN on 2018/7/27. +// Copyright © 2018年 yongneng. All rights reserved. +// 中间层 - 为了演示API功能操作 + +#import "BasePageViewController.h" +#import "BaseTableViewVC.h" +#import "UIView+YNPageExtend.h" +#import "FTPopOverMenu.h" +@interface BasePageViewController () + +@end + +@implementation BasePageViewController + +#pragma mark - Life Cycle +- (void)viewDidLoad { + [super viewDidLoad]; + + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] + initWithTitle:@"功能操作" + style:UIBarButtonItemStylePlain + target:self action:@selector(rightButtonOnClick:event:)]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +#pragma mark - Event Response + +#pragma mark - --Notification Event Response + +#pragma mark - --Button Event Response +- (void)rightButtonOnClick:(UIBarButtonItem *)item event:(UIEvent *)event { + __weak typeof(self) weakSelf = self; + [FTPopOverMenu showFromEvent:event withMenuArray:@[@"滚动到顶部", + @"更新菜单栏标题", + @"添加页面", + @"删除页面", + @"调整标题顺序", + @"reload", + @"刷新头部高度"] doneBlock:^(NSInteger selectedIndex) { + switch (selectedIndex) { + case 0: + { + [weakSelf scrollToTop:YES]; + } + break; + case 1: + { +// [self updateMenuItemTitle:@"更新的标题" index:0]; + [weakSelf updateMenuItemTitles:@[@"足球", @"棒球", @"篮球"]]; + } + break; + case 2: + { + BaseTableViewVC *vc_1 = [[BaseTableViewVC alloc] init]; + vc_1.cellTitle = @"插入页新面"; + [weakSelf insertPageChildControllersWithTitles:@[@"插入页面"] controllers:@[vc_1] index:1]; + } + break; + case 3: + { +// [self removePageControllerWithTitle:@"帽子"]; + [weakSelf removePageControllerWithIndex:0]; + } + break; + case 4: + { + [weakSelf replaceTitlesArrayForSort:@[@"帽子", @"衣服", @"鞋子"]]; + } + break; + case 5: + { + weakSelf.titlesM = @[@"刷新页面", @"棒球", @"篮球"].mutableCopy; + weakSelf.config.menuHeight = 100; + weakSelf.pageIndex = 0; + [weakSelf reloadData]; + } + break; + case 6: + { + weakSelf.headerView.yn_height = 300; + [weakSelf reloadData]; + } + break; + } + } dismissBlock:nil]; +} +#pragma mark - --Gesture Event Response + +#pragma mark - System Delegate + +#pragma mark - Custom Delegate + +#pragma mark - Public Function + +#pragma mark - Private Function + +#pragma mark - Getter and Setter + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.h" new file mode 100755 index 0000000..735d6cf --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.h" @@ -0,0 +1,19 @@ +// +// BaseVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface BaseTableViewVC : UIViewController + +@property (nonatomic, copy) NSString *cellTitle; + +@property (nonatomic, strong) UITableView *tableView; + +- (void)addTableViewRefresh; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.m" new file mode 100755 index 0000000..d4ac2e3 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseTableViewVC.m" @@ -0,0 +1,196 @@ +// +// BaseVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseTableViewVC.h" +#import "MJRefresh.h" +#import "BaseViewController.h" +#import "UIViewController+YNPageExtend.h" + +/// 开启刷新头部高度 +#define kOpenRefreshHeaderViewHeight 0 + +#define kCellHeight 44 + +@interface BaseTableViewVC () + +@property (nonatomic, strong) NSMutableArray *dataArray; +/// 占位cell高度 +@property (nonatomic, assign) CGFloat placeHolderCellHeight; + +@end + +@implementation BaseTableViewVC + +- (void)viewDidLoad { + [super viewDidLoad]; + [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"id"]; + [self.view addSubview:self.tableView]; + + _dataArray = @[].mutableCopy; + /// 加载数据 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + for (int i = 0; i < 30; i++) { + [_dataArray addObject:@""]; + } + [self.tableView reloadData]; + }); + [self addTableViewRefresh]; + + + +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self.tableView.mj_header beginRefreshing]; +// }); +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +/// 添加下拉刷新 +- (void)addTableViewRefresh { + + __weak typeof (self) weakSelf = self; + + self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + for (int i = 0; i < 3; i++) { + [weakSelf.dataArray addObject:@""]; + } + [weakSelf.tableView reloadData]; + if (kOpenRefreshHeaderViewHeight) { + [weakSelf suspendTopReloadHeaderViewHeight]; + } else { + [weakSelf.tableView.mj_header endRefreshing]; + } + + }); + }]; + + self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + for (int i = 0; i < 3; i++) { + [weakSelf.dataArray addObject:@""]; + } + [weakSelf.tableView reloadData]; + [weakSelf.tableView.mj_footer endRefreshing]; + }); + }]; +} + +#pragma mark - 悬浮Center刷新高度方法 +- (void)suspendTopReloadHeaderViewHeight { + /// 布局高度 + CGFloat netWorkHeight = 300; + __weak typeof (self) weakSelf = self; + + /// 结束刷新时 刷新 HeaderView高度 + [self.tableView.mj_header endRefreshingWithCompletionBlock:^{ + YNPageViewController *VC = weakSelf.yn_pageViewController; + if (VC.headerView.frame.size.height != netWorkHeight) { + VC.headerView.frame = CGRectMake(0, 0, YFScreen.width, netWorkHeight); + [VC reloadSuspendHeaderViewFrame]; + } + }]; +} +#pragma mark - 求出占位cell高度 +- (CGFloat)placeHolderCellHeight { + CGFloat height = self.config.contentHeight - kCellHeight * self.dataArray.count; + height = height < 0 ? 0 : height; + return height; +} + +#pragma mark - UITableViewDelegate UITableViewDataSource + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [UIView new]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [UIView new]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.dataArray.count + 1; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.row < self.dataArray.count) { + return kCellHeight; + } + return self.placeHolderCellHeight; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id"]; + if (indexPath.row < self.dataArray.count) { + cell.textLabel.text = [NSString stringWithFormat:@"%@ section: %zd row:%zd", self.cellTitle ?: @"测试", indexPath.section, indexPath.row]; + return cell; + } else { + cell.textLabel.text = @""; + } + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + BaseViewController *baseVC = [BaseViewController new]; + baseVC.title = @"二级页面"; + [self.navigationController pushViewController:baseVC animated:YES]; +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + } + return _tableView; +} + +- (void)dealloc { + NSLog(@"----- %@ delloc", self.class); +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.h" new file mode 100755 index 0000000..9f767b0 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.h" @@ -0,0 +1,13 @@ +// +// BaseViewController.h +// YNPageViewController +// +// Created by ZYN on 2018/6/26. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface BaseViewController : UIViewController + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.m" new file mode 100755 index 0000000..f8de25a --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/BaseVC/BaseViewController.m" @@ -0,0 +1,24 @@ +// +// BaseViewController.m +// YNPageViewController +// +// Created by ZYN on 2018/6/26. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseViewController.h" + +@interface BaseViewController () + +@end + +@implementation BaseViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; +} + + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.h" new file mode 100755 index 0000000..b5e1f2e --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.h" @@ -0,0 +1,13 @@ +// +// DemosListVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseViewController.h" + +@interface DemosListVC : BaseViewController + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.m" new file mode 100755 index 0000000..fd5560e --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/DemosListVC.m" @@ -0,0 +1,184 @@ +// +// DemosListVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "DemosListVC.h" +#import "YNTestPageVC.h" +#import "YNTopPageVC.h" +#import "YNNavPageVC.h" +#import "YNSuspendCenterPageVC.h" +#import "YNSuspendTopPageVC.h" +#import "YNScrollMenuStyleVC.h" +#import "YNLoadPageVC.h" +#import "YNSuspendTopPausePageVC.h" +#import "YNSuspendCustomNavOrSuspendPositionVC.h" + +typedef NS_ENUM(NSInteger, YNVCType) { + YNVCTypeSuspendCenterPageVC = 1, + YNVCTypeSuspendTopPageVC = 2, + YNVCTypeTopPageVC = 3, + YNVCTypeSuspendTopPausePageVC = 4, + YNVCTypeSuspendCustomNavOrSuspendPosition = 5, + YNVCTypeNavPageVC = 6, + YNVCTypeScrollMenuStyleVC = 7, + YNVCTypeLoadPageVC = 8, + YNVCTypeYNTestPageVC = 100 +}; + +@interface DemosListVC () + +@property (nonatomic, strong) UITableView *tableView; + +@property (nonatomic, strong) NSMutableArray *dataArrayM; + +@end + +@implementation DemosListVC + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = @"Demos"; + [self.view addSubview:self.tableView]; + + self.dataArrayM = @[@{@"title" : @"悬浮样式--下拉刷新在中间", @"type" : @(YNVCTypeSuspendCenterPageVC)}, + @{@"title" : @"悬浮样式--下拉刷新在顶部", @"type" : @(YNVCTypeSuspendTopPageVC)}, + @{@"title" : @"悬浮样式--下拉刷新在顶部(QQ联系人样式)", @"type" : @(YNVCTypeSuspendTopPausePageVC)}, + @{@"title" : @"悬浮样式--自定义导航条或自定义悬浮位置", @"type" : @(YNVCTypeSuspendCustomNavOrSuspendPosition)}, + @{@"title" : @"加载数据后显示页面(隐藏导航条)", @"type" : @(YNVCTypeLoadPageVC)}, + @{@"title" : @"顶部样式", @"type" : @(YNVCTypeTopPageVC)}, + @{@"title" : @"导航条样式", @"type" : @(YNVCTypeNavPageVC)}, + @{@"title" : @"菜单栏样式", @"type" : @(YNVCTypeScrollMenuStyleVC)}, + @{@"title" : @"测试专用", @"type" : @(YNVCTypeYNTestPageVC)} + ].mutableCopy; +} + + +#pragma mark - UITableViewDelegate UITableViewDataSource + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [UIView new]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [UIView new]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.dataArrayM.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + return 55; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *identifier = @"identifier"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:identifier]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.textLabel.font = [UIFont systemFontOfSize:16]; + } + NSDictionary *dict = self.dataArrayM[indexPath.row]; + cell.textLabel.text = dict[@"title"]; + + return cell; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + NSDictionary *dict = self.dataArrayM[indexPath.row]; + NSString *title = dict[@"title"]; + YNVCType type = [dict[@"type"] integerValue]; + UIViewController *vc = nil; + switch (type) { + case YNVCTypeSuspendTopPageVC: + { + vc = [YNSuspendTopPageVC suspendTopPageVC] ; + } + break; + case YNVCTypeSuspendCenterPageVC: + { + vc = [YNSuspendCenterPageVC suspendCenterPageVC]; + } + break; + case YNVCTypeSuspendTopPausePageVC: + { + vc = [YNSuspendTopPausePageVC suspendTopPausePageVC]; + } + break; + case YNVCTypeSuspendCustomNavOrSuspendPosition: + { + vc = [YNSuspendCustomNavOrSuspendPositionVC new]; + } + break; + case YNVCTypeTopPageVC: + { + vc = [YNTopPageVC topPageVC]; + } + break; + case YNVCTypeNavPageVC: + { + vc = [YNNavPageVC navPageVC]; + } + break; + case YNVCTypeLoadPageVC: + { + vc = [YNLoadPageVC new]; + } + break; + case YNVCTypeScrollMenuStyleVC: { + vc = [YNScrollMenuStyleVC new]; + } + break; + case YNVCTypeYNTestPageVC: + { + vc = [YNTestPageVC testPageVC]; + } + break; + } + if (vc) { + vc.title = title; + [self.navigationController pushViewController:vc animated:YES]; + } +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped]; + _tableView.delegate = self; + _tableView.dataSource = self; + } + return _tableView; +} + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.h" new file mode 100755 index 0000000..17e9288 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.h" @@ -0,0 +1,13 @@ +// +// LoadPageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/26. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseViewController.h" + +@interface YNLoadPageVC : BaseViewController + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.m" new file mode 100755 index 0000000..2a72099 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/LoadPageVC/YNLoadPageVC.m" @@ -0,0 +1,89 @@ +// +// LoadPageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/26. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNLoadPageVC.h" +#import "YNPageViewController.h" +#import "YNSuspendCenterPageVC.h" +#import "YNTopPageVC.h" +#import "UIView+YNPageExtend.h" + +/// 是否隐藏导航条 +#define kHiddenNavigationBar 1 + +@interface YNLoadPageVC () + +@property (nonatomic, strong) UIActivityIndicatorView *indicatorView; + +@end + +@implementation YNLoadPageVC + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + if (kHiddenNavigationBar) { + [self.navigationController setNavigationBarHidden:YES animated:animated]; + } +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + if (kHiddenNavigationBar) { + [self.navigationController setNavigationBarHidden:NO animated:animated]; + } +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + _indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; + _indicatorView.frame = CGRectMake(0, 0, 80, 80); + _indicatorView.center = self.view.center; + [_indicatorView startAnimating]; + + /// 模拟器请求 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + [self setupPageVC]; + + [_indicatorView stopAnimating]; + [_indicatorView setHidden:YES]; + }); + + [self.view addSubview:_indicatorView]; + +} + +- (void)setupPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionCenter; + configration.headerViewCouldScale = YES; + // configration.headerViewScaleMode = YNPageHeaderViewScaleModeCenter; + configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop; + /// 控制tabbar 和 nav + configration.showTabbar = NO; + configration.showNavigation = NO; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + configration.suspenOffsetY = 64; + YNSuspendCenterPageVC *pageVC = [YNSuspendCenterPageVC suspendCenterPageVCWithConfig:configration]; + + /// 作为自控制器加入到当前控制器 + [pageVC addSelfToParentViewController:self]; + + /// 如果隐藏了导航条可以 适当改y值 + if (kHiddenNavigationBar) { +// pageVC.view.yn_y = kYNPAGE_NAVHEIGHT; + } + + +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.h" new file mode 100755 index 0000000..fca1178 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.h" @@ -0,0 +1,15 @@ +// +// YNNavPageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BasePageViewController.h" + +@interface YNNavPageVC : BasePageViewController + ++ (instancetype)navPageVC; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.m" new file mode 100755 index 0000000..7ec8904 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/NavPageVC/YNNavPageVC.m" @@ -0,0 +1,72 @@ +// +// YNNavPageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNNavPageVC.h" +#import "BaseTableViewVC.h" + +@interface YNNavPageVC () + +@end + +@implementation YNNavPageVC + +- (void)viewDidLoad { + [super viewDidLoad]; + +} + ++ (instancetype)navPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleNavigation; + configration.headerViewCouldScale = YES; + configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + /// 设置菜单栏宽度 + configration.menuWidth = 150; + + YNNavPageVC *vc = [YNNavPageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = vc; + vc.delegate = vc; + + return vc; +} + + ++ (NSArray *)getArrayVCs { + + BaseTableViewVC *vc_1 = [[BaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + BaseTableViewVC *vc_2 = [[BaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + BaseTableViewVC *vc_3 = [[BaseTableViewVC alloc] init]; + vc_3.cellTitle = @"帽子"; + + return @[vc_1, vc_2, vc_3]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服", @"帽子3"]; +} + +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + BaseTableViewVC *baseVC = pageViewController.controllersM[index]; + return [baseVC tableView]; +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.h" new file mode 100755 index 0000000..ce02666 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.h" @@ -0,0 +1,13 @@ +// +// ScrollMenuStyleVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/25. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface YNScrollMenuStyleVC : UIViewController + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.m" new file mode 100755 index 0000000..d3f42d0 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/ScrollMenuStyleVC/YNScrollMenuStyleVC.m" @@ -0,0 +1,126 @@ +// +// ScrollMenuStyleVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/25. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNScrollMenuStyleVC.h" +#import "YNPageScrollMenuView.h" +#import "YNPageConfigration.h" +#import "UIView+YNPageExtend.h" + +@interface YNScrollMenuStyleVC () + +@property (nonatomic, strong) UIScrollView *scrollView; + +@end + +@implementation YNScrollMenuStyleVC + +- (void)viewDidLoad { + [super viewDidLoad]; + + _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, self.view.frame.size.height)]; + _scrollView.backgroundColor = [UIColor groupTableViewBackgroundColor]; + + /// style 1 + YNPageConfigration *style_config_1 = [YNPageConfigration defaultConfig]; + YNPageScrollMenuView *style_1 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, 0, YFScreen.width, 44) titles:@[@"JAVA", @"Object-C", @"JS"].mutableCopy configration:style_config_1 delegate:self currentIndex:0]; + + + /// style 2 + YNPageConfigration *style_config_2 = [YNPageConfigration defaultConfig]; + style_config_2.showBottomLine = YES; + style_config_2.bottomLineBgColor = [UIColor greenColor]; + style_config_2.bottomLineHeight = 1; + + YNPageScrollMenuView *style_2 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_1.yn_bottom + 20, YFScreen.width, 44) titles:@[@"系统偏好设置", @"网易云音乐", @"有道词典", @"微信", @"QQ游戏", @"QQ邮箱", @"数码测色计"].mutableCopy configration:style_config_2 delegate:self currentIndex:0]; + + /// style 3 + YNPageConfigration *style_config_3 = [YNPageConfigration defaultConfig]; + style_config_3.showBottomLine = YES; + style_config_3.bottomLineBgColor = [UIColor greenColor]; + style_config_3.bottomLineHeight = 1; + style_config_3.scrollMenu = NO; + style_config_3.aligmentModeCenter = NO; + style_config_3.lineWidthEqualFontWidth = NO; + style_config_3.showBottomLine = YES; + style_config_3.itemFont = [UIFont systemFontOfSize:14]; + style_config_3.selectedItemColor = [UIColor redColor]; + style_config_3.normalItemColor = [UIColor blackColor]; + + YNPageScrollMenuView *style_3 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_2.yn_bottom + 20, YFScreen.width, 44) titles:@[@"QQ游戏", @"QQ邮箱", @"数码测色计"].mutableCopy configration:style_config_3 delegate:self currentIndex:0]; + + + /// style 4 + YNPageConfigration *style_config_4 = [YNPageConfigration defaultConfig]; + style_config_4.converColor = [UIColor grayColor]; + style_config_4.showConver = YES; + style_config_4.itemFont = [UIFont systemFontOfSize:14]; + style_config_4.selectedItemColor = [UIColor redColor]; + style_config_4.normalItemColor = [UIColor blackColor]; + style_config_4.itemMaxScale = 1.3; + + + YNPageScrollMenuView *style_4 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_3.yn_bottom + 20, YFScreen.width, 44) titles:@[@"QQ游戏", @"QQ邮箱", @"数码测色计"].mutableCopy configration:style_config_4 delegate:self currentIndex:2]; + + /// style 5 + YNPageConfigration *style_config_5 = [YNPageConfigration defaultConfig]; + style_config_5.selectedItemColor = [UIColor redColor]; + style_config_5.selectedItemFont = [UIFont systemFontOfSize:15]; + + YNPageScrollMenuView *style_5 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_4.yn_bottom + 20, YFScreen.width, 44) titles:@[@"JAVA", @"Object-C", @"JS"].mutableCopy configration:style_config_5 delegate:self currentIndex:1]; + + /// style 6 + YNPageConfigration *style_config_6 = [YNPageConfigration defaultConfig]; + style_config_6.scrollMenu = YES; + style_config_6.aligmentModeCenter = NO; + + YNPageScrollMenuView *style_6 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_5.yn_bottom + 20, YFScreen.width, 44) titles:@[@"JAVA", @"Object-C", @"JS"].mutableCopy configration:style_config_6 delegate:self currentIndex:1]; + + /// style 7 + YNPageConfigration *style_config_7 = [YNPageConfigration defaultConfig]; + style_config_7.scrollMenu = NO; + style_config_7.aligmentModeCenter = NO; + NSMutableArray *buttonArrayM = @[].mutableCopy; + for (int i = 0; i < 3; i++) { + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + [button setImage:[UIImage imageNamed:@"small_icon"] forState:UIControlStateNormal]; + [button setImage:[UIImage imageNamed:@"icon_back_small_black"] forState:UIControlStateSelected]; + + /// seTitle -> sizeToFit -> 自行调整位置 + /// button.imageEdgeInsets = UIEdgeInsetsMake(0, 100, 0, 0); + [buttonArrayM addObject:button]; + } + style_config_7.buttonArray = buttonArrayM; + + + YNPageScrollMenuView *style_7 = [YNPageScrollMenuView pagescrollMenuViewWithFrame:CGRectMake(0, style_6.yn_bottom + 20, YFScreen.width, 44) titles:@[@"带iCON", @"小图标", @"位置"].mutableCopy configration:style_config_7 delegate:self currentIndex:1]; + + [_scrollView addSubview:style_1]; + [_scrollView addSubview:style_2]; + [_scrollView addSubview:style_3]; + [_scrollView addSubview:style_4]; + [_scrollView addSubview:style_5]; + [_scrollView addSubview:style_6]; + [_scrollView addSubview:style_7]; + + [self.view addSubview:_scrollView]; + +} + + +/// 点击item +- (void)pagescrollMenuViewItemOnClick:(UIButton *)label index:(NSInteger)index { + NSLog(@"button = %@, index = %ld", label.titleLabel.text, (long)index); +} + +/// 点击Add按钮 +- (void)pagescrollMenuViewAddButtonAction:(UIButton *)button { + NSLog(@"button = %@", button.titleLabel.text); + +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.h" new file mode 100755 index 0000000..59f3787 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.h" @@ -0,0 +1,18 @@ +// +// SuspendCenterPageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BasePageViewController.h" +#import "YNPageConfigration.h" + +@interface YNSuspendCenterPageVC : BasePageViewController + ++ (instancetype)suspendCenterPageVC; + ++ (instancetype)suspendCenterPageVCWithConfig:(YNPageConfigration *)config; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.m" new file mode 100755 index 0000000..6bdfbe6 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCenterPageVC/YNSuspendCenterPageVC.m" @@ -0,0 +1,138 @@ +// +// SuspendCenterPageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendCenterPageVC.h" +#import "SDCycleScrollView.h" +#import "BaseTableViewVC.h" +#import "BaseCollectionViewVC.h" + +@interface YNSuspendCenterPageVC () + +@property (nonatomic, copy) NSArray *imagesURLs; + +@property (nonatomic, copy) NSArray *cacheKeyArray; + +@end + +@implementation YNSuspendCenterPageVC + +- (void)viewDidLoad { + [super viewDidLoad]; +} +#pragma mark - Event Response + +#pragma mark - --Notification Event Response + +#pragma mark - --Button Event Response + +#pragma mark - --Gesture Event Response + +#pragma mark - System Delegate + +#pragma mark - Custom Delegate + +#pragma mark - Public Function + ++ (instancetype)suspendCenterPageVC { + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionCenter; + configration.headerViewCouldScale = YES; + // configration.headerViewScaleMode = YNPageHeaderViewScaleModeCenter; + configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = true; + configration.showBottomLine = YES; + + return [self suspendCenterPageVCWithConfig:configration]; +} + ++ (instancetype)suspendCenterPageVCWithConfig:(YNPageConfigration *)config { + + YNSuspendCenterPageVC *vc = [YNSuspendCenterPageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:config]; + vc.dataSource = vc; + vc.delegate = vc; + /// 轮播图 + SDCycleScrollView *autoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, YFScreen.width, 200) imageURLStringsGroup:vc.imagesURLs]; + autoScrollView.delegate = vc; + + vc.headerView = autoScrollView; + /// 指定默认选择index 页面 + vc.pageIndex = 2; + + return vc; +} + ++ (NSArray *)getArrayVCs { + + BaseTableViewVC *vc_1 = [[BaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + BaseTableViewVC *vc_2 = [[BaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + BaseCollectionViewVC *vc_3 = [[BaseCollectionViewVC alloc] init]; + + return @[vc_1, vc_2, vc_3]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子1", @"衣服", @"帽子"]; +} + +#pragma mark - Private Function + +#pragma mark - Getter and Setter +- (NSArray *)imagesURLs { + if (!_imagesURLs) { + _imagesURLs = @[ + @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg", + @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg", + @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"]; + } + return _imagesURLs; +} + +- (NSArray *)cacheKeyArray { + if (!_cacheKeyArray) { + _cacheKeyArray = @[@"1", @"2", @"3"]; + } + return _cacheKeyArray; +} + +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + UIViewController *vc = pageViewController.controllersM[index]; + if ([vc isKindOfClass:[BaseTableViewVC class]]) { + return [(BaseTableViewVC *)vc tableView]; + } else { + return [(BaseCollectionViewVC *)vc collectionView]; + } +} +#pragma mark - YNPageViewControllerDelegate +- (void)pageViewController:(YNPageViewController *)pageViewController + contentOffsetY:(CGFloat)contentOffset + progress:(CGFloat)progress { +// NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); +} + +#pragma mark - SDCycleScrollViewDelegate +- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { + NSLog(@"----click 轮播图 index %ld", index); +} + +//- (NSString *)pageViewController:(YNPageViewController *)pageViewController customCacheKeyForIndex:(NSInteger)index { +// return self.cacheKeyArray[index]; +//} + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.h" new file mode 100755 index 0000000..c552d54 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.h" @@ -0,0 +1,14 @@ +// +// YNSuspendCustomNavOrSuspendPositionVC.h +// YNPageViewController +// +// Created by ZYN on 2018/7/19. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseViewController.h" + +@interface YNSuspendCustomNavOrSuspendPositionVC : BaseViewController + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.m" new file mode 100755 index 0000000..55488d6 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendCustomNavOrSuspendPositionVC/YNSuspendCustomNavOrSuspendPositionVC.m" @@ -0,0 +1,165 @@ +// +// YNSuspendCustomNavOrSuspendPositionVC.m +// YNPageViewController +// +// Created by ZYN on 2018/7/19. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendCustomNavOrSuspendPositionVC.h" +#import "YNPageViewController.h" +#import "UIView+YNPageExtend.h" +#import "BaseTableViewVC.h" +#import "BaseCollectionViewVC.h" +#import "SDCycleScrollView.h" +#import "UIColor+Extension.h" + +@interface YNSuspendCustomNavOrSuspendPositionVC () + +@property (nonatomic, strong) UIActivityIndicatorView *indicatorView; + +@property (nonatomic, copy) NSArray *imagesURLs; + +@property (nonatomic, strong) UIView *navView; + +@end + +@implementation YNSuspendCustomNavOrSuspendPositionVC + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + [self.navigationController setNavigationBarHidden:YES animated:animated]; + +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + + [self.navigationController setNavigationBarHidden:NO animated:animated]; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + _indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; + _indicatorView.frame = CGRectMake(0, 0, 80, 80); + _indicatorView.center = self.view.center; + [_indicatorView startAnimating]; + + /// 模拟器请求 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + [self setupPageVC]; + + [_indicatorView stopAnimating]; + [_indicatorView setHidden:YES]; + }); + + [self.view addSubview:_indicatorView]; +} + +- (void)setupPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionCenter; + configration.headerViewCouldScale = YES; + /// 控制tabbar 和 nav + configration.showTabbar = NO; + configration.showNavigation = NO; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + /// 设置悬浮停顿偏移量 + configration.suspenOffsetY = kYNPAGE_NAVHEIGHT; + + + YNPageViewController *vc = [YNPageViewController pageViewControllerWithControllers:self.getArrayVCs + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = self; + vc.delegate = self; + /// 轮播图 YFScreen.width + SDCycleScrollView *autoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, YFScreen.width, 200) imageURLStringsGroup:self.imagesURLs]; + autoScrollView.delegate = self; + + vc.headerView = autoScrollView; + /// 指定默认选择index 页面 + vc.pageIndex = 2; + + + /// 作为自控制器加入到当前控制器 + [vc addSelfToParentViewController:self]; + + /// 如果隐藏了导航条可以 适当改y值 +// pageVC.view.yn_y = kYNPAGE_NAVHEIGHT; + + [self.view addSubview:self.navView]; + +} + +- (NSArray *)getArrayVCs { + + BaseTableViewVC *vc_1 = [[BaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + BaseTableViewVC *vc_2 = [[BaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + BaseCollectionViewVC *vc_3 = [[BaseCollectionViewVC alloc] init]; + + return @[vc_1, vc_2, vc_3]; +} + +- (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服", @"帽子"]; +} + +- (UIView *)navView { + if (!_navView) { + _navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, kYNPAGE_NAVHEIGHT)]; +// _navView.backgroundColor = RGB_COLOR(246, 246, 246, 0); + } + return _navView; +} + +#pragma mark - Private Function + +#pragma mark - Getter and Setter +- (NSArray *)imagesURLs { + if (!_imagesURLs) { + _imagesURLs = @[ + @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg", + @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg", + @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"]; + } + return _imagesURLs; +} +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + UIViewController *vc = pageViewController.controllersM[index]; + if ([vc isKindOfClass:[BaseTableViewVC class]]) { + return [(BaseTableViewVC *)vc tableView]; + } else { + return [(BaseCollectionViewVC *)vc collectionView]; + } +} +#pragma mark - YNPageViewControllerDelegate +- (void)pageViewController:(YNPageViewController *)pageViewController + contentOffsetY:(CGFloat)contentOffset + progress:(CGFloat)progress { + NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); + +// self.navView.backgroundColor = RGBA(246, 246, 246, progress); + +} + + +#pragma mark - SDCycleScrollViewDelegate +- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { + NSLog(@"----click 轮播图 index %ld", index); +} + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.h" new file mode 100755 index 0000000..467539e --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.h" @@ -0,0 +1,13 @@ +// +// YNSuspendTopBaseTableViewVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/25. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BaseTableViewVC.h" + +@interface YNSuspendTopBaseTableViewVC : BaseTableViewVC + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.m" new file mode 100755 index 0000000..e7be6d9 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopBaseTableViewVC.m" @@ -0,0 +1,81 @@ +// +// YNSuspendTopBaseTableViewVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/25. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendTopBaseTableViewVC.h" +#import "MJRefresh.h" +#import "UIViewController+YNPageExtend.h" + +/// 开启刷新头部高度 +#define kOpenRefreshHeaderViewHeight 1 + +@interface YNSuspendTopBaseTableViewVC () + +@end + +@implementation YNSuspendTopBaseTableViewVC + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + if (kOpenRefreshHeaderViewHeight) { + if (self.tableView.mj_header.ignoredScrollViewContentInsetTop != self.yn_pageViewController.config.tempTopHeight) { + [self addTableViewRefresh]; + } + } +} + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +/// 重写父类方法 添加 刷新方法 +- (void)addTableViewRefresh { + + __weak typeof (self) weakSelf = self; + + self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (kOpenRefreshHeaderViewHeight) { + [weakSelf suspendTopReloadHeaderViewHeight]; + } else { + [weakSelf.tableView.mj_header endRefreshing]; + } + }); + }]; + + self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.tableView.mj_footer endRefreshing]; + }); + }]; + + /// 需要设置下拉刷新控件UI的偏移位置 + self.tableView.mj_header.ignoredScrollViewContentInsetTop = self.yn_pageViewController.config.tempTopHeight; +} + +#pragma mark - 悬浮Top刷新高度方法 +- (void)suspendTopReloadHeaderViewHeight { + + /// 布局高度 + CGFloat netWorkHeight = 900; + __weak typeof (self) weakSelf = self; + + /// 结束刷新时 刷新 HeaderView高度 + [self.tableView.mj_header endRefreshingWithCompletionBlock:^{ + YNPageViewController *VC = weakSelf.yn_pageViewController; + if (VC.headerView.frame.size.height != netWorkHeight) { + VC.headerView.frame = CGRectMake(0, 0, YFScreen.width, netWorkHeight); + [VC reloadSuspendHeaderViewFrame]; + [weakSelf addTableViewRefresh]; + } + }]; + +} + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.h" new file mode 100755 index 0000000..9d56e51 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.h" @@ -0,0 +1,15 @@ +// +// YNSuspendTopPageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/25. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BasePageViewController.h" + +@interface YNSuspendTopPageVC : BasePageViewController + ++ (instancetype)suspendTopPageVC; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.m" new file mode 100755 index 0000000..ae1bacb --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPageVC/YNSuspendTopPageVC.m" @@ -0,0 +1,116 @@ +// +// SuspendTopPageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendTopPageVC.h" +#import "SDCycleScrollView.h" +#import "BaseTableViewVC.h" +#import "YNSuspendTopBaseTableViewVC.h" + +@interface YNSuspendTopPageVC () + +@property (nonatomic, copy) NSArray *imagesURLs; + +@end + +@implementation YNSuspendTopPageVC + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +#pragma mark - Event Response + +#pragma mark - --Notification Event Response + +#pragma mark - --Button Event Response + +#pragma mark - --Gesture Event Response + +#pragma mark - System Delegate + +#pragma mark - Custom Delegate + +#pragma mark - Public Function + ++ (instancetype)suspendTopPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionTop; + configration.headerViewCouldScale = YES; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + + YNSuspendTopPageVC *vc = [YNSuspendTopPageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = vc; + vc.delegate = vc; + + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, YFScreen.height)]; + headerView.layer.contents = (id)[UIImage imageNamed:@"mine_header_bg"].CGImage; + /// 轮播图 + SDCycleScrollView *autoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, YFScreen.width, 200) imageURLStringsGroup:vc.imagesURLs]; + autoScrollView.delegate = vc; + +// vc.headerView = autoScrollView; + + vc.headerView = headerView; + // 指定默认选择index 页面 +// vc.pageIndex = 0; + return vc; +} + + ++ (NSArray *)getArrayVCs { + + YNSuspendTopBaseTableViewVC *vc_1 = [[YNSuspendTopBaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + YNSuspendTopBaseTableViewVC *vc_2 = [[YNSuspendTopBaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + YNSuspendTopBaseTableViewVC *vc_3 = [[YNSuspendTopBaseTableViewVC alloc] init]; + + return @[vc_1, vc_2, vc_3]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服", @"帽子"]; +} + +#pragma mark - Private Function + +#pragma mark - Getter and Setter +- (NSArray *)imagesURLs { + if (!_imagesURLs) { + _imagesURLs = @[ + @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg", + @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg", + @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"]; + } + return _imagesURLs; +} +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + YNSuspendTopBaseTableViewVC *vc = pageViewController.controllersM[index]; + + return [vc tableView]; +} +#pragma mark - YNPageViewControllerDelegate +- (void)pageViewController:(YNPageViewController *)pageViewController + contentOffsetY:(CGFloat)contentOffset + progress:(CGFloat)progress { + // NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); +} + +@end + diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.h" new file mode 100755 index 0000000..56d47ba --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.h" @@ -0,0 +1,17 @@ +// +// YNSuspendTopPauseBaseTableViewVC.h +// YNPageViewController +// +// Created by ZYN on 2018/7/14. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface YNSuspendTopPauseBaseTableViewVC : UIViewController + +@property (nonatomic, copy) NSString *cellTitle; + +@property (nonatomic, strong) UITableView *tableView; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.m" new file mode 100755 index 0000000..08ec0be --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPauseBaseTableViewVC.m" @@ -0,0 +1,152 @@ +// +// YNSuspendTopPauseBaseTableViewVC.m +// YNPageViewController +// +// Created by ZYN on 2018/7/14. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendTopPauseBaseTableViewVC.h" +#import "MJRefresh.h" +#import "BaseViewController.h" +#import "UIViewController+YNPageExtend.h" +#import "YNPageTableView.h" + +#define kCellHeight 44 + +@interface YNSuspendTopPauseBaseTableViewVC () + +@property (nonatomic, strong) NSMutableArray *dataArray; + +@end + +@implementation YNSuspendTopPauseBaseTableViewVC + +- (void)viewDidLoad { + [super viewDidLoad]; + [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"id"]; + [self.view addSubview:self.tableView]; + + _dataArray = @[].mutableCopy; + /// 加载数据 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + for (int i = 0; i < 420; i++) { + [_dataArray addObject:@""]; + } + [self.tableView reloadData]; + }); + [self addTableViewRefresh]; + +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self.tableView setContentOffset:CGPointMake(0, 240)]; +// }); + +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)addTableViewRefresh { + + __weak typeof (self) weakSelf = self; + + /// 这里加 footer 刷新 + self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + for (int i = 0; i < 30; i++) { + [weakSelf.dataArray addObject:@""]; + } + [weakSelf.tableView reloadData]; + [weakSelf.tableView.mj_footer endRefreshing]; + }); + }]; + +} + +#pragma mark - UITableViewDelegate UITableViewDataSource + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [UIView new]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [UIView new]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.dataArray.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + if (indexPath.row < self.dataArray.count) { + return kCellHeight; + } + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id"]; + + if (indexPath.row < self.dataArray.count) { + + cell.textLabel.text = [NSString stringWithFormat:@"%@ section: %zd row:%zd", self.cellTitle ?: @"测试", indexPath.section, indexPath.row]; + return cell; + } + + return cell; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + BaseViewController *baseVC = [BaseViewController new]; + baseVC.title = @"二级页面"; + [self.navigationController pushViewController:baseVC animated:YES]; +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[YNPageTableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + } + return _tableView; +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.h" new file mode 100755 index 0000000..fecfb66 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.h" @@ -0,0 +1,15 @@ +// +// YNSuspendTopPausePageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/7/14. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BasePageViewController.h" + +@interface YNSuspendTopPausePageVC : BasePageViewController + ++ (instancetype)suspendTopPausePageVC; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.m" new file mode 100755 index 0000000..8140969 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/SuspendTopPausePageVC/YNSuspendTopPausePageVC.m" @@ -0,0 +1,160 @@ +// +// YNSuspendTopPausePageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/7/14. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNSuspendTopPausePageVC.h" +#import "SDCycleScrollView.h" +#import "BaseTableViewVC.h" +#import "YNSuspendTopPauseBaseTableViewVC.h" +#import "MJRefresh.h" +#import "UIView+YNPageExtend.h" + +#define kOpenRefreshHeaderViewHeight 0 + +@interface YNSuspendTopPausePageVC () + +@property (nonatomic, copy) NSArray *imagesURLs; + +@end + +@implementation YNSuspendTopPausePageVC + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + +// [self.navigationController setNavigationBarHidden:YES animated:animated]; +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + +// [self.navigationController setNavigationBarHidden:NO animated:animated]; +} + +#pragma mark - Event Response + +#pragma mark - --Notification Event Response + +#pragma mark - --Button Event Response + +#pragma mark - --Gesture Event Response + +#pragma mark - System Delegate + +#pragma mark - Custom Delegate + +#pragma mark - Public Function + ++ (instancetype)suspendTopPausePageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionTopPause; + configration.headerViewCouldScale = YES; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + + YNSuspendTopPausePageVC *vc = [YNSuspendTopPausePageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = vc; + vc.delegate = vc; + + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, YFScreen.height)]; + headerView.layer.contents = (id)[UIImage imageNamed:@"mine_header_bg"].CGImage; + /// 轮播图 + SDCycleScrollView *autoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, YFScreen.width, 200) imageURLStringsGroup:vc.imagesURLs]; + autoScrollView.delegate = vc; + + vc.headerView = autoScrollView; + +// vc.headerView = headerView; + /// 指定默认选择index 页面 + vc.pageIndex = 1; + + __weak typeof(YNSuspendTopPausePageVC *) weakVC = vc; + + vc.bgScrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + + NSInteger refreshPage = weakVC.pageIndex; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + /// 取到之前的页面进行刷新 pageIndex 是当前页面 + YNSuspendTopPauseBaseTableViewVC *vc2 = weakVC.controllersM[refreshPage]; + [vc2.tableView reloadData]; + + if (kOpenRefreshHeaderViewHeight) { + weakVC.headerView.yn_height = 300; + [weakVC.bgScrollView.mj_header endRefreshing]; + [weakVC reloadSuspendHeaderViewFrame]; + } else { + [weakVC.bgScrollView.mj_header endRefreshing]; + } + }); + }]; + + return vc; +} + ++ (NSArray *)getArrayVCs { + + YNSuspendTopPauseBaseTableViewVC *vc_1 = [[YNSuspendTopPauseBaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + YNSuspendTopPauseBaseTableViewVC *vc_2 = [[YNSuspendTopPauseBaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + YNSuspendTopPauseBaseTableViewVC *vc_3 = [[YNSuspendTopPauseBaseTableViewVC alloc] init]; + vc_3.cellTitle = @"帽子"; + return @[vc_1, vc_2, vc_3]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服", @"帽子"]; +} + +#pragma mark - Private Function + +#pragma mark - Getter and Setter +- (NSArray *)imagesURLs { + if (!_imagesURLs) { + _imagesURLs = @[ + @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg", + @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg", + @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"]; + } + return _imagesURLs; +} +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + UIViewController *vc = pageViewController.controllersM[index]; + + return [(YNSuspendTopPauseBaseTableViewVC *)vc tableView]; +} +#pragma mark - YNPageViewControllerDelegate +- (void)pageViewController:(YNPageViewController *)pageViewController + contentOffsetY:(CGFloat)contentOffset + progress:(CGFloat)progress { + NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); +} + +#pragma mark - SDCycleScrollViewDelegate +- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { + NSLog(@"----click 轮播图 index %ld", index); +} + +@end + + diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.h" new file mode 100755 index 0000000..bdf3151 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.h" @@ -0,0 +1,15 @@ +// +// YNTestBaseVC.h +// YNPageViewController +// +// Created by ZYN on 2018/5/8. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import + +@interface YNTestBaseVC : UIViewController + +@property (nonatomic, strong) UITableView *tableView; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.m" new file mode 100755 index 0000000..b7c751f --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestBaseVC.m" @@ -0,0 +1,138 @@ +// +// YNTestBaseVC.m +// YNPageViewController +// +// Created by ZYN on 2018/5/8. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNTestBaseVC.h" +#import "MJRefresh.h" +#import "YNPageTableView.h" + +@interface YNTestBaseVC () + +@end + +@implementation YNTestBaseVC + +- (void)viewDidLoad { + [super viewDidLoad]; + + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, 200)]; + headerView.backgroundColor = [UIColor greenColor]; + +// self.tableView.tableHeaderView = headerView; + [self.view addSubview:self.tableView]; + +// [self addTableViewRefresh]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)addTableViewRefresh { + + __weak typeof (self) weakSelf = self; +// + self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.tableView.mj_header endRefreshing]; + }); + }]; + + self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.tableView.mj_footer endRefreshing]; + }); + }]; + +// self.tableView.mj_header.hidden = YES; + +// self.tableView.backgroundColor = [UIColor clearColor]; +// self.tableView.mj_header.ignoredScrollViewContentInsetTop = 244; + +} + +#pragma mark - UITableViewDelegate UITableViewDataSource + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + return [UIView new]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + + return 0.00001; +} + +- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { + + return [UIView new]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return 5; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + + return 44; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *identifier = @"identifier"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; + if (!cell) { + cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; + } + cell.textLabel.text = [NSString stringWithFormat:@"测试 section: %zd row:%zd", indexPath.section, indexPath.row]; + + return cell; + +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[YNPageTableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + } + return _tableView; +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.h" new file mode 100755 index 0000000..b3e0f37 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.h" @@ -0,0 +1,17 @@ +// +// YNTestVC.h +// YNPageViewController +// +// Created by ZYN on 2018/5/8. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import +#import "YNPageViewController.h" + +@interface YNTestPageVC : YNPageViewController + ++ (instancetype)testPageVC; + + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.m" new file mode 100755 index 0000000..8d6b7ba --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TestPageVC/YNTestPageVC.m" @@ -0,0 +1,158 @@ +// +// YNTestVC.m +// YNPageViewController +// +// Created by ZYN on 2018/5/8. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNTestPageVC.h" +#import "YNTestBaseVC.h" +#import "SDCycleScrollView.h" + +@interface YNTestPageVC () + +@property (nonatomic, copy) NSArray *imagesURLs; + +@end + +@implementation YNTestPageVC + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + NSLog(@"--%@--%@", [self class], NSStringFromSelector(_cmd)); +} + + +//- (void)viewDidLayoutSubviews { +// [super viewDidLayoutSubviews]; +// +// CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height; +// if (statusBarHeight == 40.0f) { +// self.pageVC.view.yn_y = -20; +// self.pageVC.config.suspenOffsetY = 20; +// } else { +// self.pageVC.view.yn_y = 0; +// self.pageVC.config.suspenOffsetY = 0; +// } +// +//} + + +#pragma mark - Event Response + +#pragma mark - --Notification Event Response + +#pragma mark - --Button Event Response + +#pragma mark - --Gesture Event Response + +#pragma mark - System Delegate + +#pragma mark - Custom Delegate + + + +#pragma mark - Public Function + ++ (instancetype)testPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleSuspensionTopPause; +// configration.pageStyle = YNPageStyleNavigation; +// configration.pageStyle = YNPageStyleTop; + configration.headerViewCouldScale = YES; +// configration.headerViewScaleMode = YNPageHeaderViewScaleModeCenter; + configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; +// configration.menuWidth = 250; + + YNTestPageVC *vc = [YNTestPageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = vc; + vc.delegate = vc; + /// 轮播图 + SDCycleScrollView *autoScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, YFScreen.width, 200) imageURLStringsGroup:vc.imagesURLs]; + autoScrollView.delegate = vc; +// + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, 200)]; + headerView.backgroundColor = [UIColor redColor]; + vc.headerView = headerView; + +// vc.pageIndex = 1; +// 设置拉伸View +// UIImageView *imageViewScale = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, YFScreen.width, 200)]; +// imageViewScale.image = [UIImage imageNamed:@"mine_header_bg"]; +// vc.scaleBackgroundView = imageViewScale; + + return vc; +} + + ++ (NSArray *)getArrayVCs { + + YNTestBaseVC *vc_1 = [[YNTestBaseVC alloc] init]; + + YNTestBaseVC *vc_2 = [[YNTestBaseVC alloc] init]; + + return @[vc_1, vc_2]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服"]; +} + +#pragma mark - Private Function + +#pragma mark - Getter and Setter +- (NSArray *)imagesURLs { + if (!_imagesURLs) { + _imagesURLs = @[ + @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg", + @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg", + @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"]; + } + return _imagesURLs; +} +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + YNTestBaseVC *baseVC = pageViewController.controllersM[index]; + + return [baseVC tableView]; +} +#pragma mark - YNPageViewControllerDelegate +- (void)pageViewController:(YNPageViewController *)pageViewController contentOffsetY:(CGFloat)contentOffset progress:(CGFloat)progress { +// NSLog(@"--- contentOffset = %f, progress = %f", contentOffset, progress); +} + + +#pragma mark - SDCycleScrollViewDelegate +- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { + NSLog(@"----click 轮播图 index %ld", index); +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.h" new file mode 100755 index 0000000..943428b --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.h" @@ -0,0 +1,15 @@ +// +// YNTopPageVC.h +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "BasePageViewController.h" + +@interface YNTopPageVC : BasePageViewController + ++ (instancetype)topPageVC; + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.m" new file mode 100755 index 0000000..6f432a4 --- /dev/null +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/Demos/TopPageVC/YNTopPageVC.m" @@ -0,0 +1,72 @@ +// +// YNTopPageVC.m +// YNPageViewController +// +// Created by ZYN on 2018/6/22. +// Copyright © 2018年 yongneng. All rights reserved. +// + +#import "YNTopPageVC.h" +#import "BaseTableViewVC.h" + +@interface YNTopPageVC () + +@end + +@implementation YNTopPageVC + +- (void)viewDidLoad { + [super viewDidLoad]; + +} + ++ (instancetype)topPageVC { + + YNPageConfigration *configration = [YNPageConfigration defaultConfig]; + configration.pageStyle = YNPageStyleTop; + configration.headerViewCouldScale = YES; + configration.headerViewScaleMode = YNPageHeaderViewScaleModeTop; + configration.showTabbar = NO; + configration.showNavigation = YES; + configration.scrollMenu = NO; + configration.aligmentModeCenter = NO; + configration.lineWidthEqualFontWidth = NO; + configration.showBottomLine = YES; + + + YNTopPageVC *vc = [YNTopPageVC pageViewControllerWithControllers:[self getArrayVCs] + titles:[self getArrayTitles] + config:configration]; + vc.dataSource = vc; + vc.delegate = vc; + + + return vc; +} + + ++ (NSArray *)getArrayVCs { + + BaseTableViewVC *vc_1 = [[BaseTableViewVC alloc] init]; + vc_1.cellTitle = @"鞋子"; + + BaseTableViewVC *vc_2 = [[BaseTableViewVC alloc] init]; + vc_2.cellTitle = @"衣服"; + + BaseTableViewVC *vc_3 = [[BaseTableViewVC alloc] init]; + vc_3.cellTitle = @"帽子"; + + return @[vc_1, vc_2, vc_3]; +} + ++ (NSArray *)getArrayTitles { + return @[@"鞋子", @"衣服", @"帽子"]; +} + +#pragma mark - YNPageViewControllerDataSource +- (UIScrollView *)pageViewController:(YNPageViewController *)pageViewController pageForIndex:(NSInteger)index { + BaseTableViewVC *baseVC = pageViewController.controllersM[index]; + return [baseVC tableView]; +} + +@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.h" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.h" deleted file mode 100644 index 8b7b6a6..0000000 --- "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.h" +++ /dev/null @@ -1,14 +0,0 @@ -// -// YFPageViewOneViewController.h -// BigShow1949 -// -// Created by big show on 2018/9/24. -// Copyright © 2018年 BigShowCompany. All rights reserved. -// - -#import "YNPageViewController.h" - -@interface YFPageViewOneViewController : YNPageViewController - -+ (instancetype)testPageVC; -@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.m" deleted file mode 100644 index 57d28d8..0000000 --- "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YFPageViewOneViewController.m" +++ /dev/null @@ -1,40 +0,0 @@ -// -// YFPageViewOneViewController.m -// BigShow1949 -// -// Created by big show on 2018/9/24. -// Copyright © 2018年 BigShowCompany. All rights reserved. -// - -#import "YFPageViewOneViewController.h" -#import "SDCycleScrollView.h" - -@interface YFPageViewOneViewController () - -@end - -@implementation YFPageViewOneViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.view.backgroundColor = [UIColor whiteColor]; -} - - - - - - - - - - - - - - - - - - -@end diff --git "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YNPageViewDemoController.m" "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YNPageViewDemoController.m" index 5825cc0..c963ca8 100644 --- "a/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YNPageViewDemoController.m" +++ "b/BigShow1949/Classes/03 - ViewLayout(\350\247\206\345\233\276\345\270\203\345\261\200)/YNPageView/YNPageViewDemoController.m" @@ -8,6 +8,16 @@ #import "YNPageViewDemoController.h" +#import "YNSuspendTopPageVC.h" +#import "YNSuspendCenterPageVC.h" +#import "YNSuspendTopPausePageVC.h" +#import "YNSuspendCustomNavOrSuspendPositionVC.h" +#import "YNTopPageVC.h" +#import "YNNavPageVC.h" +#import "YNLoadPageVC.h" +#import "YNScrollMenuStyleVC.h" +#import "YNTestPageVC.h" + @interface YNPageViewDemoController () @end @@ -18,13 +28,58 @@ - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; - [self setupDataArr:@[@[@"测试例子",@"YFPageViewOneViewController"], + [self setupDataArr:@[@[@"悬浮样式--下拉刷新在中间",@"YNVCTypeSuspendCenterPageVC"], // 数据显示不出来 + @[@"悬浮样式--下拉刷新在顶部",@"YNVCTypeSuspendTopPageVC"], + @[@"悬浮样式--下拉刷新在顶部(QQ联系人样式)",@"YNVCTypeSuspendTopPausePageVC"], + @[@"悬浮样式--自定义导航条或自定义悬浮位置",@"YNVCTypeSuspendCustomNavOrSuspendPosition"],// 需要加个返回按钮 + @[@"加载数据后显示页面(隐藏导航条)",@"YNVCTypeLoadPageVC"], + @[@"顶部样式",@"YNVCTypeTopPageVC"], + @[@"导航条样式",@"YNVCTypeNavPageVC"],// 需要加个返回按钮 + @[@"菜单栏样式",@"YNVCTypeScrollMenuStyleVC"], + @[@"测试专用",@"YNVCTypeYNTestPageVC"], ]]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + UIViewController *vc = nil; + switch (indexPath.row) { + case 0: + vc = [YNSuspendTopPageVC suspendTopPageVC]; + break; + case 1: + vc = [YNSuspendCenterPageVC suspendCenterPageVC]; + break; + case 2: + vc = [YNSuspendTopPausePageVC suspendTopPausePageVC]; + break; + case 3: + vc = [YNSuspendCustomNavOrSuspendPositionVC new]; + break; + case 4: + vc = [YNTopPageVC topPageVC]; + break; + case 5: + vc = [YNNavPageVC navPageVC]; + break; + case 6: + vc = [YNLoadPageVC new]; + break; + case 7: + vc = [YNScrollMenuStyleVC new]; + break; + case 8: + vc = [YNTestPageVC testPageVC]; + break; + case 9: + + break; + + default: + break; + } + + [self.navigationController pushViewController:vc animated:YES]; } /* diff --git a/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.h b/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.h new file mode 100755 index 0000000..d92296f --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.h @@ -0,0 +1,157 @@ +// +// FTPopOverMenu.h +// FTPopOverMenu +// +// Created by liufengting on 16/4/5. +// Copyright © 2016年 liufengting ( https://github.com/liufengting ). All rights reserved. +// + +#import + +/** + * FTPopOverMenuDoneBlock + * + * @param index SlectedIndex + */ +typedef void (^FTPopOverMenuDoneBlock)(NSInteger selectedIndex); +/** + * FTPopOverMenuDismissBlock + */ +typedef void (^FTPopOverMenuDismissBlock)(); + +/** + * -----------------------FTPopOverMenuConfiguration----------------------- + */ +@interface FTPopOverMenuConfiguration : NSObject + +@property (nonatomic, assign)CGFloat menuTextMargin;// Default is 6. +@property (nonatomic, assign)CGFloat menuIconMargin;// Default is 6. +@property (nonatomic, assign)CGFloat menuRowHeight; +@property (nonatomic, assign)CGFloat menuWidth; +@property (nonatomic, strong)UIColor *textColor; +@property (nonatomic, strong)UIColor *tintColor; +@property (nonatomic, strong)UIColor *borderColor; +@property (nonatomic, assign)CGFloat borderWidth; +@property (nonatomic, strong)UIFont *textFont; +@property (nonatomic, assign)NSTextAlignment textAlignment; +@property (nonatomic, assign)BOOL ignoreImageOriginalColor;// Default is 'NO', if sets to 'YES', images color will be same as textColor. +@property (nonatomic, assign)BOOL allowRoundedArrow;// Default is 'NO', if sets to 'YES', the arrow will be drawn with round corner. +@property (nonatomic, assign)NSTimeInterval animationDuration; +/** + * defaultConfiguration + * + * @return curren configuration + */ ++ (FTPopOverMenuConfiguration *)defaultConfiguration; + +@end + +/** + * -----------------------FTPopOverMenuCell----------------------- + */ +@interface FTPopOverMenuCell : UITableViewCell + +@end +/** + * -----------------------FTPopOverMenuView----------------------- + */ +@interface FTPopOverMenuView : UIControl + +@end + +/** + * -----------------------FTPopOverMenu----------------------- + */ +@interface FTPopOverMenu : NSObject + + +/** + show method with sender without images + + @param sender sender + @param menuArray menuArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showForSender:(UIView *)sender + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + show method with sender and image resouce Array + + @param sender sender + @param menuArray menuArray + @param imageArray imageArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showForSender:(UIView *)sender + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + show method for barbuttonitems with event without images + + @param event event + @param menuArray menuArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showFromEvent:(UIEvent *)event + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + show method for barbuttonitems with event and imageArray + + @param event event + @param menuArray menuArray + @param imageArray imageArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showFromEvent:(UIEvent *)event + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + show method with SenderFrame without images + + @param senderFrame senderFrame + @param menuArray menuArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showFromSenderFrame:(CGRect )senderFrame + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + show method with SenderFrame and image resouce Array + + @param senderFrame senderFrame + @param menuArray menuArray + @param imageArray imageArray + @param doneBlock doneBlock + @param dismissBlock dismissBlock + */ ++ (void) showFromSenderFrame:(CGRect )senderFrame + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock; + +/** + * dismiss method + */ ++ (void) dismiss; + +@end diff --git a/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.m b/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.m new file mode 100755 index 0000000..c816d84 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/FTPopOverMenu/FTPopOverMenu.m @@ -0,0 +1,805 @@ +// +// FTPopOverMenu.m +// FTPopOverMenu +// +// Created by liufengting on 16/4/5. +// Copyright © 2016年 liufengting ( https://github.com/liufengting ). All rights reserved. +// + +#import "FTPopOverMenu.h" + +// changeable +#define FTDefaultMargin 4.f +#define FTDefaultMenuTextMargin 6.f +#define FTDefaultMenuIconMargin 6.f +#define FTDefaultMenuCornerRadius 5.f +#define FTDefaultAnimationDuration 0.2 +// unchangeable, change them at your own risk +#define KSCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width +#define KSCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height +#define FTDefaultBackgroundColor [UIColor clearColor] +#define FTDefaultTintColor [UIColor colorWithRed:80/255.f green:80/255.f blue:80/255.f alpha:1.f] +#define FTDefaultTextColor [UIColor whiteColor] +#define FTDefaultMenuFont [UIFont systemFontOfSize:14.f] +#define FTDefaultMenuWidth 120.f +#define FTDefaultMenuIconSize 24.f +#define FTDefaultMenuRowHeight 40.f +#define FTDefaultMenuBorderWidth 0.8 +#define FTDefaultMenuArrowWidth 8.f +#define FTDefaultMenuArrowHeight 10.f +#define FTDefaultMenuArrowWidth_R 12.f +#define FTDefaultMenuArrowHeight_R 12.f +#define FTDefaultMenuArrowRoundRadius 4.f + +static NSString *const FTPopOverMenuTableViewCellIndentifier = @"FTPopOverMenuTableViewCellIndentifier"; +static NSString *const FTPopOverMenuImageCacheDirectory = @"com.FTPopOverMenuImageCache"; +/** + * FTPopOverMenuArrowDirection + */ +typedef NS_ENUM(NSUInteger, FTPopOverMenuArrowDirection) { + /** + * Up + */ + FTPopOverMenuArrowDirectionUp, + /** + * Down + */ + FTPopOverMenuArrowDirectionDown, +}; + +#pragma mark - FTPopOverMenuConfiguration + +@interface FTPopOverMenuConfiguration () + +@end + +@implementation FTPopOverMenuConfiguration + ++ (FTPopOverMenuConfiguration *)defaultConfiguration +{ + static dispatch_once_t once = 0; + static FTPopOverMenuConfiguration *configuration; + dispatch_once(&once, ^{ configuration = [[FTPopOverMenuConfiguration alloc] init]; }); + return configuration; +} + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.menuRowHeight = FTDefaultMenuRowHeight; + self.menuWidth = FTDefaultMenuWidth; + self.textColor = FTDefaultTextColor; + self.textFont = FTDefaultMenuFont; + self.tintColor = FTDefaultTintColor; + self.borderColor = FTDefaultTintColor; + self.borderWidth = FTDefaultMenuBorderWidth; + self.textAlignment = NSTextAlignmentCenter; + self.ignoreImageOriginalColor = NO; + self.allowRoundedArrow = NO; + self.menuTextMargin = FTDefaultMenuTextMargin; + self.menuIconMargin = FTDefaultMenuIconMargin; + self.animationDuration = FTDefaultAnimationDuration; + } + return self; +} + +@end + +#pragma mark - FTPopOverMenuCell + +@interface FTPopOverMenuCell () + +@property (nonatomic, strong) UIImageView *iconImageView; +@property (nonatomic, strong) UILabel *menuNameLabel; + +@end + +@implementation FTPopOverMenuCell + +-(instancetype)initWithStyle:(UITableViewCellStyle)style + reuseIdentifier:(NSString *)reuseIdentifier + menuName:(NSString *)menuName + menuImage:(id )menuImage +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + + [self setupWithMenuName:menuName menuImage:menuImage]; + } + return self; +} + +-(UIImageView *)iconImageView +{ + if (!_iconImageView) { + _iconImageView = [[UIImageView alloc]initWithFrame:CGRectZero]; + _iconImageView.backgroundColor = [UIColor clearColor]; + _iconImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _iconImageView; +} + +-(UILabel *)menuNameLabel +{ + if (!_menuNameLabel) { + _menuNameLabel = [[UILabel alloc]initWithFrame:CGRectZero]; + _menuNameLabel.backgroundColor = [UIColor clearColor]; + } + return _menuNameLabel; +} + +-(void)setupWithMenuName:(NSString *)menuName menuImage:(id )menuImage +{ + FTPopOverMenuConfiguration *configuration = [FTPopOverMenuConfiguration defaultConfiguration]; + + CGFloat margin = (configuration.menuRowHeight - FTDefaultMenuIconSize)/2.f; + CGRect iconImageRect = CGRectMake(configuration.menuIconMargin, margin, FTDefaultMenuIconSize, FTDefaultMenuIconSize); + CGFloat menuNameX = iconImageRect.origin.x + iconImageRect.size.width + configuration.menuTextMargin; + CGRect menuNameRect = CGRectMake(menuNameX, 0, configuration.menuWidth - menuNameX - configuration.menuTextMargin, configuration.menuRowHeight); + + if (!menuImage) { + menuNameRect = CGRectMake(configuration.menuTextMargin, 0, configuration.menuWidth - configuration.menuTextMargin*2, configuration.menuRowHeight); + }else{ + self.iconImageView.frame = iconImageRect; + self.iconImageView.tintColor = configuration.textColor; + + [self getImageWithResource:menuImage + completion:^(UIImage *image) { + if (configuration.ignoreImageOriginalColor) { + image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + } + _iconImageView.image = image; + }]; + [self.contentView addSubview:self.iconImageView]; + } + self.menuNameLabel.frame = menuNameRect; + self.menuNameLabel.font = configuration.textFont; + self.menuNameLabel.textColor = configuration.textColor; + self.menuNameLabel.textAlignment = configuration.textAlignment; + self.menuNameLabel.text = menuName; + [self.contentView addSubview:self.menuNameLabel]; +} + +/** + get image from local or remote + + @param resource image reource + @param doneBlock get image back + */ +-(void)getImageWithResource:(id)resource completion:(void (^)(UIImage *image))completion +{ + if ([resource isKindOfClass:[UIImage class]]) { + completion(resource); + }else if ([resource isKindOfClass:[NSString class]]) { + if ([resource hasPrefix:@"http"]) { + [self downloadImageWithURL:[NSURL URLWithString:resource] completion:completion]; + }else{ + completion([UIImage imageNamed:resource]); + } + }else if ([resource isKindOfClass:[NSURL class]]) { + [self downloadImageWithURL:resource completion:completion]; + }else{ + NSLog(@"Image resource not recougnized."); + completion(nil); + } +} + +/** + download image if needed, cache image into disk if needed. + + @param url imageURL + @param doneBlock get image back + */ +-(void)downloadImageWithURL:(NSURL *)url completion:(void (^)(UIImage *image))completion +{ + if ([self isExitImageForImageURL:url]) { + NSString *filePath = [self filePathForImageURL:url]; + completion([UIImage imageWithContentsOfFile:filePath]); + }else{ + // download + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]]; + if (image) { + NSData *data = UIImagePNGRepresentation(image); + [data writeToFile:[self filePathForImageURL:url] atomically:YES]; + dispatch_async(dispatch_get_main_queue(), ^{ + completion(image); + }); + } + }); + } +} + +/** + return if the image is downloaded and cached before + + @param url imageURL + @return if the image is downloaded and cached before + */ +-(BOOL)isExitImageForImageURL:(NSURL *)url +{ + return [[NSFileManager defaultManager] fileExistsAtPath:[self filePathForImageURL:url]]; +} + +/** + get local disk cash filePath for imageurl + + @param url imageURL + @return filePath + */ +-(NSString *)filePathForImageURL:(NSURL *)url +{ + NSString *diskCachePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:FTPopOverMenuImageCacheDirectory]; + if(![[NSFileManager defaultManager] fileExistsAtPath:diskCachePath]){ + NSError *error = nil; + [[NSFileManager defaultManager] createDirectoryAtPath:diskCachePath + withIntermediateDirectories:YES + attributes:@{} + error:&error]; + } + NSData *data = [url.absoluteString dataUsingEncoding:NSUTF8StringEncoding]; + NSString *pathComponent = [data base64EncodedStringWithOptions:NSUTF8StringEncoding]; + NSString *filePath = [diskCachePath stringByAppendingPathComponent:pathComponent]; + return filePath; +} + +@end + + + +#pragma mark - FTPopOverMenuView + +@interface FTPopOverMenuView () + +@property (nonatomic, strong) UITableView *menuTableView; +@property (nonatomic, strong) NSArray *menuStringArray; +@property (nonatomic, strong) NSArray *menuImageArray; +@property (nonatomic, assign) FTPopOverMenuArrowDirection arrowDirection; +@property (nonatomic, strong) FTPopOverMenuDoneBlock doneBlock; +@property (nonatomic, strong) CAShapeLayer *backgroundLayer; + + +@property (nonatomic, strong) UIColor *tintColor; + +@end + +@implementation FTPopOverMenuView + +-(instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + + } + return self; +} + +-(UITableView *)menuTableView +{ + if (!_menuTableView) { + _menuTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain]; + _menuTableView.backgroundColor = FTDefaultBackgroundColor; + _menuTableView.separatorColor = [UIColor grayColor]; + _menuTableView.layer.cornerRadius = FTDefaultMenuCornerRadius; + _menuTableView.scrollEnabled = NO; + _menuTableView.clipsToBounds = YES; + _menuTableView.delegate = self; + _menuTableView.dataSource = self; + [self addSubview:_menuTableView]; + } + return _menuTableView; +} + +-(CGFloat)menuArrowWidth +{ + return [FTPopOverMenuConfiguration defaultConfiguration].allowRoundedArrow ? FTDefaultMenuArrowWidth_R : FTDefaultMenuArrowWidth; +} +-(CGFloat)menuArrowHeight +{ + return [FTPopOverMenuConfiguration defaultConfiguration].allowRoundedArrow ? FTDefaultMenuArrowHeight_R : FTDefaultMenuArrowHeight; +} + +-(void)showWithFrame:(CGRect )frame + anglePoint:(CGPoint )anglePoint + withNameArray:(NSArray *)nameArray + imageNameArray:(NSArray *)imageNameArray + shouldAutoScroll:(BOOL)shouldAutoScroll + arrowDirection:(FTPopOverMenuArrowDirection)arrowDirection + doneBlock:(FTPopOverMenuDoneBlock)doneBlock +{ + self.frame = frame; + _menuStringArray = nameArray; + _menuImageArray = imageNameArray; + _arrowDirection = arrowDirection; + self.doneBlock = doneBlock; + self.menuTableView.scrollEnabled = shouldAutoScroll; + + + CGRect menuRect = CGRectMake(0, self.menuArrowHeight, self.frame.size.width, self.frame.size.height - self.menuArrowHeight); + if (_arrowDirection == FTPopOverMenuArrowDirectionDown) { + menuRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - self.menuArrowHeight); + } + [self.menuTableView setFrame:menuRect]; + [self.menuTableView reloadData]; + + [self drawBackgroundLayerWithAnglePoint:anglePoint]; +} +-(void)drawBackgroundLayerWithAnglePoint:(CGPoint)anglePoint +{ + if (_backgroundLayer) { + [_backgroundLayer removeFromSuperlayer]; + } + + UIBezierPath *path = [UIBezierPath bezierPath]; + BOOL allowRoundedArrow = [FTPopOverMenuConfiguration defaultConfiguration].allowRoundedArrow; + CGFloat offset = 2.f*FTDefaultMenuArrowRoundRadius*sinf(M_PI_4/2.f); + CGFloat roundcenterHeight = offset + FTDefaultMenuArrowRoundRadius*sqrtf(2.f); + CGPoint roundcenterPoint = CGPointMake(anglePoint.x, roundcenterHeight); + + switch (_arrowDirection) { + case FTPopOverMenuArrowDirectionUp:{ + + if (allowRoundedArrow) { + [path addArcWithCenter:CGPointMake(anglePoint.x + self.menuArrowWidth, self.menuArrowHeight - 2.f*FTDefaultMenuArrowRoundRadius) radius:2.f*FTDefaultMenuArrowRoundRadius startAngle:M_PI_2 endAngle:M_PI_4*3.f clockwise:YES]; + [path addLineToPoint:CGPointMake(anglePoint.x + FTDefaultMenuArrowRoundRadius/sqrtf(2.f), roundcenterPoint.y - FTDefaultMenuArrowRoundRadius/sqrtf(2.f))]; + [path addArcWithCenter:roundcenterPoint radius:FTDefaultMenuArrowRoundRadius startAngle:M_PI_4*7.f endAngle:M_PI_4*5.f clockwise:NO]; + [path addLineToPoint:CGPointMake(anglePoint.x - self.menuArrowWidth + (offset * (1.f+1.f/sqrtf(2.f))), self.menuArrowHeight - offset/sqrtf(2.f))]; + [path addArcWithCenter:CGPointMake(anglePoint.x - self.menuArrowWidth, self.menuArrowHeight - 2.f*FTDefaultMenuArrowRoundRadius) radius:2.f*FTDefaultMenuArrowRoundRadius startAngle:M_PI_4 endAngle:M_PI_2 clockwise:YES]; + } else { + [path moveToPoint:CGPointMake(anglePoint.x + self.menuArrowWidth, self.menuArrowHeight)]; + [path addLineToPoint:anglePoint]; + [path addLineToPoint:CGPointMake( anglePoint.x - self.menuArrowWidth, self.menuArrowHeight)]; + } + + [path addLineToPoint:CGPointMake( FTDefaultMenuCornerRadius, self.menuArrowHeight)]; + [path addArcWithCenter:CGPointMake(FTDefaultMenuCornerRadius, self.menuArrowHeight + FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:-M_PI_2 endAngle:-M_PI clockwise:NO]; + [path addLineToPoint:CGPointMake( 0, self.bounds.size.height - FTDefaultMenuCornerRadius)]; + [path addArcWithCenter:CGPointMake(FTDefaultMenuCornerRadius, self.bounds.size.height - FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:M_PI endAngle:M_PI_2 clockwise:NO]; + [path addLineToPoint:CGPointMake( self.bounds.size.width - FTDefaultMenuCornerRadius, self.bounds.size.height)]; + [path addArcWithCenter:CGPointMake(self.bounds.size.width - FTDefaultMenuCornerRadius, self.bounds.size.height - FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:M_PI_2 endAngle:0 clockwise:NO]; + [path addLineToPoint:CGPointMake(self.bounds.size.width , FTDefaultMenuCornerRadius + self.menuArrowHeight)]; + [path addArcWithCenter:CGPointMake(self.bounds.size.width - FTDefaultMenuCornerRadius, FTDefaultMenuCornerRadius + self.menuArrowHeight) radius:FTDefaultMenuCornerRadius startAngle:0 endAngle:-M_PI_2 clockwise:NO]; + [path closePath]; + + }break; + case FTPopOverMenuArrowDirectionDown:{ + + roundcenterPoint = CGPointMake(anglePoint.x, anglePoint.y - roundcenterHeight); + + if (allowRoundedArrow) { + [path addArcWithCenter:CGPointMake(anglePoint.x + self.menuArrowWidth, anglePoint.y - self.menuArrowHeight + 2.f*FTDefaultMenuArrowRoundRadius) radius:2.f*FTDefaultMenuArrowRoundRadius startAngle:M_PI_2*3 endAngle:M_PI_4*5.f clockwise:NO]; + [path addLineToPoint:CGPointMake(anglePoint.x + FTDefaultMenuArrowRoundRadius/sqrtf(2.f), roundcenterPoint.y + FTDefaultMenuArrowRoundRadius/sqrtf(2.f))]; + [path addArcWithCenter:roundcenterPoint radius:FTDefaultMenuArrowRoundRadius startAngle:M_PI_4 endAngle:M_PI_4*3.f clockwise:YES]; + [path addLineToPoint:CGPointMake(anglePoint.x - self.menuArrowWidth + (offset * (1.f+1.f/sqrtf(2.f))), anglePoint.y - self.menuArrowHeight + offset/sqrtf(2.f))]; + [path addArcWithCenter:CGPointMake(anglePoint.x - self.menuArrowWidth, anglePoint.y - self.menuArrowHeight + 2.f*FTDefaultMenuArrowRoundRadius) radius:2.f*FTDefaultMenuArrowRoundRadius startAngle:M_PI_4*7 endAngle:M_PI_2*3 clockwise:NO]; + } else { + [path moveToPoint:CGPointMake(anglePoint.x + self.menuArrowWidth, anglePoint.y - self.menuArrowHeight)]; + [path addLineToPoint:anglePoint]; + [path addLineToPoint:CGPointMake( anglePoint.x - self.menuArrowWidth, anglePoint.y - self.menuArrowHeight)]; + } + + [path addLineToPoint:CGPointMake( FTDefaultMenuCornerRadius, anglePoint.y - self.menuArrowHeight)]; + [path addArcWithCenter:CGPointMake(FTDefaultMenuCornerRadius, anglePoint.y - self.menuArrowHeight - FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:M_PI_2 endAngle:M_PI clockwise:YES]; + [path addLineToPoint:CGPointMake( 0, FTDefaultMenuCornerRadius)]; + [path addArcWithCenter:CGPointMake(FTDefaultMenuCornerRadius, FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:M_PI endAngle:-M_PI_2 clockwise:YES]; + [path addLineToPoint:CGPointMake( self.bounds.size.width - FTDefaultMenuCornerRadius, 0)]; + [path addArcWithCenter:CGPointMake(self.bounds.size.width - FTDefaultMenuCornerRadius, FTDefaultMenuCornerRadius) radius:FTDefaultMenuCornerRadius startAngle:-M_PI_2 endAngle:0 clockwise:YES]; + [path addLineToPoint:CGPointMake(self.bounds.size.width , anglePoint.y - (FTDefaultMenuCornerRadius + self.menuArrowHeight))]; + [path addArcWithCenter:CGPointMake(self.bounds.size.width - FTDefaultMenuCornerRadius, anglePoint.y - (FTDefaultMenuCornerRadius + self.menuArrowHeight)) radius:FTDefaultMenuCornerRadius startAngle:0 endAngle:M_PI_2 clockwise:YES]; + [path closePath]; + + }break; + default: + break; + } + + _backgroundLayer = [CAShapeLayer layer]; + _backgroundLayer.path = path.CGPath; + _backgroundLayer.lineWidth = [FTPopOverMenuConfiguration defaultConfiguration].borderWidth; + _backgroundLayer.fillColor = [FTPopOverMenuConfiguration defaultConfiguration].tintColor.CGColor; + _backgroundLayer.strokeColor = [FTPopOverMenuConfiguration defaultConfiguration].borderColor.CGColor; + [self.layer insertSublayer:_backgroundLayer atIndex:0]; +} + + +#pragma mark - UITableViewDelegate,UITableViewDataSource +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 0.f; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return [FTPopOverMenuConfiguration defaultConfiguration].menuRowHeight; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return 0.f; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return _menuStringArray.count; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + id menuImage; + if (_menuImageArray.count - 1 >= indexPath.row) { + menuImage = _menuImageArray[indexPath.row]; + } + FTPopOverMenuCell *menuCell = [[FTPopOverMenuCell alloc]initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:FTPopOverMenuTableViewCellIndentifier + menuName:[NSString stringWithFormat:@"%@", _menuStringArray[indexPath.row]] + menuImage:menuImage]; + if (indexPath.row == _menuStringArray.count-1) { + menuCell.separatorInset = UIEdgeInsetsMake(0, self.bounds.size.width, 0, 0); + }else{ + menuCell.separatorInset = UIEdgeInsetsMake(0, [FTPopOverMenuConfiguration defaultConfiguration].menuTextMargin, 0, [FTPopOverMenuConfiguration defaultConfiguration].menuTextMargin); + } + return menuCell; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + + if (self.doneBlock) { + self.doneBlock(indexPath.row); + } +} + +@end + + +#pragma mark - FTPopOverMenu + +@interface FTPopOverMenu () + +@property (nonatomic, strong) UIView * backgroundView; +@property (nonatomic, strong) FTPopOverMenuView *popMenuView; +@property (nonatomic, strong) FTPopOverMenuDoneBlock doneBlock; +@property (nonatomic, strong) FTPopOverMenuDismissBlock dismissBlock; + +@property (nonatomic, strong) UIView *sender; +@property (nonatomic, assign) CGRect senderFrame; +@property (nonatomic, strong) NSArray *menuArray; +@property (nonatomic, strong) NSArray *menuImageArray; +@property (nonatomic, assign) BOOL isCurrentlyOnScreen; + +@end + +@implementation FTPopOverMenu + ++ (FTPopOverMenu *)sharedInstance +{ + static dispatch_once_t once = 0; + static FTPopOverMenu *shared; + dispatch_once(&once, ^{ shared = [[FTPopOverMenu alloc] init]; }); + return shared; +} + +#pragma mark - Public Method + ++ (void) showForSender:(UIView *)sender + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:sender senderFrame:CGRectNull withMenu:menuArray imageNameArray:nil doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++ (void) showForSender:(UIView *)sender + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:sender senderFrame:CGRectNull withMenu:menuArray imageNameArray:imageArray doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++ (void) showFromEvent:(UIEvent *)event + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:[event.allTouches.anyObject view] senderFrame:CGRectNull withMenu:menuArray imageNameArray:nil doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++ (void) showFromEvent:(UIEvent *)event + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:[event.allTouches.anyObject view] senderFrame:CGRectNull withMenu:menuArray imageNameArray:imageArray doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++ (void) showFromSenderFrame:(CGRect )senderFrame + withMenuArray:(NSArray *)menuArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:nil senderFrame:senderFrame withMenu:menuArray imageNameArray:nil doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++ (void) showFromSenderFrame:(CGRect )senderFrame + withMenuArray:(NSArray *)menuArray + imageArray:(NSArray *)imageArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + [[self sharedInstance] showForSender:nil senderFrame:senderFrame withMenu:menuArray imageNameArray:imageArray doneBlock:doneBlock dismissBlock:dismissBlock]; +} + ++(void)dismiss +{ + [[self sharedInstance] dismiss]; +} + +#pragma mark - Private Methods +- (instancetype)init +{ + self = [super init]; + if (self) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onChangeStatusBarOrientationNotification:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:nil]; + } + return self; +} + +- (UIWindow *)backgroundWindow +{ + UIWindow *window = [[UIApplication sharedApplication] keyWindow]; + id delegate = [[UIApplication sharedApplication] delegate]; + if (window == nil && [delegate respondsToSelector:@selector(window)]){ + window = [delegate performSelector:@selector(window)]; + } + return window; +} + +-(UIView *)backgroundView +{ + if (!_backgroundView) { + _backgroundView = [[UIView alloc ]initWithFrame:[UIScreen mainScreen].bounds]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onBackgroundViewTapped:)]; + tap.delegate = self; + [_backgroundView addGestureRecognizer:tap]; + _backgroundView.backgroundColor = FTDefaultBackgroundColor; + } + return _backgroundView; +} +-(FTPopOverMenuView *)popMenuView +{ + if (!_popMenuView) { + _popMenuView = [[FTPopOverMenuView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; + _popMenuView.alpha = 0; + } + return _popMenuView; +} + +-(CGFloat)menuArrowWidth +{ + return [FTPopOverMenuConfiguration defaultConfiguration].allowRoundedArrow ? FTDefaultMenuArrowWidth_R : FTDefaultMenuArrowWidth; +} +-(CGFloat)menuArrowHeight +{ + return [FTPopOverMenuConfiguration defaultConfiguration].allowRoundedArrow ? FTDefaultMenuArrowHeight_R : FTDefaultMenuArrowHeight; +} + +-(void)onChangeStatusBarOrientationNotification:(NSNotification *)notification +{ + if (self.isCurrentlyOnScreen) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self adjustPopOverMenu]; + }); + } +} + +- (void) showForSender:(UIView *)sender + senderFrame:(CGRect )senderFrame + withMenu:(NSArray *)menuArray + imageNameArray:(NSArray *)imageNameArray + doneBlock:(FTPopOverMenuDoneBlock)doneBlock + dismissBlock:(FTPopOverMenuDismissBlock)dismissBlock +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self.backgroundView addSubview:self.popMenuView]; + [[self backgroundWindow] addSubview:self.backgroundView]; + + self.sender = sender; + self.senderFrame = senderFrame; + self.menuArray = menuArray; + self.menuImageArray = imageNameArray; + self.doneBlock = doneBlock; + self.dismissBlock = dismissBlock; + + [self adjustPopOverMenu]; + }); +} + +-(void)adjustPopOverMenu +{ + + [self.backgroundView setFrame:CGRectMake(0, 0, KSCREEN_WIDTH, KSCREEN_HEIGHT)]; + + CGRect senderRect ; + + if (self.sender) { + senderRect = [self.sender.superview convertRect:self.sender.frame toView:self.backgroundView]; + // if run into touch problems on nav bar, use the fowllowing line. + // senderRect.origin.y = MAX(64-senderRect.origin.y, senderRect.origin.y); + }else{ + senderRect = self.senderFrame; + } + if (senderRect.origin.y > KSCREEN_HEIGHT) { + senderRect.origin.y = KSCREEN_HEIGHT; + } + + CGFloat menuHeight = [FTPopOverMenuConfiguration defaultConfiguration].menuRowHeight * self.menuArray.count + self.menuArrowHeight; + CGPoint menuArrowPoint = CGPointMake(senderRect.origin.x + (senderRect.size.width)/2, 0); + CGFloat menuX = 0; + CGRect menuRect = CGRectZero; + BOOL shouldAutoScroll = NO; + FTPopOverMenuArrowDirection arrowDirection; + + if (senderRect.origin.y + senderRect.size.height/2 < KSCREEN_HEIGHT/2) { + arrowDirection = FTPopOverMenuArrowDirectionUp; + menuArrowPoint.y = 0; + }else{ + arrowDirection = FTPopOverMenuArrowDirectionDown; + menuArrowPoint.y = menuHeight; + + } + + if (menuArrowPoint.x + [FTPopOverMenuConfiguration defaultConfiguration].menuWidth/2 + FTDefaultMargin > KSCREEN_WIDTH) { + menuArrowPoint.x = MIN(menuArrowPoint.x - (KSCREEN_WIDTH - [FTPopOverMenuConfiguration defaultConfiguration].menuWidth - FTDefaultMargin), [FTPopOverMenuConfiguration defaultConfiguration].menuWidth - self.menuArrowWidth - FTDefaultMargin); + menuX = KSCREEN_WIDTH - [FTPopOverMenuConfiguration defaultConfiguration].menuWidth - FTDefaultMargin; + }else if ( menuArrowPoint.x - [FTPopOverMenuConfiguration defaultConfiguration].menuWidth/2 - FTDefaultMargin < 0){ + menuArrowPoint.x = MAX( FTDefaultMenuCornerRadius + self.menuArrowWidth, menuArrowPoint.x - FTDefaultMargin); + menuX = FTDefaultMargin; + }else{ + menuArrowPoint.x = [FTPopOverMenuConfiguration defaultConfiguration].menuWidth/2; + menuX = senderRect.origin.x + (senderRect.size.width)/2 - [FTPopOverMenuConfiguration defaultConfiguration].menuWidth/2; + } + + if (arrowDirection == FTPopOverMenuArrowDirectionUp) { + menuRect = CGRectMake(menuX, (senderRect.origin.y + senderRect.size.height), [FTPopOverMenuConfiguration defaultConfiguration].menuWidth, menuHeight); + // if too long and is out of screen + if (menuRect.origin.y + menuRect.size.height > KSCREEN_HEIGHT) { + menuRect = CGRectMake(menuX, (senderRect.origin.y + senderRect.size.height), [FTPopOverMenuConfiguration defaultConfiguration].menuWidth, KSCREEN_HEIGHT - menuRect.origin.y - FTDefaultMargin); + shouldAutoScroll = YES; + } + }else{ + + menuRect = CGRectMake(menuX, (senderRect.origin.y - menuHeight), [FTPopOverMenuConfiguration defaultConfiguration].menuWidth, menuHeight); + // if too long and is out of screen + if (menuRect.origin.y < 0) { + menuRect = CGRectMake(menuX, FTDefaultMargin, [FTPopOverMenuConfiguration defaultConfiguration].menuWidth, senderRect.origin.y - FTDefaultMargin); + menuArrowPoint.y = senderRect.origin.y; + shouldAutoScroll = YES; + } + } + + [self prepareToShowWithMenuRect:menuRect + menuArrowPoint:menuArrowPoint + shouldAutoScroll:shouldAutoScroll + arrowDirection:arrowDirection]; + + + [self show]; +} + +-(void)prepareToShowWithMenuRect:(CGRect)menuRect menuArrowPoint:(CGPoint)menuArrowPoint shouldAutoScroll:(BOOL)shouldAutoScroll arrowDirection:(FTPopOverMenuArrowDirection)arrowDirection +{ + CGPoint anchorPoint = CGPointMake(menuArrowPoint.x/menuRect.size.width, 0); + if (arrowDirection == FTPopOverMenuArrowDirectionDown) { + anchorPoint = CGPointMake(menuArrowPoint.x/menuRect.size.width, 1); + } + _popMenuView.transform = CGAffineTransformMakeScale(1, 1); + + [_popMenuView showWithFrame:menuRect + anglePoint:menuArrowPoint + withNameArray:self.menuArray + imageNameArray:self.menuImageArray + shouldAutoScroll:shouldAutoScroll + arrowDirection:arrowDirection + doneBlock:^(NSInteger selectedIndex) { + [self doneActionWithSelectedIndex:selectedIndex]; + }]; + + [self setAnchorPoint:anchorPoint forView:_popMenuView]; + + _popMenuView.transform = CGAffineTransformMakeScale(0.1, 0.1); +} + + +-(void)setAnchorPoint:(CGPoint)anchorPoint forView:(UIView *)view +{ + CGPoint newPoint = CGPointMake(view.bounds.size.width * anchorPoint.x, + view.bounds.size.height * anchorPoint.y); + CGPoint oldPoint = CGPointMake(view.bounds.size.width * view.layer.anchorPoint.x, + view.bounds.size.height * view.layer.anchorPoint.y); + + newPoint = CGPointApplyAffineTransform(newPoint, view.transform); + oldPoint = CGPointApplyAffineTransform(oldPoint, view.transform); + + CGPoint position = view.layer.position; + + position.x -= oldPoint.x; + position.x += newPoint.x; + + position.y -= oldPoint.y; + position.y += newPoint.y; + + view.layer.position = position; + view.layer.anchorPoint = anchorPoint; +} + +#pragma mark - UIGestureRecognizerDelegate +-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch +{ + CGPoint point = [touch locationInView:_popMenuView]; + if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) { + return NO; + }else if (CGRectContainsPoint(CGRectMake(0, 0, [FTPopOverMenuConfiguration defaultConfiguration].menuWidth, [FTPopOverMenuConfiguration defaultConfiguration].menuRowHeight), point)) { + [self doneActionWithSelectedIndex:0]; + return NO; + } + return YES; +} + +#pragma mark - onBackgroundViewTapped + +-(void)onBackgroundViewTapped:(UIGestureRecognizer *)gesture +{ + [self dismiss]; +} + +#pragma mark - show animation + +- (void)show +{ + self.isCurrentlyOnScreen = YES; + [UIView animateWithDuration:FTDefaultAnimationDuration + animations:^{ + _popMenuView.alpha = 1; + _popMenuView.transform = CGAffineTransformMakeScale(1, 1); + }]; +} + +#pragma mark - dismiss animation + +- (void)dismiss +{ + self.isCurrentlyOnScreen = NO; + [self doneActionWithSelectedIndex:-1]; +} + +#pragma mark - doneActionWithSelectedIndex + +-(void)doneActionWithSelectedIndex:(NSInteger)selectedIndex +{ + [UIView animateWithDuration:FTDefaultAnimationDuration + animations:^{ + _popMenuView.alpha = 0; + _popMenuView.transform = CGAffineTransformMakeScale(0.1, 0.1); + }completion:^(BOOL finished) { + if (finished) { + [self.popMenuView removeFromSuperview]; + [self.backgroundView removeFromSuperview]; + if (selectedIndex < 0) { + if (self.dismissBlock) { + self.dismissBlock(); + } + }else{ + if (self.doneBlock) { + self.doneBlock(selectedIndex); + } + } + } + }]; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.h new file mode 100755 index 0000000..82a0249 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.h @@ -0,0 +1,20 @@ +// +// MJRefreshAutoFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshFooter.h" + +@interface MJRefreshAutoFooter : MJRefreshFooter +/** 是否自动刷新(默认为YES) */ +@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh; + +/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */ +@property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh MJRefreshDeprecated("请使用triggerAutomaticallyRefreshPercent属性"); + +/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */ +@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.m new file mode 100755 index 0000000..7327096 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshAutoFooter.m @@ -0,0 +1,139 @@ +// +// MJRefreshAutoFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoFooter.h" + +@interface MJRefreshAutoFooter() +@end + +@implementation MJRefreshAutoFooter + +#pragma mark - 初始化 +- (void)willMoveToSuperview:(UIView *)newSuperview +{ + [super willMoveToSuperview:newSuperview]; + + if (newSuperview) { // 新的父控件 + if (self.hidden == NO) { + self.scrollView.mj_insetB += self.mj_h; + } + + // 设置位置 + self.mj_y = _scrollView.mj_contentH; + } else { // 被移除了 + if (self.hidden == NO) { + self.scrollView.mj_insetB -= self.mj_h; + } + } +} + +#pragma mark - 过期方法 +- (void)setAppearencePercentTriggerAutoRefresh:(CGFloat)appearencePercentTriggerAutoRefresh +{ + self.triggerAutomaticallyRefreshPercent = appearencePercentTriggerAutoRefresh; +} + +- (CGFloat)appearencePercentTriggerAutoRefresh +{ + return self.triggerAutomaticallyRefreshPercent; +} + +#pragma mark - 实现父类的方法 +- (void)prepare +{ + [super prepare]; + + // 默认底部控件100%出现时才会自动刷新 + self.triggerAutomaticallyRefreshPercent = 1.0; + + // 设置为默认状态 + self.automaticallyRefresh = YES; +} + +- (void)scrollViewContentSizeDidChange:(NSDictionary *)change +{ + [super scrollViewContentSizeDidChange:change]; + + // 设置位置 + self.mj_y = self.scrollView.mj_contentH; +} + +- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change +{ + [super scrollViewContentOffsetDidChange:change]; + + if (self.state != MJRefreshStateIdle || !self.automaticallyRefresh || self.mj_y == 0) return; + + if (_scrollView.mj_insetT + _scrollView.mj_contentH > _scrollView.mj_h) { // 内容超过一个屏幕 + // 这里的_scrollView.mj_contentH替换掉self.mj_y更为合理 + if (_scrollView.mj_offsetY >= _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h * self.triggerAutomaticallyRefreshPercent + _scrollView.mj_insetB - self.mj_h) { + // 防止手松开时连续调用 + CGPoint old = [change[@"old"] CGPointValue]; + CGPoint new = [change[@"new"] CGPointValue]; + if (new.y <= old.y) return; + + // 当底部刷新控件完全出现时,才刷新 + [self beginRefreshing]; + } + } +} + +- (void)scrollViewPanStateDidChange:(NSDictionary *)change +{ + [super scrollViewPanStateDidChange:change]; + + if (self.state != MJRefreshStateIdle) return; + + if (_scrollView.panGestureRecognizer.state == UIGestureRecognizerStateEnded) {// 手松开 + if (_scrollView.mj_insetT + _scrollView.mj_contentH <= _scrollView.mj_h) { // 不够一个屏幕 + if (_scrollView.mj_offsetY >= - _scrollView.mj_insetT) { // 向上拽 + [self beginRefreshing]; + } + } else { // 超出一个屏幕 + if (_scrollView.mj_offsetY >= _scrollView.mj_contentH + _scrollView.mj_insetB - _scrollView.mj_h) { + [self beginRefreshing]; + } + } + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + if (state == MJRefreshStateRefreshing) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self executeRefreshingCallback]; + }); + } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { + if (MJRefreshStateRefreshing == oldState) { + if (self.endRefreshingCompletionBlock) { + self.endRefreshingCompletionBlock(); + } + } + } +} + +- (void)setHidden:(BOOL)hidden +{ + BOOL lastHidden = self.isHidden; + + [super setHidden:hidden]; + + if (!lastHidden && hidden) { + self.state = MJRefreshStateIdle; + + self.scrollView.mj_insetB -= self.mj_h; + } else if (lastHidden && !hidden) { + self.scrollView.mj_insetB += self.mj_h; + + // 设置位置 + self.mj_y = _scrollView.mj_contentH; + } +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.h new file mode 100755 index 0000000..347083c --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.h @@ -0,0 +1,13 @@ +// +// MJRefreshBackFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshFooter.h" + +@interface MJRefreshBackFooter : MJRefreshFooter + +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.m new file mode 100755 index 0000000..83978ad --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshBackFooter.m @@ -0,0 +1,160 @@ +// +// MJRefreshBackFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackFooter.h" + +@interface MJRefreshBackFooter() +@property (assign, nonatomic) NSInteger lastRefreshCount; +@property (assign, nonatomic) CGFloat lastBottomDelta; +@end + +@implementation MJRefreshBackFooter + +#pragma mark - 初始化 +- (void)willMoveToSuperview:(UIView *)newSuperview +{ + [super willMoveToSuperview:newSuperview]; + + [self scrollViewContentSizeDidChange:nil]; +} + +#pragma mark - 实现父类的方法 +- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change +{ + [super scrollViewContentOffsetDidChange:change]; + + // 如果正在刷新,直接返回 + if (self.state == MJRefreshStateRefreshing) return; + + _scrollViewOriginalInset = self.scrollView.contentInset; + + // 当前的contentOffset + CGFloat currentOffsetY = self.scrollView.mj_offsetY; + // 尾部控件刚好出现的offsetY + CGFloat happenOffsetY = [self happenOffsetY]; + // 如果是向下滚动到看不见尾部控件,直接返回 + if (currentOffsetY <= happenOffsetY) return; + + CGFloat pullingPercent = (currentOffsetY - happenOffsetY) / self.mj_h; + + // 如果已全部加载,仅设置pullingPercent,然后返回 + if (self.state == MJRefreshStateNoMoreData) { + self.pullingPercent = pullingPercent; + return; + } + + if (self.scrollView.isDragging) { + self.pullingPercent = pullingPercent; + // 普通 和 即将刷新 的临界点 + CGFloat normal2pullingOffsetY = happenOffsetY + self.mj_h; + + if (self.state == MJRefreshStateIdle && currentOffsetY > normal2pullingOffsetY) { + // 转为即将刷新状态 + self.state = MJRefreshStatePulling; + } else if (self.state == MJRefreshStatePulling && currentOffsetY <= normal2pullingOffsetY) { + // 转为普通状态 + self.state = MJRefreshStateIdle; + } + } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 + // 开始刷新 + [self beginRefreshing]; + } else if (pullingPercent < 1) { + self.pullingPercent = pullingPercent; + } +} + +- (void)scrollViewContentSizeDidChange:(NSDictionary *)change +{ + [super scrollViewContentSizeDidChange:change]; + + // 内容的高度 + CGFloat contentHeight = self.scrollView.mj_contentH + self.ignoredScrollViewContentInsetBottom; + // 表格的高度 + CGFloat scrollHeight = self.scrollView.mj_h - self.scrollViewOriginalInset.top - self.scrollViewOriginalInset.bottom + self.ignoredScrollViewContentInsetBottom; + // 设置位置和尺寸 + self.mj_y = MAX(contentHeight, scrollHeight); +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态来设置属性 + if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { + // 刷新完毕 + if (MJRefreshStateRefreshing == oldState) { + [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ + self.scrollView.mj_insetB -= self.lastBottomDelta; + + // 自动调整透明度 + if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0; + } completion:^(BOOL finished) { + self.pullingPercent = 0.0; + + if (self.endRefreshingCompletionBlock) { + self.endRefreshingCompletionBlock(); + } + }]; + } + + CGFloat deltaH = [self heightForContentBreakView]; + // 刚刷新完毕 + if (MJRefreshStateRefreshing == oldState && deltaH > 0 && self.scrollView.mj_totalDataCount != self.lastRefreshCount) { + self.scrollView.mj_offsetY = self.scrollView.mj_offsetY; + } + } else if (state == MJRefreshStateRefreshing) { + // 记录刷新前的数量 + self.lastRefreshCount = self.scrollView.mj_totalDataCount; + + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + CGFloat bottom = self.mj_h + self.scrollViewOriginalInset.bottom; + CGFloat deltaH = [self heightForContentBreakView]; + if (deltaH < 0) { // 如果内容高度小于view的高度 + bottom -= deltaH; + } + self.lastBottomDelta = bottom - self.scrollView.mj_insetB; + self.scrollView.mj_insetB = bottom; + self.scrollView.mj_offsetY = [self happenOffsetY] + self.mj_h; + } completion:^(BOOL finished) { + [self executeRefreshingCallback]; + }]; + } +} + +- (void)endRefreshing +{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.state = MJRefreshStateIdle; + }); +} + +- (void)endRefreshingWithNoMoreData +{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.state = MJRefreshStateNoMoreData; + }); +} +#pragma mark - 私有方法 +#pragma mark 获得scrollView的内容 超出 view 的高度 +- (CGFloat)heightForContentBreakView +{ + CGFloat h = self.scrollView.frame.size.height - self.scrollViewOriginalInset.bottom - self.scrollViewOriginalInset.top; + return self.scrollView.contentSize.height - h; +} + +#pragma mark 刚好看到上拉刷新控件时的contentOffset.y +- (CGFloat)happenOffsetY +{ + CGFloat deltaH = [self heightForContentBreakView]; + if (deltaH > 0) { + return deltaH - self.scrollViewOriginalInset.top; + } else { + return - self.scrollViewOriginalInset.top; + } +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.h new file mode 100755 index 0000000..9e96c89 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.h @@ -0,0 +1,106 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshComponent.h +// MJRefreshExample +// +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. +// 刷新控件的基类 + +#import +#import "MJRefreshConst.h" +#import "UIView+MJExtension.h" +#import "UIScrollView+MJExtension.h" +#import "UIScrollView+MJRefresh.h" +#import "NSBundle+MJRefresh.h" + +/** 刷新控件的状态 */ +typedef NS_ENUM(NSInteger, MJRefreshState) { + /** 普通闲置状态 */ + MJRefreshStateIdle = 1, + /** 松开就可以进行刷新的状态 */ + MJRefreshStatePulling, + /** 正在刷新中的状态 */ + MJRefreshStateRefreshing, + /** 即将刷新的状态 */ + MJRefreshStateWillRefresh, + /** 所有数据加载完毕,没有更多的数据了 */ + MJRefreshStateNoMoreData +}; + +/** 进入刷新状态的回调 */ +typedef void (^MJRefreshComponentRefreshingBlock)(); +/** 开始刷新后的回调(进入刷新状态后的回调) */ +typedef void (^MJRefreshComponentbeginRefreshingCompletionBlock)(); +/** 结束刷新后的回调 */ +typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(); + +/** 刷新控件的基类 */ +@interface MJRefreshComponent : UIView +{ + /** 记录scrollView刚开始的inset */ + UIEdgeInsets _scrollViewOriginalInset; + /** 父控件 */ + __weak UIScrollView *_scrollView; +} +#pragma mark - 刷新回调 +/** 正在刷新的回调 */ +@property (copy, nonatomic) MJRefreshComponentRefreshingBlock refreshingBlock; +/** 设置回调对象和回调方法 */ +- (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action; + +/** 回调对象 */ +@property (weak, nonatomic) id refreshingTarget; +/** 回调方法 */ +@property (assign, nonatomic) SEL refreshingAction; +/** 触发回调(交给子类去调用) */ +- (void)executeRefreshingCallback; + +#pragma mark - 刷新状态控制 +/** 进入刷新状态 */ +- (void)beginRefreshing; +- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock; +/** 开始刷新后的回调(进入刷新状态后的回调) */ +@property (copy, nonatomic) MJRefreshComponentbeginRefreshingCompletionBlock beginRefreshingCompletionBlock; +/** 结束刷新的回调 */ +@property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingCompletionBlock; +/** 结束刷新状态 */ +- (void)endRefreshing; +- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock; +/** 是否正在刷新 */ +- (BOOL)isRefreshing; +/** 刷新状态 一般交给子类内部实现 */ +@property (assign, nonatomic) MJRefreshState state; + +#pragma mark - 交给子类去访问 +/** 记录scrollView刚开始的inset */ +@property (assign, nonatomic, readonly) UIEdgeInsets scrollViewOriginalInset; +/** 父控件 */ +@property (weak, nonatomic, readonly) UIScrollView *scrollView; + +#pragma mark - 交给子类们去实现 +/** 初始化 */ +- (void)prepare NS_REQUIRES_SUPER; +/** 摆放子控件frame */ +- (void)placeSubviews NS_REQUIRES_SUPER; +/** 当scrollView的contentOffset发生改变的时候调用 */ +- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; +/** 当scrollView的contentSize发生改变的时候调用 */ +- (void)scrollViewContentSizeDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; +/** 当scrollView的拖拽状态发生改变的时候调用 */ +- (void)scrollViewPanStateDidChange:(NSDictionary *)change NS_REQUIRES_SUPER; + + +#pragma mark - 其他 +/** 拉拽的百分比(交给子类重写) */ +@property (assign, nonatomic) CGFloat pullingPercent; +/** 根据拖拽比例自动切换透明度 */ +@property (assign, nonatomic, getter=isAutoChangeAlpha) BOOL autoChangeAlpha MJRefreshDeprecated("请使用automaticallyChangeAlpha属性"); +/** 根据拖拽比例自动切换透明度 */ +@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha; +@end + +@interface UILabel(MJRefresh) ++ (instancetype)mj_label; +- (CGFloat)mj_textWith; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.m new file mode 100755 index 0000000..07cfa21 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshComponent.m @@ -0,0 +1,274 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshComponent.m +// MJRefreshExample +// +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshComponent.h" +#import "MJRefreshConst.h" + +@interface MJRefreshComponent() +@property (strong, nonatomic) UIPanGestureRecognizer *pan; +@end + +@implementation MJRefreshComponent +#pragma mark - 初始化 +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + // 准备工作 + [self prepare]; + + // 默认是普通状态 + self.state = MJRefreshStateIdle; + } + return self; +} + +- (void)prepare +{ + // 基本属性 + self.autoresizingMask = UIViewAutoresizingFlexibleWidth; + self.backgroundColor = [UIColor clearColor]; +} + +- (void)layoutSubviews +{ + [self placeSubviews]; + + [super layoutSubviews]; +} + +- (void)placeSubviews{} + +- (void)willMoveToSuperview:(UIView *)newSuperview +{ + [super willMoveToSuperview:newSuperview]; + + // 如果不是UIScrollView,不做任何事情 + if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return; + + // 旧的父控件移除监听 + [self removeObservers]; + + if (newSuperview) { // 新的父控件 + // 设置宽度 + self.mj_w = newSuperview.mj_w; + // 设置位置 + self.mj_x = 0; + + // 记录UIScrollView + _scrollView = (UIScrollView *)newSuperview; + // 设置永远支持垂直弹簧效果 + _scrollView.alwaysBounceVertical = YES; + // 记录UIScrollView最开始的contentInset + _scrollViewOriginalInset = _scrollView.contentInset; + + // 添加监听 + [self addObservers]; + } +} + +- (void)drawRect:(CGRect)rect +{ + [super drawRect:rect]; + + if (self.state == MJRefreshStateWillRefresh) { + // 预防view还没显示出来就调用了beginRefreshing + self.state = MJRefreshStateRefreshing; + } +} + +#pragma mark - KVO监听 +- (void)addObservers +{ + NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; + [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentOffset options:options context:nil]; + [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentSize options:options context:nil]; + self.pan = self.scrollView.panGestureRecognizer; + [self.pan addObserver:self forKeyPath:MJRefreshKeyPathPanState options:options context:nil]; +} + +- (void)removeObservers +{ + [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentOffset]; + [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentSize];; + [self.pan removeObserver:self forKeyPath:MJRefreshKeyPathPanState]; + self.pan = nil; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + // 遇到这些情况就直接返回 + if (!self.userInteractionEnabled) return; + + // 这个就算看不见也需要处理 + if ([keyPath isEqualToString:MJRefreshKeyPathContentSize]) { + [self scrollViewContentSizeDidChange:change]; + } + + // 看不见 + if (self.hidden) return; + if ([keyPath isEqualToString:MJRefreshKeyPathContentOffset]) { + [self scrollViewContentOffsetDidChange:change]; + } else if ([keyPath isEqualToString:MJRefreshKeyPathPanState]) { + [self scrollViewPanStateDidChange:change]; + } +} + +- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{} +- (void)scrollViewContentSizeDidChange:(NSDictionary *)change{} +- (void)scrollViewPanStateDidChange:(NSDictionary *)change{} + +#pragma mark - 公共方法 +#pragma mark 设置回调对象和回调方法 +- (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action +{ + self.refreshingTarget = target; + self.refreshingAction = action; +} + +- (void)setState:(MJRefreshState)state +{ + _state = state; + + // 加入主队列的目的是等setState:方法调用完毕、设置完文字后再去布局子控件 + dispatch_async(dispatch_get_main_queue(), ^{ + [self setNeedsLayout]; + }); +} + +#pragma mark 进入刷新状态 +- (void)beginRefreshing +{ + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + self.alpha = 1.0; + }]; + self.pullingPercent = 1.0; + // 只要正在刷新,就完全显示 + if (self.window) { + self.state = MJRefreshStateRefreshing; + } else { + // 预防正在刷新中时,调用本方法使得header inset回置失败 + if (self.state != MJRefreshStateRefreshing) { + self.state = MJRefreshStateWillRefresh; + // 刷新(预防从另一个控制器回到这个控制器的情况,回来要重新刷新一下) + [self setNeedsDisplay]; + } + } +} + +- (void)beginRefreshingWithCompletionBlock:(void (^)())completionBlock +{ + self.beginRefreshingCompletionBlock = completionBlock; + + [self beginRefreshing]; +} + +#pragma mark 结束刷新状态 +- (void)endRefreshing +{ + self.state = MJRefreshStateIdle; +} + +- (void)endRefreshingWithCompletionBlock:(void (^)())completionBlock +{ + self.endRefreshingCompletionBlock = completionBlock; + + [self endRefreshing]; +} + +#pragma mark 是否正在刷新 +- (BOOL)isRefreshing +{ + return self.state == MJRefreshStateRefreshing || self.state == MJRefreshStateWillRefresh; +} + +#pragma mark 自动切换透明度 +- (void)setAutoChangeAlpha:(BOOL)autoChangeAlpha +{ + self.automaticallyChangeAlpha = autoChangeAlpha; +} + +- (BOOL)isAutoChangeAlpha +{ + return self.isAutomaticallyChangeAlpha; +} + +- (void)setAutomaticallyChangeAlpha:(BOOL)automaticallyChangeAlpha +{ + _automaticallyChangeAlpha = automaticallyChangeAlpha; + + if (self.isRefreshing) return; + + if (automaticallyChangeAlpha) { + self.alpha = self.pullingPercent; + } else { + self.alpha = 1.0; + } +} + +#pragma mark 根据拖拽进度设置透明度 +- (void)setPullingPercent:(CGFloat)pullingPercent +{ + _pullingPercent = pullingPercent; + + if (self.isRefreshing) return; + + if (self.isAutomaticallyChangeAlpha) { + self.alpha = pullingPercent; + } +} + +#pragma mark - 内部方法 +- (void)executeRefreshingCallback +{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.refreshingBlock) { + self.refreshingBlock(); + } + if ([self.refreshingTarget respondsToSelector:self.refreshingAction]) { + MJRefreshMsgSend(MJRefreshMsgTarget(self.refreshingTarget), self.refreshingAction, self); + } + if (self.beginRefreshingCompletionBlock) { + self.beginRefreshingCompletionBlock(); + } + }); +} +@end + +@implementation UILabel(MJRefresh) ++ (instancetype)mj_label +{ + UILabel *label = [[self alloc] init]; + label.font = MJRefreshLabelFont; + label.textColor = MJRefreshLabelTextColor; + label.autoresizingMask = UIViewAutoresizingFlexibleWidth; + label.textAlignment = NSTextAlignmentCenter; + label.backgroundColor = [UIColor clearColor]; + return label; +} + +- (CGFloat)mj_textWith { + CGFloat stringWidth = 0; + CGSize size = CGSizeMake(MAXFLOAT, MAXFLOAT); + if (self.text.length > 0) { +#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 + stringWidth =[self.text + boundingRectWithSize:size + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName:self.font} + context:nil].size.width; +#else + + stringWidth = [self.text sizeWithFont:self.font + constrainedToSize:size + lineBreakMode:NSLineBreakByCharWrapping].width; +#endif + } + return stringWidth; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.h new file mode 100755 index 0000000..22d23e5 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.h @@ -0,0 +1,30 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/3/5. +// Copyright (c) 2015年 小码哥. All rights reserved. +// 上拉刷新控件 + +#import "MJRefreshComponent.h" + +@interface MJRefreshFooter : MJRefreshComponent +/** 创建footer */ ++ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock; +/** 创建footer */ ++ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action; + +/** 提示没有更多的数据 */ +- (void)endRefreshingWithNoMoreData; +- (void)noticeNoMoreData MJRefreshDeprecated("使用endRefreshingWithNoMoreData"); + +/** 重置没有更多的数据(消除没有更多数据的状态) */ +- (void)resetNoMoreData; + +/** 忽略多少scrollView的contentInset的bottom */ +@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom; + +/** 自动根据有无数据来显示和隐藏(有数据就显示,没有数据隐藏。默认是NO) */ +@property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.m new file mode 100755 index 0000000..69f65e7 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshFooter.m @@ -0,0 +1,74 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/3/5. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshFooter.h" + +@interface MJRefreshFooter() + +@end + +@implementation MJRefreshFooter +#pragma mark - 构造方法 ++ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock +{ + MJRefreshFooter *cmp = [[self alloc] init]; + cmp.refreshingBlock = refreshingBlock; + return cmp; +} ++ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action +{ + MJRefreshFooter *cmp = [[self alloc] init]; + [cmp setRefreshingTarget:target refreshingAction:action]; + return cmp; +} + +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + // 设置自己的高度 + self.mj_h = MJRefreshFooterHeight; + + // 默认不会自动隐藏 + self.automaticallyHidden = NO; +} + +- (void)willMoveToSuperview:(UIView *)newSuperview +{ + [super willMoveToSuperview:newSuperview]; + + if (newSuperview) { + // 监听scrollView数据的变化 + if ([self.scrollView isKindOfClass:[UITableView class]] || [self.scrollView isKindOfClass:[UICollectionView class]]) { + [self.scrollView setMj_reloadDataBlock:^(NSInteger totalDataCount) { + if (self.isAutomaticallyHidden) { + self.hidden = (totalDataCount == 0); + } + }]; + } + } +} + +#pragma mark - 公共方法 +- (void)endRefreshingWithNoMoreData +{ + self.state = MJRefreshStateNoMoreData; +} + +- (void)noticeNoMoreData +{ + [self endRefreshingWithNoMoreData]; +} + +- (void)resetNoMoreData +{ + self.state = MJRefreshStateIdle; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.h new file mode 100755 index 0000000..0816024 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.h @@ -0,0 +1,25 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshHeader.h +// MJRefreshExample +// +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. +// 下拉刷新控件:负责监控用户下拉的状态 + +#import "MJRefreshComponent.h" + +@interface MJRefreshHeader : MJRefreshComponent +/** 创建header */ ++ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock; +/** 创建header */ ++ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action; + +/** 这个key用来存储上一次下拉刷新成功的时间 */ +@property (copy, nonatomic) NSString *lastUpdatedTimeKey; +/** 上一次下拉刷新成功的时间 */ +@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime; + +/** 忽略多少scrollView的contentInset的top */ +@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.m new file mode 100755 index 0000000..070cea6 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Base/MJRefreshHeader.m @@ -0,0 +1,153 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// MJRefreshHeader.m +// MJRefreshExample +// +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshHeader.h" + +@interface MJRefreshHeader() +@property (assign, nonatomic) CGFloat insetTDelta; +@end + +@implementation MJRefreshHeader +#pragma mark - 构造方法 ++ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock +{ + MJRefreshHeader *cmp = [[self alloc] init]; + cmp.refreshingBlock = refreshingBlock; + return cmp; +} ++ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action +{ + MJRefreshHeader *cmp = [[self alloc] init]; + [cmp setRefreshingTarget:target refreshingAction:action]; + return cmp; +} + +#pragma mark - 覆盖父类的方法 +- (void)prepare +{ + [super prepare]; + + // 设置key + self.lastUpdatedTimeKey = MJRefreshHeaderLastUpdatedTimeKey; + + // 设置高度 + self.mj_h = MJRefreshHeaderHeight; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + // 设置y值(当自己的高度发生改变了,肯定要重新调整Y值,所以放到placeSubviews方法中设置y值) + self.mj_y = - self.mj_h - self.ignoredScrollViewContentInsetTop; +} + +- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change +{ + [super scrollViewContentOffsetDidChange:change]; + + // 在刷新的refreshing状态 + if (self.state == MJRefreshStateRefreshing) { + if (self.window == nil) return; + + // sectionheader停留解决 + CGFloat insetT = - self.scrollView.mj_offsetY > _scrollViewOriginalInset.top ? - self.scrollView.mj_offsetY : _scrollViewOriginalInset.top; + insetT = insetT > self.mj_h + _scrollViewOriginalInset.top ? self.mj_h + _scrollViewOriginalInset.top : insetT; + self.scrollView.mj_insetT = insetT; + + self.insetTDelta = _scrollViewOriginalInset.top - insetT; + return; + } + + // 跳转到下一个控制器时,contentInset可能会变 + _scrollViewOriginalInset = self.scrollView.contentInset; + + // 当前的contentOffset + CGFloat offsetY = self.scrollView.mj_offsetY; + // 头部控件刚好出现的offsetY + CGFloat happenOffsetY = - self.scrollViewOriginalInset.top; + + // 如果是向上滚动到看不见头部控件,直接返回 + // >= -> > + if (offsetY > happenOffsetY) return; + + // 普通 和 即将刷新 的临界点 + CGFloat normal2pullingOffsetY = happenOffsetY - self.mj_h; + CGFloat pullingPercent = (happenOffsetY - offsetY) / self.mj_h; + + if (self.scrollView.isDragging) { // 如果正在拖拽 + self.pullingPercent = pullingPercent; + if (self.state == MJRefreshStateIdle && offsetY < normal2pullingOffsetY) { + // 转为即将刷新状态 + self.state = MJRefreshStatePulling; + } else if (self.state == MJRefreshStatePulling && offsetY >= normal2pullingOffsetY) { + // 转为普通状态 + self.state = MJRefreshStateIdle; + } + } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 + // 开始刷新 + [self beginRefreshing]; + } else if (pullingPercent < 1) { + self.pullingPercent = pullingPercent; + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStateIdle) { + if (oldState != MJRefreshStateRefreshing) return; + + // 保存刷新时间 + [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:self.lastUpdatedTimeKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + // 恢复inset和offset + [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ + self.scrollView.mj_insetT += self.insetTDelta; + + // 自动调整透明度 + if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0; + } completion:^(BOOL finished) { + self.pullingPercent = 0.0; + + if (self.endRefreshingCompletionBlock) { + self.endRefreshingCompletionBlock(); + } + }]; + } else if (state == MJRefreshStateRefreshing) { + dispatch_async(dispatch_get_main_queue(), ^{ + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + CGFloat top = self.scrollViewOriginalInset.top + self.mj_h; + // 增加滚动区域top + self.scrollView.mj_insetT = top; + // 设置滚动位置 + [self.scrollView setContentOffset:CGPointMake(0, -top) animated:NO]; + } completion:^(BOOL finished) { + [self executeRefreshingCallback]; + }]; + }); + } +} + +#pragma mark - 公共方法 +- (void)endRefreshing +{ + dispatch_async(dispatch_get_main_queue(), ^{ + self.state = MJRefreshStateIdle; + }); +} + +- (NSDate *)lastUpdatedTime +{ + return [[NSUserDefaults standardUserDefaults] objectForKey:self.lastUpdatedTimeKey]; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h new file mode 100755 index 0000000..6a127e6 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h @@ -0,0 +1,17 @@ +// +// MJRefreshAutoGifFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoStateFooter.h" + +@interface MJRefreshAutoGifFooter : MJRefreshAutoStateFooter +@property (weak, nonatomic, readonly) UIImageView *gifView; + +/** 设置state状态下的动画图片images 动画持续时间duration*/ +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m new file mode 100755 index 0000000..2507138 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m @@ -0,0 +1,116 @@ +// +// MJRefreshAutoGifFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoGifFooter.h" + +@interface MJRefreshAutoGifFooter() +{ + __unsafe_unretained UIImageView *_gifView; +} +/** 所有状态对应的动画图片 */ +@property (strong, nonatomic) NSMutableDictionary *stateImages; +/** 所有状态对应的动画时间 */ +@property (strong, nonatomic) NSMutableDictionary *stateDurations; +@end + +@implementation MJRefreshAutoGifFooter +#pragma mark - 懒加载 +- (UIImageView *)gifView +{ + if (!_gifView) { + UIImageView *gifView = [[UIImageView alloc] init]; + [self addSubview:_gifView = gifView]; + } + return _gifView; +} + +- (NSMutableDictionary *)stateImages +{ + if (!_stateImages) { + self.stateImages = [NSMutableDictionary dictionary]; + } + return _stateImages; +} + +- (NSMutableDictionary *)stateDurations +{ + if (!_stateDurations) { + self.stateDurations = [NSMutableDictionary dictionary]; + } + return _stateDurations; +} + +#pragma mark - 公共方法 +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state +{ + if (images == nil) return; + + self.stateImages[@(state)] = images; + self.stateDurations[@(state)] = @(duration); + + /* 根据图片设置控件的高度 */ + UIImage *image = [images firstObject]; + if (image.size.height > self.mj_h) { + self.mj_h = image.size.height; + } +} + +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state +{ + [self setImages:images duration:images.count * 0.1 forState:state]; +} + +#pragma mark - 实现父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = 20; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.gifView.constraints.count) return; + + self.gifView.frame = self.bounds; + if (self.isRefreshingTitleHidden) { + self.gifView.contentMode = UIViewContentModeCenter; + } else { + self.gifView.contentMode = UIViewContentModeRight; + self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWith * 0.5; + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStateRefreshing) { + NSArray *images = self.stateImages[@(state)]; + if (images.count == 0) return; + [self.gifView stopAnimating]; + + self.gifView.hidden = NO; + if (images.count == 1) { // 单张图片 + self.gifView.image = [images lastObject]; + } else { // 多张图片 + self.gifView.animationImages = images; + self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; + [self.gifView startAnimating]; + } + } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { + [self.gifView stopAnimating]; + self.gifView.hidden = YES; + } +} +@end + diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h new file mode 100755 index 0000000..5549cff --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h @@ -0,0 +1,14 @@ +// +// MJRefreshAutoNormalFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoStateFooter.h" + +@interface MJRefreshAutoNormalFooter : MJRefreshAutoStateFooter +/** 菊花的样式 */ +@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m new file mode 100755 index 0000000..dae9060 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m @@ -0,0 +1,69 @@ +// +// MJRefreshAutoNormalFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoNormalFooter.h" + +@interface MJRefreshAutoNormalFooter() +@property (weak, nonatomic) UIActivityIndicatorView *loadingView; +@end + +@implementation MJRefreshAutoNormalFooter +#pragma mark - 懒加载子控件 +- (UIActivityIndicatorView *)loadingView +{ + if (!_loadingView) { + UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; + loadingView.hidesWhenStopped = YES; + [self addSubview:_loadingView = loadingView]; + } + return _loadingView; +} + +- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle +{ + _activityIndicatorViewStyle = activityIndicatorViewStyle; + + self.loadingView = nil; + [self setNeedsLayout]; +} +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.loadingView.constraints.count) return; + + // 圈圈 + CGFloat loadingCenterX = self.mj_w * 0.5; + if (!self.isRefreshingTitleHidden) { + loadingCenterX -= self.stateLabel.mj_textWith * 0.5 + self.labelLeftInset; + } + CGFloat loadingCenterY = self.mj_h * 0.5; + self.loadingView.center = CGPointMake(loadingCenterX, loadingCenterY); +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) { + [self.loadingView stopAnimating]; + } else if (state == MJRefreshStateRefreshing) { + [self.loadingView startAnimating]; + } +} + +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h new file mode 100755 index 0000000..9fe7915 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h @@ -0,0 +1,22 @@ +// +// MJRefreshAutoStateFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/6/13. +// Copyright © 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoFooter.h" + +@interface MJRefreshAutoStateFooter : MJRefreshAutoFooter +/** 文字距离圈圈、箭头的距离 */ +@property (assign, nonatomic) CGFloat labelLeftInset; +/** 显示刷新状态的label */ +@property (weak, nonatomic, readonly) UILabel *stateLabel; + +/** 设置state状态下的文字 */ +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state; + +/** 隐藏刷新状态的文字 */ +@property (assign, nonatomic, getter=isRefreshingTitleHidden) BOOL refreshingTitleHidden; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m new file mode 100755 index 0000000..d16547d --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m @@ -0,0 +1,92 @@ +// +// MJRefreshAutoStateFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/6/13. +// Copyright © 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshAutoStateFooter.h" + +@interface MJRefreshAutoStateFooter() +{ + /** 显示刷新状态的label */ + __unsafe_unretained UILabel *_stateLabel; +} +/** 所有状态对应的文字 */ +@property (strong, nonatomic) NSMutableDictionary *stateTitles; +@end + +@implementation MJRefreshAutoStateFooter +#pragma mark - 懒加载 +- (NSMutableDictionary *)stateTitles +{ + if (!_stateTitles) { + self.stateTitles = [NSMutableDictionary dictionary]; + } + return _stateTitles; +} + +- (UILabel *)stateLabel +{ + if (!_stateLabel) { + [self addSubview:_stateLabel = [UILabel mj_label]]; + } + return _stateLabel; +} + +#pragma mark - 公共方法 +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state +{ + if (title == nil) return; + self.stateTitles[@(state)] = title; + self.stateLabel.text = self.stateTitles[@(self.state)]; +} + +#pragma mark - 私有方法 +- (void)stateLabelClick +{ + if (self.state == MJRefreshStateIdle) { + [self beginRefreshing]; + } +} + +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = MJRefreshLabelLeftInset; + + // 初始化文字 + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterIdleText] forState:MJRefreshStateIdle]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterRefreshingText] forState:MJRefreshStateRefreshing]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterNoMoreDataText] forState:MJRefreshStateNoMoreData]; + + // 监听label + self.stateLabel.userInteractionEnabled = YES; + [self.stateLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stateLabelClick)]]; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.stateLabel.constraints.count) return; + + // 状态标签 + self.stateLabel.frame = self.bounds; +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + if (self.isRefreshingTitleHidden && state == MJRefreshStateRefreshing) { + self.stateLabel.text = nil; + } else { + self.stateLabel.text = self.stateTitles[@(state)]; + } +} +@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h new file mode 100755 index 0000000..b29af86 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h @@ -0,0 +1,17 @@ +// +// MJRefreshBackGifFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackStateFooter.h" + +@interface MJRefreshBackGifFooter : MJRefreshBackStateFooter +@property (weak, nonatomic, readonly) UIImageView *gifView; + +/** 设置state状态下的动画图片images 动画持续时间duration*/ +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m new file mode 100755 index 0000000..fa97c72 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m @@ -0,0 +1,127 @@ +// +// MJRefreshBackGifFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackGifFooter.h" + +@interface MJRefreshBackGifFooter() +{ + __unsafe_unretained UIImageView *_gifView; +} +/** 所有状态对应的动画图片 */ +@property (strong, nonatomic) NSMutableDictionary *stateImages; +/** 所有状态对应的动画时间 */ +@property (strong, nonatomic) NSMutableDictionary *stateDurations; +@end + +@implementation MJRefreshBackGifFooter +#pragma mark - 懒加载 +- (UIImageView *)gifView +{ + if (!_gifView) { + UIImageView *gifView = [[UIImageView alloc] init]; + [self addSubview:_gifView = gifView]; + } + return _gifView; +} + +- (NSMutableDictionary *)stateImages +{ + if (!_stateImages) { + self.stateImages = [NSMutableDictionary dictionary]; + } + return _stateImages; +} + +- (NSMutableDictionary *)stateDurations +{ + if (!_stateDurations) { + self.stateDurations = [NSMutableDictionary dictionary]; + } + return _stateDurations; +} + +#pragma mark - 公共方法 +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state +{ + if (images == nil) return; + + self.stateImages[@(state)] = images; + self.stateDurations[@(state)] = @(duration); + + /* 根据图片设置控件的高度 */ + UIImage *image = [images firstObject]; + if (image.size.height > self.mj_h) { + self.mj_h = image.size.height; + } +} + +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state +{ + [self setImages:images duration:images.count * 0.1 forState:state]; +} + +#pragma mark - 实现父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = 20; +} + +- (void)setPullingPercent:(CGFloat)pullingPercent +{ + [super setPullingPercent:pullingPercent]; + NSArray *images = self.stateImages[@(MJRefreshStateIdle)]; + if (self.state != MJRefreshStateIdle || images.count == 0) return; + [self.gifView stopAnimating]; + NSUInteger index = images.count * pullingPercent; + if (index >= images.count) index = images.count - 1; + self.gifView.image = images[index]; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.gifView.constraints.count) return; + + self.gifView.frame = self.bounds; + if (self.stateLabel.hidden) { + self.gifView.contentMode = UIViewContentModeCenter; + } else { + self.gifView.contentMode = UIViewContentModeRight; + self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWith * 0.5; + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) { + NSArray *images = self.stateImages[@(state)]; + if (images.count == 0) return; + + self.gifView.hidden = NO; + [self.gifView stopAnimating]; + if (images.count == 1) { // 单张图片 + self.gifView.image = [images lastObject]; + } else { // 多张图片 + self.gifView.animationImages = images; + self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; + [self.gifView startAnimating]; + } + } else if (state == MJRefreshStateIdle) { + self.gifView.hidden = NO; + } else if (state == MJRefreshStateNoMoreData) { + self.gifView.hidden = YES; + } +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h new file mode 100755 index 0000000..90e8b77 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h @@ -0,0 +1,15 @@ +// +// MJRefreshBackNormalFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackStateFooter.h" + +@interface MJRefreshBackNormalFooter : MJRefreshBackStateFooter +@property (weak, nonatomic, readonly) UIImageView *arrowView; +/** 菊花的样式 */ +@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m new file mode 100755 index 0000000..30e5ecf --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m @@ -0,0 +1,120 @@ +// +// MJRefreshBackNormalFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackNormalFooter.h" +#import "NSBundle+MJRefresh.h" + +@interface MJRefreshBackNormalFooter() +{ + __unsafe_unretained UIImageView *_arrowView; +} +@property (weak, nonatomic) UIActivityIndicatorView *loadingView; +@end + +@implementation MJRefreshBackNormalFooter +#pragma mark - 懒加载子控件 +- (UIImageView *)arrowView +{ + if (!_arrowView) { + UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]]; + [self addSubview:_arrowView = arrowView]; + } + return _arrowView; +} + + +- (UIActivityIndicatorView *)loadingView +{ + if (!_loadingView) { + UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; + loadingView.hidesWhenStopped = YES; + [self addSubview:_loadingView = loadingView]; + } + return _loadingView; +} + +- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle +{ + _activityIndicatorViewStyle = activityIndicatorViewStyle; + + self.loadingView = nil; + [self setNeedsLayout]; +} +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + // 箭头的中心点 + CGFloat arrowCenterX = self.mj_w * 0.5; + if (!self.stateLabel.hidden) { + arrowCenterX -= self.labelLeftInset + self.stateLabel.mj_textWith * 0.5; + } + CGFloat arrowCenterY = self.mj_h * 0.5; + CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY); + + // 箭头 + if (self.arrowView.constraints.count == 0) { + self.arrowView.mj_size = self.arrowView.image.size; + self.arrowView.center = arrowCenter; + } + + // 圈圈 + if (self.loadingView.constraints.count == 0) { + self.loadingView.center = arrowCenter; + } + + self.arrowView.tintColor = self.stateLabel.textColor; +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStateIdle) { + if (oldState == MJRefreshStateRefreshing) { + self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); + [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ + self.loadingView.alpha = 0.0; + } completion:^(BOOL finished) { + self.loadingView.alpha = 1.0; + [self.loadingView stopAnimating]; + + self.arrowView.hidden = NO; + }]; + } else { + self.arrowView.hidden = NO; + [self.loadingView stopAnimating]; + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); + }]; + } + } else if (state == MJRefreshStatePulling) { + self.arrowView.hidden = NO; + [self.loadingView stopAnimating]; + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + self.arrowView.transform = CGAffineTransformIdentity; + }]; + } else if (state == MJRefreshStateRefreshing) { + self.arrowView.hidden = YES; + [self.loadingView startAnimating]; + } else if (state == MJRefreshStateNoMoreData) { + self.arrowView.hidden = YES; + [self.loadingView stopAnimating]; + } +} + +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h new file mode 100755 index 0000000..99b1483 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h @@ -0,0 +1,21 @@ +// +// MJRefreshBackStateFooter.h +// MJRefreshExample +// +// Created by MJ Lee on 15/6/13. +// Copyright © 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackFooter.h" + +@interface MJRefreshBackStateFooter : MJRefreshBackFooter +/** 文字距离圈圈、箭头的距离 */ +@property (assign, nonatomic) CGFloat labelLeftInset; +/** 显示刷新状态的label */ +@property (weak, nonatomic, readonly) UILabel *stateLabel; +/** 设置state状态下的文字 */ +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state; + +/** 获取state状态下的title */ +- (NSString *)titleForState:(MJRefreshState)state; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m new file mode 100755 index 0000000..cc784d0 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m @@ -0,0 +1,82 @@ +// +// MJRefreshBackStateFooter.m +// MJRefreshExample +// +// Created by MJ Lee on 15/6/13. +// Copyright © 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshBackStateFooter.h" + +@interface MJRefreshBackStateFooter() +{ + /** 显示刷新状态的label */ + __unsafe_unretained UILabel *_stateLabel; +} +/** 所有状态对应的文字 */ +@property (strong, nonatomic) NSMutableDictionary *stateTitles; +@end + +@implementation MJRefreshBackStateFooter +#pragma mark - 懒加载 +- (NSMutableDictionary *)stateTitles +{ + if (!_stateTitles) { + self.stateTitles = [NSMutableDictionary dictionary]; + } + return _stateTitles; +} + +- (UILabel *)stateLabel +{ + if (!_stateLabel) { + [self addSubview:_stateLabel = [UILabel mj_label]]; + } + return _stateLabel; +} + +#pragma mark - 公共方法 +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state +{ + if (title == nil) return; + self.stateTitles[@(state)] = title; + self.stateLabel.text = self.stateTitles[@(self.state)]; +} + +- (NSString *)titleForState:(MJRefreshState)state { + return self.stateTitles[@(state)]; +} + +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = MJRefreshLabelLeftInset; + + // 初始化文字 + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterIdleText] forState:MJRefreshStateIdle]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterPullingText] forState:MJRefreshStatePulling]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterRefreshingText] forState:MJRefreshStateRefreshing]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterNoMoreDataText] forState:MJRefreshStateNoMoreData]; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.stateLabel.constraints.count) return; + + // 状态标签 + self.stateLabel.frame = self.bounds; +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 设置状态文字 + self.stateLabel.text = self.stateTitles[@(state)]; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.h new file mode 100755 index 0000000..ce3ed42 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.h @@ -0,0 +1,17 @@ +// +// MJRefreshGifHeader.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshStateHeader.h" + +@interface MJRefreshGifHeader : MJRefreshStateHeader +@property (weak, nonatomic, readonly) UIImageView *gifView; + +/** 设置state状态下的动画图片images 动画持续时间duration*/ +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state; +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.m new file mode 100755 index 0000000..f8bcc9b --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshGifHeader.m @@ -0,0 +1,133 @@ +// +// MJRefreshGifHeader.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshGifHeader.h" + +@interface MJRefreshGifHeader() +{ + __unsafe_unretained UIImageView *_gifView; +} +/** 所有状态对应的动画图片 */ +@property (strong, nonatomic) NSMutableDictionary *stateImages; +/** 所有状态对应的动画时间 */ +@property (strong, nonatomic) NSMutableDictionary *stateDurations; +@end + +@implementation MJRefreshGifHeader +#pragma mark - 懒加载 +- (UIImageView *)gifView +{ + if (!_gifView) { + UIImageView *gifView = [[UIImageView alloc] init]; + [self addSubview:_gifView = gifView]; + } + return _gifView; +} + +- (NSMutableDictionary *)stateImages +{ + if (!_stateImages) { + self.stateImages = [NSMutableDictionary dictionary]; + } + return _stateImages; +} + +- (NSMutableDictionary *)stateDurations +{ + if (!_stateDurations) { + self.stateDurations = [NSMutableDictionary dictionary]; + } + return _stateDurations; +} + +#pragma mark - 公共方法 +- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state +{ + if (images == nil) return; + + self.stateImages[@(state)] = images; + self.stateDurations[@(state)] = @(duration); + + /* 根据图片设置控件的高度 */ + UIImage *image = [images firstObject]; + if (image.size.height > self.mj_h) { + self.mj_h = image.size.height; + } +} + +- (void)setImages:(NSArray *)images forState:(MJRefreshState)state +{ + [self setImages:images duration:images.count * 0.1 forState:state]; +} + +#pragma mark - 实现父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = 20; +} + +- (void)setPullingPercent:(CGFloat)pullingPercent +{ + [super setPullingPercent:pullingPercent]; + NSArray *images = self.stateImages[@(MJRefreshStateIdle)]; + if (self.state != MJRefreshStateIdle || images.count == 0) return; + // 停止动画 + [self.gifView stopAnimating]; + // 设置当前需要显示的图片 + NSUInteger index = images.count * pullingPercent; + if (index >= images.count) index = images.count - 1; + self.gifView.image = images[index]; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.gifView.constraints.count) return; + + self.gifView.frame = self.bounds; + if (self.stateLabel.hidden && self.lastUpdatedTimeLabel.hidden) { + self.gifView.contentMode = UIViewContentModeCenter; + } else { + self.gifView.contentMode = UIViewContentModeRight; + + CGFloat stateWidth = self.stateLabel.mj_textWith; + CGFloat timeWidth = 0.0; + if (!self.lastUpdatedTimeLabel.hidden) { + timeWidth = self.lastUpdatedTimeLabel.mj_textWith; + } + CGFloat textWidth = MAX(stateWidth, timeWidth); + self.gifView.mj_w = self.mj_w * 0.5 - textWidth * 0.5 - self.labelLeftInset; + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) { + NSArray *images = self.stateImages[@(state)]; + if (images.count == 0) return; + + [self.gifView stopAnimating]; + if (images.count == 1) { // 单张图片 + self.gifView.image = [images lastObject]; + } else { // 多张图片 + self.gifView.animationImages = images; + self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue]; + [self.gifView startAnimating]; + } + } else if (state == MJRefreshStateIdle) { + [self.gifView stopAnimating]; + } +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.h new file mode 100755 index 0000000..547d05e --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.h @@ -0,0 +1,15 @@ +// +// MJRefreshNormalHeader.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshStateHeader.h" + +@interface MJRefreshNormalHeader : MJRefreshStateHeader +@property (weak, nonatomic, readonly) UIImageView *arrowView; +/** 菊花的样式 */ +@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.m new file mode 100755 index 0000000..32d8de7 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshNormalHeader.m @@ -0,0 +1,127 @@ +// +// MJRefreshNormalHeader.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshNormalHeader.h" +#import "NSBundle+MJRefresh.h" + +@interface MJRefreshNormalHeader() +{ + __unsafe_unretained UIImageView *_arrowView; +} +@property (weak, nonatomic) UIActivityIndicatorView *loadingView; +@end + +@implementation MJRefreshNormalHeader +#pragma mark - 懒加载子控件 +- (UIImageView *)arrowView +{ + if (!_arrowView) { + UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]]; + [self addSubview:_arrowView = arrowView]; + } + return _arrowView; +} + +- (UIActivityIndicatorView *)loadingView +{ + if (!_loadingView) { + UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorViewStyle]; + loadingView.hidesWhenStopped = YES; + [self addSubview:_loadingView = loadingView]; + } + return _loadingView; +} + +#pragma mark - 公共方法 +- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle +{ + _activityIndicatorViewStyle = activityIndicatorViewStyle; + + self.loadingView = nil; + [self setNeedsLayout]; +} + +#pragma mark - 重写父类的方法 +- (void)prepare +{ + [super prepare]; + + self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + // 箭头的中心点 + CGFloat arrowCenterX = self.mj_w * 0.5; + if (!self.stateLabel.hidden) { + CGFloat stateWidth = self.stateLabel.mj_textWith; + CGFloat timeWidth = 0.0; + if (!self.lastUpdatedTimeLabel.hidden) { + timeWidth = self.lastUpdatedTimeLabel.mj_textWith; + } + CGFloat textWidth = MAX(stateWidth, timeWidth); + arrowCenterX -= textWidth / 2 + self.labelLeftInset; + } + CGFloat arrowCenterY = self.mj_h * 0.5; + CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY); + + // 箭头 + if (self.arrowView.constraints.count == 0) { + self.arrowView.mj_size = self.arrowView.image.size; + self.arrowView.center = arrowCenter; + } + + // 圈圈 + if (self.loadingView.constraints.count == 0) { + self.loadingView.center = arrowCenter; + } + + self.arrowView.tintColor = self.stateLabel.textColor; +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 根据状态做事情 + if (state == MJRefreshStateIdle) { + if (oldState == MJRefreshStateRefreshing) { + self.arrowView.transform = CGAffineTransformIdentity; + + [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ + self.loadingView.alpha = 0.0; + } completion:^(BOOL finished) { + // 如果执行完动画发现不是idle状态,就直接返回,进入其他状态 + if (self.state != MJRefreshStateIdle) return; + + self.loadingView.alpha = 1.0; + [self.loadingView stopAnimating]; + self.arrowView.hidden = NO; + }]; + } else { + [self.loadingView stopAnimating]; + self.arrowView.hidden = NO; + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + self.arrowView.transform = CGAffineTransformIdentity; + }]; + } + } else if (state == MJRefreshStatePulling) { + [self.loadingView stopAnimating]; + self.arrowView.hidden = NO; + [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ + self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI); + }]; + } else if (state == MJRefreshStateRefreshing) { + self.loadingView.alpha = 1.0; // 防止refreshing -> idle的动画完毕动作没有被执行 + [self.loadingView startAnimating]; + self.arrowView.hidden = YES; + } +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.h b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.h new file mode 100755 index 0000000..1f3dbc4 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.h @@ -0,0 +1,25 @@ +// +// MJRefreshStateHeader.h +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshHeader.h" + +@interface MJRefreshStateHeader : MJRefreshHeader +#pragma mark - 刷新时间相关 +/** 利用这个block来决定显示的更新时间文字 */ +@property (copy, nonatomic) NSString *(^lastUpdatedTimeText)(NSDate *lastUpdatedTime); +/** 显示上一次刷新时间的label */ +@property (weak, nonatomic, readonly) UILabel *lastUpdatedTimeLabel; + +#pragma mark - 状态相关 +/** 文字距离圈圈、箭头的距离 */ +@property (assign, nonatomic) CGFloat labelLeftInset; +/** 显示刷新状态的label */ +@property (weak, nonatomic, readonly) UILabel *stateLabel; +/** 设置state状态下的文字 */ +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.m b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.m new file mode 100755 index 0000000..ca78b52 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/Custom/Header/MJRefreshStateHeader.m @@ -0,0 +1,167 @@ +// +// MJRefreshStateHeader.m +// MJRefreshExample +// +// Created by MJ Lee on 15/4/24. +// Copyright (c) 2015年 小码哥. All rights reserved. +// + +#import "MJRefreshStateHeader.h" + +@interface MJRefreshStateHeader() +{ + /** 显示上一次刷新时间的label */ + __unsafe_unretained UILabel *_lastUpdatedTimeLabel; + /** 显示刷新状态的label */ + __unsafe_unretained UILabel *_stateLabel; +} +/** 所有状态对应的文字 */ +@property (strong, nonatomic) NSMutableDictionary *stateTitles; +@end + +@implementation MJRefreshStateHeader +#pragma mark - 懒加载 +- (NSMutableDictionary *)stateTitles +{ + if (!_stateTitles) { + self.stateTitles = [NSMutableDictionary dictionary]; + } + return _stateTitles; +} + +- (UILabel *)stateLabel +{ + if (!_stateLabel) { + [self addSubview:_stateLabel = [UILabel mj_label]]; + } + return _stateLabel; +} + +- (UILabel *)lastUpdatedTimeLabel +{ + if (!_lastUpdatedTimeLabel) { + [self addSubview:_lastUpdatedTimeLabel = [UILabel mj_label]]; + } + return _lastUpdatedTimeLabel; +} + +#pragma mark - 公共方法 +- (void)setTitle:(NSString *)title forState:(MJRefreshState)state +{ + if (title == nil) return; + self.stateTitles[@(state)] = title; + self.stateLabel.text = self.stateTitles[@(self.state)]; +} + +#pragma mark - 日历获取在9.x之后的系统使用currentCalendar会出异常。在8.0之后使用系统新API。 +- (NSCalendar *)currentCalendar { + if ([NSCalendar respondsToSelector:@selector(calendarWithIdentifier:)]) { + return [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]; + } + return [NSCalendar currentCalendar]; +} + +#pragma mark key的处理 +- (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey +{ + [super setLastUpdatedTimeKey:lastUpdatedTimeKey]; + + // 如果label隐藏了,就不用再处理 + if (self.lastUpdatedTimeLabel.hidden) return; + + NSDate *lastUpdatedTime = [[NSUserDefaults standardUserDefaults] objectForKey:lastUpdatedTimeKey]; + + // 如果有block + if (self.lastUpdatedTimeText) { + self.lastUpdatedTimeLabel.text = self.lastUpdatedTimeText(lastUpdatedTime); + return; + } + + if (lastUpdatedTime) { + // 1.获得年月日 + NSCalendar *calendar = [self currentCalendar]; + NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay |NSCalendarUnitHour |NSCalendarUnitMinute; + NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:lastUpdatedTime]; + NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]]; + + // 2.格式化日期 + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + BOOL isToday = NO; + if ([cmp1 day] == [cmp2 day]) { // 今天 + formatter.dateFormat = @" HH:mm"; + isToday = YES; + } else if ([cmp1 year] == [cmp2 year]) { // 今年 + formatter.dateFormat = @"MM-dd HH:mm"; + } else { + formatter.dateFormat = @"yyyy-MM-dd HH:mm"; + } + NSString *time = [formatter stringFromDate:lastUpdatedTime]; + + // 3.显示日期 + self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@%@", + [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText], + isToday ? [NSBundle mj_localizedStringForKey:MJRefreshHeaderDateTodayText] : @"", + time]; + } else { + self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@", + [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText], + [NSBundle mj_localizedStringForKey:MJRefreshHeaderNoneLastDateText]]; + } +} + +#pragma mark - 覆盖父类的方法 +- (void)prepare +{ + [super prepare]; + + // 初始化间距 + self.labelLeftInset = MJRefreshLabelLeftInset; + + // 初始化文字 + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderIdleText] forState:MJRefreshStateIdle]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderPullingText] forState:MJRefreshStatePulling]; + [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderRefreshingText] forState:MJRefreshStateRefreshing]; +} + +- (void)placeSubviews +{ + [super placeSubviews]; + + if (self.stateLabel.hidden) return; + + BOOL noConstrainsOnStatusLabel = self.stateLabel.constraints.count == 0; + + if (self.lastUpdatedTimeLabel.hidden) { + // 状态 + if (noConstrainsOnStatusLabel) self.stateLabel.frame = self.bounds; + } else { + CGFloat stateLabelH = self.mj_h * 0.5; + // 状态 + if (noConstrainsOnStatusLabel) { + self.stateLabel.mj_x = 0; + self.stateLabel.mj_y = 0; + self.stateLabel.mj_w = self.mj_w; + self.stateLabel.mj_h = stateLabelH; + } + + // 更新时间 + if (self.lastUpdatedTimeLabel.constraints.count == 0) { + self.lastUpdatedTimeLabel.mj_x = 0; + self.lastUpdatedTimeLabel.mj_y = stateLabelH; + self.lastUpdatedTimeLabel.mj_w = self.mj_w; + self.lastUpdatedTimeLabel.mj_h = self.mj_h - self.lastUpdatedTimeLabel.mj_y; + } + } +} + +- (void)setState:(MJRefreshState)state +{ + MJRefreshCheckState + + // 设置状态文字 + self.stateLabel.text = self.stateTitles[@(state)]; + + // 重新设置key(重新显示时间) + self.lastUpdatedTimeKey = self.lastUpdatedTimeKey; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/arrow@2x.png b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/arrow@2x.png old mode 100644 new mode 100755 index a016473..b1078de Binary files a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/arrow@2x.png and b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/arrow@2x.png differ diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings new file mode 100755 index 0000000..a75f6b1 Binary files /dev/null and b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/en.lproj/Localizable.strings differ diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings new file mode 100755 index 0000000..0a36d7e Binary files /dev/null and b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hans.lproj/Localizable.strings differ diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hant.lproj/Localizable.strings b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hant.lproj/Localizable.strings new file mode 100755 index 0000000..7924bba --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.bundle/zh-Hant.lproj/Localizable.strings @@ -0,0 +1,16 @@ +"MJRefreshHeaderIdleText" = "下拉可以刷新"; +"MJRefreshHeaderPullingText" = "鬆開立即刷新"; +"MJRefreshHeaderRefreshingText" = "正在刷新數據中..."; + +"MJRefreshAutoFooterIdleText" = "點擊或上拉加載更多"; +"MJRefreshAutoFooterRefreshingText" = "正在加載更多的數據..."; +"MJRefreshAutoFooterNoMoreDataText" = "已經全部加載完畢"; + +"MJRefreshBackFooterIdleText" = "上拉可以加載更多"; +"MJRefreshBackFooterPullingText" = "鬆開立即加載更多"; +"MJRefreshBackFooterRefreshingText" = "正在加載更多的數據..."; +"MJRefreshBackFooterNoMoreDataText" = "已經全部加載完畢"; + +"MJRefreshHeaderLastTimeText" = "最後更新:"; +"MJRefreshHeaderDateTodayText" = "今天"; +"MJRefreshHeaderNoneLastDateText" = "無記錄"; diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.h b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.h old mode 100644 new mode 100755 index e4ea0c6..196e6ec --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.h +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefresh.h @@ -1,27 +1,14 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 #import "UIScrollView+MJRefresh.h" +#import "UIScrollView+MJExtension.h" +#import "UIView+MJExtension.h" -/** - MJ友情提示: - 1. 添加头部控件的方法 - [self.tableView addHeaderWithTarget:self action:@selector(headerRereshing)]; - 或者 - [self.tableView addHeaderWithCallback:^{ }]; - - 2. 添加尾部控件的方法 - [self.tableView addFooterWithTarget:self action:@selector(footerRereshing)]; - 或者 - [self.tableView addFooterWithCallback:^{ }]; - - 3. 可以在MJRefreshConst.h和MJRefreshConst.m文件中自定义显示的文字内容和文字颜色 - - 4. 本框架兼容iOS6\iOS7,iPhone\iPad横竖屏 - - 5.自动进入刷新状态 - 1> [self.tableView headerBeginRefreshing]; - 2> [self.tableView footerBeginRefreshing]; - - 6.结束刷新 - 1> [self.tableView headerEndRefreshing]; - 2> [self.tableView footerEndRefreshing]; -*/ \ No newline at end of file +#import "MJRefreshNormalHeader.h" +#import "MJRefreshGifHeader.h" + +#import "MJRefreshBackNormalFooter.h" +#import "MJRefreshBackGifFooter.h" +#import "MJRefreshAutoNormalFooter.h" +#import "MJRefreshAutoGifFooter.h" \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.h b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.h deleted file mode 100644 index 625f07d..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// MJRefreshBaseView.h -// MJRefresh -// -// Created by mj on 13-3-4. -// Copyright (c) 2013年 itcast. All rights reserved. - -#import - -@class MJRefreshBaseView; - -#pragma mark - 控件的刷新状态 -typedef enum { - MJRefreshStatePulling = 1, // 松开就可以进行刷新的状态 - MJRefreshStateNormal = 2, // 普通状态 - MJRefreshStateRefreshing = 3, // 正在刷新中的状态 - MJRefreshStateWillRefreshing = 4 -} MJRefreshState; - -#pragma mark - 控件的类型 -typedef enum { - MJRefreshViewTypeHeader = -1, // 头部控件 - MJRefreshViewTypeFooter = 1 // 尾部控件 -} MJRefreshViewType; - -/** - 类的声明 - */ -@interface MJRefreshBaseView : UIView -#pragma mark - 父控件 -@property (nonatomic, weak, readonly) UIScrollView *scrollView; -@property (nonatomic, assign, readonly) UIEdgeInsets scrollViewOriginalInset; - -#pragma mark - 内部的控件 -@property (nonatomic, weak, readonly) UILabel *statusLabel; -@property (nonatomic, weak, readonly) UIImageView *arrowImage; -@property (nonatomic, weak, readonly) UIActivityIndicatorView *activityView; - -#pragma mark - 回调 -/** - * 开始进入刷新状态的监听器 - */ -@property (weak, nonatomic) id beginRefreshingTaget; -/** - * 开始进入刷新状态的监听方法 - */ -@property (assign, nonatomic) SEL beginRefreshingAction; -/** - * 开始进入刷新状态就会调用 - */ -@property (nonatomic, copy) void (^beginRefreshingCallback)(); - -#pragma mark - 刷新相关 -/** - * 是否正在刷新 - */ -@property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; -/** - * 开始刷新 - */ -- (void)beginRefreshing; -/** - * 结束刷新 - */ -- (void)endRefreshing; - -#pragma mark - 交给子类去实现 和 调用 -@property (assign, nonatomic) MJRefreshState state; -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.m b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.m deleted file mode 100644 index ff53c1b..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshBaseView.m +++ /dev/null @@ -1,204 +0,0 @@ -// -// MJRefreshBaseView.m -// MJRefresh -// -// Created by mj on 13-3-4. -// Copyright (c) 2013年 itcast. All rights reserved. -// - -#import "MJRefreshBaseView.h" -#import "MJRefreshConst.h" -#import "UIView+Extension.h" -#import "UIScrollView+Extension.h" -#import - -@interface MJRefreshBaseView() -{ - __weak UILabel *_statusLabel; - __weak UIImageView *_arrowImage; - __weak UIActivityIndicatorView *_activityView; -} -@end - -@implementation MJRefreshBaseView -#pragma mark - 控件初始化 -/** - * 状态标签 - */ -- (UILabel *)statusLabel -{ - if (!_statusLabel) { - UILabel *statusLabel = [[UILabel alloc] init]; - statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; - statusLabel.font = [UIFont boldSystemFontOfSize:13]; - statusLabel.textColor = MJRefreshLabelTextColor; - statusLabel.backgroundColor = [UIColor clearColor]; - statusLabel.textAlignment = NSTextAlignmentCenter; - [self addSubview:_statusLabel = statusLabel]; - } - return _statusLabel; -} - -/** - * 箭头图片 - */ -- (UIImageView *)arrowImage -{ - if (!_arrowImage) { - UIImageView *arrowImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:MJRefreshSrcName(@"arrow.png")]]; - arrowImage.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; - [self addSubview:_arrowImage = arrowImage]; - } - return _arrowImage; -} - -/** - * 状态标签 - */ -- (UIActivityIndicatorView *)activityView -{ - if (!_activityView) { - UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - activityView.bounds = self.arrowImage.bounds; - activityView.autoresizingMask = self.arrowImage.autoresizingMask; - [self addSubview:_activityView = activityView]; - } - return _activityView; -} - -#pragma mark - 初始化方法 -- (instancetype)initWithFrame:(CGRect)frame { - frame.size.height = MJRefreshViewHeight; - if (self = [super initWithFrame:frame]) { - // 1.自己的属性 - self.autoresizingMask = UIViewAutoresizingFlexibleWidth; - self.backgroundColor = [UIColor clearColor]; - - // 2.设置默认状态 - self.state = MJRefreshStateNormal; - } - return self; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - // 1.箭头 - CGFloat arrowX = self.width * 0.5 - 100; - self.arrowImage.center = CGPointMake(arrowX, self.height * 0.5); - - // 2.指示器 - self.activityView.center = self.arrowImage.center; -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - [super willMoveToSuperview:newSuperview]; - - // 旧的父控件 - [self.superview removeObserver:self forKeyPath:MJRefreshContentOffset context:nil]; - - if (newSuperview) { // 新的父控件 - [newSuperview addObserver:self forKeyPath:MJRefreshContentOffset options:NSKeyValueObservingOptionNew context:nil]; - - // 设置宽度 - self.width = newSuperview.width; - // 设置位置 - self.x = 0; - - // 记录UIScrollView - _scrollView = (UIScrollView *)newSuperview; - // 记录UIScrollView最开始的contentInset - _scrollViewOriginalInset = _scrollView.contentInset; - } -} - -#pragma mark - 显示到屏幕上 -- (void)drawRect:(CGRect)rect -{ - if (self.state == MJRefreshStateWillRefreshing) { - self.state = MJRefreshStateRefreshing; - } -} - -#pragma mark - 刷新相关 -#pragma mark 是否正在刷新 -- (BOOL)isRefreshing -{ - return MJRefreshStateRefreshing == self.state; -} - -#pragma mark 开始刷新 -- (void)beginRefreshing -{ - if (self.window) { - self.state = MJRefreshStateRefreshing; - } else { -#warning 不能调用set方法 - _state = MJRefreshStateWillRefreshing; - [super setNeedsDisplay]; - } -} - -#pragma mark 结束刷新 -- (void)endRefreshing -{ - double delayInSeconds = 0.3; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - self.state = MJRefreshStateNormal; - }); -} - -#pragma mark - 设置状态 -- (void)setState:(MJRefreshState)state -{ - // 0.存储当前的contentInset - if (self.state != MJRefreshStateRefreshing) { - _scrollViewOriginalInset = self.scrollView.contentInset; - } - - // 1.一样的就直接返回 - if (self.state == state) return; - - // 2.根据状态执行不同的操作 - switch (state) { - case MJRefreshStateNormal: // 普通状态 - { - // 显示箭头 - self.arrowImage.hidden = NO; - - // 停止转圈圈 - [self.activityView stopAnimating]; - break; - } - - case MJRefreshStatePulling: - break; - - case MJRefreshStateRefreshing: - { - // 开始转圈圈 - [self.activityView startAnimating]; - // 隐藏箭头 - self.arrowImage.hidden = YES; - - // 回调 - if ([self.beginRefreshingTaget respondsToSelector:self.beginRefreshingAction]) { - ((void (*)(id, SEL, id))objc_msgSend)(self.beginRefreshingTaget, self.beginRefreshingAction, self); - } - - if (self.beginRefreshingCallback) { - self.beginRefreshingCallback(); - } - break; - } - default: - break; - } - - // 3.存储状态 - _state = state; -} -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.h b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.h old mode 100644 new mode 100755 index a7f3b1c..4a72021 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.h +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.h @@ -1,38 +1,67 @@ -// -// MJRefreshConst.h -// MJRefresh -// -// Created by mj on 14-1-3. -// Copyright (c) 2014年 itcast. All rights reserved. -// - +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 #import +#import + +// 弱引用 +#define MJWeakSelf __weak typeof(self) weakSelf = self; +// 日志输出 #ifdef DEBUG -#define MJLog(...) NSLog(__VA_ARGS__) +#define MJRefreshLog(...) NSLog(__VA_ARGS__) #else -#define MJLog(...) +#define MJRefreshLog(...) #endif -#define MJColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] +// 过期提醒 +#define MJRefreshDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead) + +// 运行时objc_msgSend +#define MJRefreshMsgSend(...) ((void (*)(void *, SEL, UIView *))objc_msgSend)(__VA_ARGS__) +#define MJRefreshMsgTarget(target) (__bridge void *)(target) + +// RGB颜色 +#define MJRefreshColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] + // 文字颜色 -#define MJRefreshLabelTextColor MJColor(150, 150, 150) +#define MJRefreshLabelTextColor MJRefreshColor(90, 90, 90) + +// 字体大小 +#define MJRefreshLabelFont [UIFont boldSystemFontOfSize:14] + +// 常量 +UIKIT_EXTERN const CGFloat MJRefreshLabelLeftInset; +UIKIT_EXTERN const CGFloat MJRefreshHeaderHeight; +UIKIT_EXTERN const CGFloat MJRefreshFooterHeight; +UIKIT_EXTERN const CGFloat MJRefreshFastAnimationDuration; +UIKIT_EXTERN const CGFloat MJRefreshSlowAnimationDuration; + +UIKIT_EXTERN NSString *const MJRefreshKeyPathContentOffset; +UIKIT_EXTERN NSString *const MJRefreshKeyPathContentSize; +UIKIT_EXTERN NSString *const MJRefreshKeyPathContentInset; +UIKIT_EXTERN NSString *const MJRefreshKeyPathPanState; + +UIKIT_EXTERN NSString *const MJRefreshHeaderLastUpdatedTimeKey; -extern const CGFloat MJRefreshViewHeight; -extern const CGFloat MJRefreshFastAnimationDuration; -extern const CGFloat MJRefreshSlowAnimationDuration; +UIKIT_EXTERN NSString *const MJRefreshHeaderIdleText; +UIKIT_EXTERN NSString *const MJRefreshHeaderPullingText; +UIKIT_EXTERN NSString *const MJRefreshHeaderRefreshingText; -extern NSString *const MJRefreshBundleName; -#define MJRefreshSrcName(file) [MJRefreshBundleName stringByAppendingPathComponent:file] +UIKIT_EXTERN NSString *const MJRefreshAutoFooterIdleText; +UIKIT_EXTERN NSString *const MJRefreshAutoFooterRefreshingText; +UIKIT_EXTERN NSString *const MJRefreshAutoFooterNoMoreDataText; -extern NSString *const MJRefreshFooterPullToRefresh; -extern NSString *const MJRefreshFooterReleaseToRefresh; -extern NSString *const MJRefreshFooterRefreshing; +UIKIT_EXTERN NSString *const MJRefreshBackFooterIdleText; +UIKIT_EXTERN NSString *const MJRefreshBackFooterPullingText; +UIKIT_EXTERN NSString *const MJRefreshBackFooterRefreshingText; +UIKIT_EXTERN NSString *const MJRefreshBackFooterNoMoreDataText; -extern NSString *const MJRefreshHeaderPullToRefresh; -extern NSString *const MJRefreshHeaderReleaseToRefresh; -extern NSString *const MJRefreshHeaderRefreshing; -extern NSString *const MJRefreshHeaderTimeKey; +UIKIT_EXTERN NSString *const MJRefreshHeaderLastTimeText; +UIKIT_EXTERN NSString *const MJRefreshHeaderDateTodayText; +UIKIT_EXTERN NSString *const MJRefreshHeaderNoneLastDateText; -extern NSString *const MJRefreshContentOffset; -extern NSString *const MJRefreshContentSize; \ No newline at end of file +// 状态检查 +#define MJRefreshCheckState \ +MJRefreshState oldState = self.state; \ +if (state == oldState) return; \ +[super setState:state]; diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.m b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.m old mode 100644 new mode 100755 index 8bbf6f2..7c0733e --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.m +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshConst.m @@ -1,27 +1,33 @@ -// -// MJRefreshConst.m -// MJRefresh -// -// Created by mj on 14-1-3. -// Copyright (c) 2014年 itcast. All rights reserved. -// - +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 #import -const CGFloat MJRefreshViewHeight = 64.0; +const CGFloat MJRefreshLabelLeftInset = 25; +const CGFloat MJRefreshHeaderHeight = 54.0; +const CGFloat MJRefreshFooterHeight = 44.0; const CGFloat MJRefreshFastAnimationDuration = 0.25; const CGFloat MJRefreshSlowAnimationDuration = 0.4; -NSString *const MJRefreshBundleName = @"MJRefresh.bundle"; +NSString *const MJRefreshKeyPathContentOffset = @"contentOffset"; +NSString *const MJRefreshKeyPathContentInset = @"contentInset"; +NSString *const MJRefreshKeyPathContentSize = @"contentSize"; +NSString *const MJRefreshKeyPathPanState = @"state"; + +NSString *const MJRefreshHeaderLastUpdatedTimeKey = @"MJRefreshHeaderLastUpdatedTimeKey"; + +NSString *const MJRefreshHeaderIdleText = @"MJRefreshHeaderIdleText"; +NSString *const MJRefreshHeaderPullingText = @"MJRefreshHeaderPullingText"; +NSString *const MJRefreshHeaderRefreshingText = @"MJRefreshHeaderRefreshingText"; -NSString *const MJRefreshFooterPullToRefresh = @"上拉可以加载更多数据"; -NSString *const MJRefreshFooterReleaseToRefresh = @"松开立即加载更多数据"; -NSString *const MJRefreshFooterRefreshing = @"MJ哥正在帮你加载数据..."; +NSString *const MJRefreshAutoFooterIdleText = @"MJRefreshAutoFooterIdleText"; +NSString *const MJRefreshAutoFooterRefreshingText = @"MJRefreshAutoFooterRefreshingText"; +NSString *const MJRefreshAutoFooterNoMoreDataText = @"MJRefreshAutoFooterNoMoreDataText"; -NSString *const MJRefreshHeaderPullToRefresh = @"下拉可以刷新"; -NSString *const MJRefreshHeaderReleaseToRefresh = @"松开立即刷新"; -NSString *const MJRefreshHeaderRefreshing = @"MJ哥正在帮你刷新..."; -NSString *const MJRefreshHeaderTimeKey = @"MJRefreshHeaderView"; +NSString *const MJRefreshBackFooterIdleText = @"MJRefreshBackFooterIdleText"; +NSString *const MJRefreshBackFooterPullingText = @"MJRefreshBackFooterPullingText"; +NSString *const MJRefreshBackFooterRefreshingText = @"MJRefreshBackFooterRefreshingText"; +NSString *const MJRefreshBackFooterNoMoreDataText = @"MJRefreshBackFooterNoMoreDataText"; -NSString *const MJRefreshContentOffset = @"contentOffset"; -NSString *const MJRefreshContentSize = @"contentSize"; \ No newline at end of file +NSString *const MJRefreshHeaderLastTimeText = @"MJRefreshHeaderLastTimeText"; +NSString *const MJRefreshHeaderDateTodayText = @"MJRefreshHeaderDateTodayText"; +NSString *const MJRefreshHeaderNoneLastDateText = @"MJRefreshHeaderNoneLastDateText"; \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.h b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.h deleted file mode 100644 index 0d0b94d..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// MJRefreshTableFooterView.h -// MJRefresh -// -// Created by mj on 13-2-26. -// Copyright (c) 2013年 itcast. All rights reserved. -// 上拉加载更多 - -#import "MJRefreshBaseView.h" - -@interface MJRefreshFooterView : MJRefreshBaseView -+ (instancetype)footer; -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.m b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.m deleted file mode 100644 index 0530d44..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshFooterView.m +++ /dev/null @@ -1,225 +0,0 @@ -// -// MJRefreshFooterView.m -// MJRefresh -// -// Created by mj on 13-2-26. -// Copyright (c) 2013年 itcast. All rights reserved. -// 上拉加载更多 - -#import "MJRefreshFooterView.h" -#import "MJRefreshConst.h" -#import "UIView+Extension.h" -#import "UIScrollView+Extension.h" - -@interface MJRefreshFooterView() -@property (assign, nonatomic) int lastRefreshCount; -@end - -@implementation MJRefreshFooterView - -+ (instancetype)footer -{ - return [[MJRefreshFooterView alloc] init]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - self.statusLabel.frame = self.bounds; -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - [super willMoveToSuperview:newSuperview]; - - // 旧的父控件 - [self.superview removeObserver:self forKeyPath:MJRefreshContentSize context:nil]; - - if (newSuperview) { // 新的父控件 - // 监听 - [newSuperview addObserver:self forKeyPath:MJRefreshContentSize options:NSKeyValueObservingOptionNew context:nil]; - - // 重新调整frame - [self adjustFrameWithContentSize]; - } -} - -#pragma mark 重写调整frame -- (void)adjustFrameWithContentSize -{ - // 内容的高度 - CGFloat contentHeight = self.scrollView.contentSizeHeight; - // 表格的高度 - CGFloat scrollHeight = self.scrollView.height - self.scrollViewOriginalInset.top - self.scrollViewOriginalInset.bottom; - // 设置位置和尺寸 - self.y = MAX(contentHeight, scrollHeight); -} - -#pragma mark 监听UIScrollView的属性 -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - // 不能跟用户交互,直接返回 - if (!self.userInteractionEnabled || self.alpha <= 0.01 || self.hidden) return; - - if ([MJRefreshContentSize isEqualToString:keyPath]) { - // 调整frame - [self adjustFrameWithContentSize]; - } else if ([MJRefreshContentOffset isEqualToString:keyPath]) { -#warning 这个返回一定要放这个位置 - // 如果正在刷新,直接返回 - if (self.state == MJRefreshStateRefreshing) return; - - // 调整状态 - [self adjustStateWithContentOffset]; - } -} - -/** - * 调整状态 - */ -- (void)adjustStateWithContentOffset -{ - // 当前的contentOffset - CGFloat currentOffsetY = self.scrollView.contentOffsetY; - // 尾部控件刚好出现的offsetY - CGFloat happenOffsetY = [self happenOffsetY]; - - // 如果是向下滚动到看不见尾部控件,直接返回 - if (currentOffsetY <= happenOffsetY) return; - - if (self.scrollView.isDragging) { - // 普通 和 即将刷新 的临界点 - CGFloat normal2pullingOffsetY = happenOffsetY + self.height; - - if (self.state == MJRefreshStateNormal && currentOffsetY > normal2pullingOffsetY) { - // 转为即将刷新状态 - self.state = MJRefreshStatePulling; - } else if (self.state == MJRefreshStatePulling && currentOffsetY <= normal2pullingOffsetY) { - // 转为普通状态 - self.state = MJRefreshStateNormal; - } - } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 - // 开始刷新 - self.state = MJRefreshStateRefreshing; - } -} - -#pragma mark - 状态相关 -#pragma mark 设置状态 -- (void)setState:(MJRefreshState)state -{ - // 1.一样的就直接返回 - if (self.state == state) return; - - // 2.保存旧状态 - MJRefreshState oldState = self.state; - - // 3.调用父类方法 - [super setState:state]; - - // 4.根据状态来设置属性 - switch (state) - { - case MJRefreshStateNormal: - { - // 设置文字 - self.statusLabel.text = MJRefreshFooterPullToRefresh; - - // 刷新完毕 - if (MJRefreshStateRefreshing == oldState) { - self.arrowImage.transform = CGAffineTransformMakeRotation(M_PI); - [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ - self.scrollView.contentInsetBottom = self.scrollViewOriginalInset.bottom; - }]; - } else { - // 执行动画 - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - self.arrowImage.transform = CGAffineTransformMakeRotation(M_PI); - }]; - } - - CGFloat deltaH = [self heightForContentBreakView]; - int currentCount = [self totalDataCountInScrollView]; - // 刚刷新完毕 - if (MJRefreshStateRefreshing == oldState && deltaH > 0 && currentCount != self.lastRefreshCount) { - self.scrollView.contentOffsetY = self.scrollView.contentOffsetY; - } - break; - } - - case MJRefreshStatePulling: - { - // 设置文字 - self.statusLabel.text = MJRefreshFooterReleaseToRefresh; - - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - self.arrowImage.transform = CGAffineTransformIdentity; - }]; - break; - } - - case MJRefreshStateRefreshing: - { - // 设置文字 - self.statusLabel.text = MJRefreshFooterRefreshing; - - // 记录刷新前的数量 - self.lastRefreshCount = [self totalDataCountInScrollView]; - - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - CGFloat bottom = self.height + self.scrollViewOriginalInset.bottom; - CGFloat deltaH = [self heightForContentBreakView]; - if (deltaH < 0) { // 如果内容高度小于view的高度 - bottom -= deltaH; - } - self.scrollView.contentInsetBottom = bottom; - }]; - break; - } - - default: - break; - } -} - -- (int)totalDataCountInScrollView -{ - int totalCount = 0; - if ([self.scrollView isKindOfClass:[UITableView class]]) { - UITableView *tableView = (UITableView *)self.scrollView; - - for (int section = 0; section 0) { - return deltaH - self.scrollViewOriginalInset.top; - } else { - return - self.scrollViewOriginalInset.top; - } -} -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.h b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.h deleted file mode 100644 index c5bc3ee..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// MJRefreshHeaderView.h -// MJRefresh -// -// Created by mj on 13-2-26. -// Copyright (c) 2013年 itcast. All rights reserved. -// 下拉刷新 - -#import "MJRefreshBaseView.h" - -@interface MJRefreshHeaderView : MJRefreshBaseView -+ (instancetype)header; -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.m b/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.m deleted file mode 100644 index 7c51cdb..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/MJRefreshHeaderView.m +++ /dev/null @@ -1,228 +0,0 @@ -// -// MJRefreshHeaderView.m -// MJRefresh -// -// Created by mj on 13-2-26. -// Copyright (c) 2013年 itcast. All rights reserved. -// 下拉刷新 - -#import "MJRefreshConst.h" -#import "MJRefreshHeaderView.h" -#import "UIView+Extension.h" -#import "UIScrollView+Extension.h" - -@interface MJRefreshHeaderView() -// 最后的更新时间 -@property (nonatomic, strong) NSDate *lastUpdateTime; -@property (nonatomic, weak) UILabel *lastUpdateTimeLabel; -@end - -@implementation MJRefreshHeaderView -#pragma mark - 控件初始化 -/** - * 时间标签 - */ -- (UILabel *)lastUpdateTimeLabel -{ - if (!_lastUpdateTimeLabel) { - // 1.创建控件 - UILabel *lastUpdateTimeLabel = [[UILabel alloc] init]; - lastUpdateTimeLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; - lastUpdateTimeLabel.font = [UIFont boldSystemFontOfSize:12]; - lastUpdateTimeLabel.textColor = MJRefreshLabelTextColor; - lastUpdateTimeLabel.backgroundColor = [UIColor clearColor]; - lastUpdateTimeLabel.textAlignment = NSTextAlignmentCenter; - [self addSubview:_lastUpdateTimeLabel = lastUpdateTimeLabel]; - - // 2.加载时间 - self.lastUpdateTime = [[NSUserDefaults standardUserDefaults] objectForKey:MJRefreshHeaderTimeKey]; - } - return _lastUpdateTimeLabel; -} - -+ (instancetype)header -{ - return [[MJRefreshHeaderView alloc] init]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - CGFloat statusX = 0; - CGFloat statusY = 0; - CGFloat statusHeight = self.height * 0.5; - CGFloat statusWidth = self.width; - // 1.状态标签 - self.statusLabel.frame = CGRectMake(statusX, statusY, statusWidth, statusHeight); - - // 2.时间标签 - CGFloat lastUpdateY = statusHeight; - CGFloat lastUpdateX = 0; - CGFloat lastUpdateHeight = statusHeight; - CGFloat lastUpdateWidth = statusWidth; - self.lastUpdateTimeLabel.frame = CGRectMake(lastUpdateX, lastUpdateY, lastUpdateWidth, lastUpdateHeight); -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - [super willMoveToSuperview:newSuperview]; - - // 设置自己的位置和尺寸 - self.y = - self.height; -} - -#pragma mark - 状态相关 -#pragma mark 设置最后的更新时间 -- (void)setLastUpdateTime:(NSDate *)lastUpdateTime -{ - _lastUpdateTime = lastUpdateTime; - - // 1.归档 - [[NSUserDefaults standardUserDefaults] setObject:lastUpdateTime forKey:MJRefreshHeaderTimeKey]; - [[NSUserDefaults standardUserDefaults] synchronize]; - - // 2.更新时间 - [self updateTimeLabel]; -} - -#pragma mark 更新时间字符串 -- (void)updateTimeLabel -{ - if (!self.lastUpdateTime) return; - - // 1.获得年月日 - NSCalendar *calendar = [NSCalendar currentCalendar]; - NSUInteger unitFlags = NSYearCalendarUnit| NSMonthCalendarUnit | NSDayCalendarUnit |NSHourCalendarUnit |NSMinuteCalendarUnit; - NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:_lastUpdateTime]; - NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]]; - - // 2.格式化日期 - NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; - if ([cmp1 day] == [cmp2 day]) { // 今天 - formatter.dateFormat = @"今天 HH:mm"; - } else if ([cmp1 year] == [cmp2 year]) { // 今年 - formatter.dateFormat = @"MM-dd HH:mm"; - } else { - formatter.dateFormat = @"yyyy-MM-dd HH:mm"; - } - NSString *time = [formatter stringFromDate:self.lastUpdateTime]; - - // 3.显示日期 - self.lastUpdateTimeLabel.text = [NSString stringWithFormat:@"最后更新:%@", time]; -} - -#pragma mark - 监听UIScrollView的contentOffset属性 -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - // 不能跟用户交互就直接返回 - if (!self.userInteractionEnabled || self.alpha <= 0.01 || self.hidden) return; - - // 如果正在刷新,直接返回 - if (self.state == MJRefreshStateRefreshing) return; - - if ([MJRefreshContentOffset isEqualToString:keyPath]) { - [self adjustStateWithContentOffset]; - } -} - -/** - * 调整状态 - */ -- (void)adjustStateWithContentOffset -{ - // 当前的contentOffset - CGFloat currentOffsetY = self.scrollView.contentOffsetY; - // 头部控件刚好出现的offsetY - CGFloat happenOffsetY = - self.scrollViewOriginalInset.top; - - // 如果是向上滚动到看不见头部控件,直接返回 - if (currentOffsetY >= happenOffsetY) return; - - if (self.scrollView.isDragging) { - // 普通 和 即将刷新 的临界点 - CGFloat normal2pullingOffsetY = happenOffsetY - self.height; - - if (self.state == MJRefreshStateNormal && currentOffsetY < normal2pullingOffsetY) { - // 转为即将刷新状态 - self.state = MJRefreshStatePulling; - } else if (self.state == MJRefreshStatePulling && currentOffsetY >= normal2pullingOffsetY) { - // 转为普通状态 - self.state = MJRefreshStateNormal; - } - } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开 - // 开始刷新 - self.state = MJRefreshStateRefreshing; - } -} - -#pragma mark 设置状态 -- (void)setState:(MJRefreshState)state -{ - // 1.一样的就直接返回 - if (self.state == state) return; - - // 2.保存旧状态 - MJRefreshState oldState = self.state; - - // 3.调用父类方法 - [super setState:state]; - - // 4.根据状态执行不同的操作 - switch (state) { - case MJRefreshStateNormal: // 下拉可以刷新 - { - // 设置文字 - self.statusLabel.text = MJRefreshHeaderPullToRefresh; - - // 刷新完毕 - if (MJRefreshStateRefreshing == oldState) { - self.arrowImage.transform = CGAffineTransformIdentity; - // 保存刷新时间 - self.lastUpdateTime = [NSDate date]; - - [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{ - self.scrollView.contentInsetTop = self.scrollViewOriginalInset.top; - }]; - } else { - // 执行动画 - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - self.arrowImage.transform = CGAffineTransformIdentity; - }]; - } - break; - } - - case MJRefreshStatePulling: // 松开可立即刷新 - { - // 设置文字 - self.statusLabel.text = MJRefreshHeaderReleaseToRefresh; - // 执行动画 - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - self.arrowImage.transform = CGAffineTransformMakeRotation(M_PI); - }]; - break; - } - - case MJRefreshStateRefreshing: // 正在刷新中 - { - // 设置文字 - self.statusLabel.text = MJRefreshHeaderRefreshing; - - // 执行动画 - [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ - // 1.增加滚动区域 - CGFloat top = self.scrollViewOriginalInset.top + self.height; - self.scrollView.contentInsetTop = top; - - // 2.设置滚动位置 - self.scrollView.contentOffsetY = - top; - }]; - break; - } - - default: - break; - } -} -@end \ No newline at end of file diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.h b/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.h new file mode 100755 index 0000000..01df06c --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.h @@ -0,0 +1,16 @@ +// +// NSBundle+MJRefresh.h +// MJRefreshExample +// +// Created by MJ Lee on 16/6/13. +// Copyright © 2016年 小码哥. All rights reserved. +// + +#import + +@interface NSBundle (MJRefresh) ++ (instancetype)mj_refreshBundle; ++ (UIImage *)mj_arrowImage; ++ (NSString *)mj_localizedStringForKey:(NSString *)key value:(NSString *)value; ++ (NSString *)mj_localizedStringForKey:(NSString *)key; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.m b/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.m new file mode 100755 index 0000000..c155ad4 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/NSBundle+MJRefresh.m @@ -0,0 +1,61 @@ +// +// NSBundle+MJRefresh.m +// MJRefreshExample +// +// Created by MJ Lee on 16/6/13. +// Copyright © 2016年 小码哥. All rights reserved. +// + +#import "NSBundle+MJRefresh.h" +#import "MJRefreshComponent.h" + +@implementation NSBundle (MJRefresh) ++ (instancetype)mj_refreshBundle +{ + static NSBundle *refreshBundle = nil; + if (refreshBundle == nil) { + // 这里不使用mainBundle是为了适配pod 1.x和0.x + refreshBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[MJRefreshComponent class]] pathForResource:@"MJRefresh" ofType:@"bundle"]]; + } + return refreshBundle; +} + ++ (UIImage *)mj_arrowImage +{ + static UIImage *arrowImage = nil; + if (arrowImage == nil) { + arrowImage = [[UIImage imageWithContentsOfFile:[[self mj_refreshBundle] pathForResource:@"arrow@2x" ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + } + return arrowImage; +} + ++ (NSString *)mj_localizedStringForKey:(NSString *)key +{ + return [self mj_localizedStringForKey:key value:nil]; +} + ++ (NSString *)mj_localizedStringForKey:(NSString *)key value:(NSString *)value +{ + static NSBundle *bundle = nil; + if (bundle == nil) { + // (iOS获取的语言字符串比较不稳定)目前框架只处理en、zh-Hans、zh-Hant三种情况,其他按照系统默认处理 + NSString *language = [NSLocale preferredLanguages].firstObject; + if ([language hasPrefix:@"en"]) { + language = @"en"; + } else if ([language hasPrefix:@"zh"]) { + if ([language rangeOfString:@"Hans"].location != NSNotFound) { + language = @"zh-Hans"; // 简体中文 + } else { // zh-Hant\zh-HK\zh-TW + language = @"zh-Hant"; // 繁體中文 + } + } else { + language = @"en"; + } + + // 从MJRefresh.bundle中查找资源 + bundle = [NSBundle bundleWithPath:[[NSBundle mj_refreshBundle] pathForResource:language ofType:@"lproj"]]; + } + value = [bundle localizedStringForKey:key value:value table:nil]; + return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.h b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.h deleted file mode 100644 index ee2c63e..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// UIScrollView+Extension.h -// MJRefreshExample -// -// Created by MJ Lee on 14-5-28. -// Copyright (c) 2014年 itcast. All rights reserved. -// - -#import - -@interface UIScrollView (Extension) -@property (assign, nonatomic) CGFloat contentInsetTop; -@property (assign, nonatomic) CGFloat contentInsetBottom; -@property (assign, nonatomic) CGFloat contentInsetLeft; -@property (assign, nonatomic) CGFloat contentInsetRight; - -@property (assign, nonatomic) CGFloat contentOffsetX; -@property (assign, nonatomic) CGFloat contentOffsetY; - -@property (assign, nonatomic) CGFloat contentSizeWidth; -@property (assign, nonatomic) CGFloat contentSizeHeight; -@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.m b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.m deleted file mode 100644 index 64c67c9..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+Extension.m +++ /dev/null @@ -1,107 +0,0 @@ -// -// UIScrollView+Extension.m -// MJRefreshExample -// -// Created by MJ Lee on 14-5-28. -// Copyright (c) 2014年 itcast. All rights reserved. -// - -#import "UIScrollView+Extension.h" - -@implementation UIScrollView (Extension) -- (void)setContentInsetTop:(CGFloat)contentInsetTop -{ - UIEdgeInsets inset = self.contentInset; - inset.top = contentInsetTop; - self.contentInset = inset; -} - -- (CGFloat)contentInsetTop -{ - return self.contentInset.top; -} - -- (void)setContentInsetBottom:(CGFloat)contentInsetBottom -{ - UIEdgeInsets inset = self.contentInset; - inset.bottom = contentInsetBottom; - self.contentInset = inset; -} - -- (CGFloat)contentInsetBottom -{ - return self.contentInset.bottom; -} - -- (void)setContentInsetLeft:(CGFloat)contentInsetLeft -{ - UIEdgeInsets inset = self.contentInset; - inset.left = contentInsetLeft; - self.contentInset = inset; -} - -- (CGFloat)contentInsetLeft -{ - return self.contentInset.left; -} - -- (void)setContentInsetRight:(CGFloat)contentInsetRight -{ - UIEdgeInsets inset = self.contentInset; - inset.right = contentInsetRight; - self.contentInset = inset; -} - -- (CGFloat)contentInsetRight -{ - return self.contentInset.right; -} - -- (void)setContentOffsetX:(CGFloat)contentOffsetX -{ - CGPoint offset = self.contentOffset; - offset.x = contentOffsetX; - self.contentOffset = offset; -} - -- (CGFloat)contentOffsetX -{ - return self.contentOffset.x; -} - -- (void)setContentOffsetY:(CGFloat)contentOffsetY -{ - CGPoint offset = self.contentOffset; - offset.y = contentOffsetY; - self.contentOffset = offset; -} - -- (CGFloat)contentOffsetY -{ - return self.contentOffset.y; -} - -- (void)setContentSizeWidth:(CGFloat)contentSizeWidth -{ - CGSize size = self.contentSize; - size.width = contentSizeWidth; - self.contentSize = size; -} - -- (CGFloat)contentSizeWidth -{ - return self.contentSize.width; -} - -- (void)setContentSizeHeight:(CGFloat)contentSizeHeight -{ - CGSize size = self.contentSize; - size.height = contentSizeHeight; - self.contentSize = size; -} - -- (CGFloat)contentSizeHeight -{ - return self.contentSize.height; -} -@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.h b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.h new file mode 100755 index 0000000..734110f --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.h @@ -0,0 +1,23 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// UIScrollView+Extension.h +// MJRefreshExample +// +// Created by MJ Lee on 14-5-28. +// Copyright (c) 2014年 小码哥. All rights reserved. +// + +#import + +@interface UIScrollView (MJExtension) +@property (assign, nonatomic) CGFloat mj_insetT; +@property (assign, nonatomic) CGFloat mj_insetB; +@property (assign, nonatomic) CGFloat mj_insetL; +@property (assign, nonatomic) CGFloat mj_insetR; + +@property (assign, nonatomic) CGFloat mj_offsetX; +@property (assign, nonatomic) CGFloat mj_offsetY; + +@property (assign, nonatomic) CGFloat mj_contentW; +@property (assign, nonatomic) CGFloat mj_contentH; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.m b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.m new file mode 100755 index 0000000..6a13f5f --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJExtension.m @@ -0,0 +1,110 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// UIScrollView+Extension.m +// MJRefreshExample +// +// Created by MJ Lee on 14-5-28. +// Copyright (c) 2014年 小码哥. All rights reserved. +// + +#import "UIScrollView+MJExtension.h" +#import + +@implementation UIScrollView (MJExtension) + +- (void)setMj_insetT:(CGFloat)mj_insetT +{ + UIEdgeInsets inset = self.contentInset; + inset.top = mj_insetT; + self.contentInset = inset; +} + +- (CGFloat)mj_insetT +{ + return self.contentInset.top; +} + +- (void)setMj_insetB:(CGFloat)mj_insetB +{ + UIEdgeInsets inset = self.contentInset; + inset.bottom = mj_insetB; + self.contentInset = inset; +} + +- (CGFloat)mj_insetB +{ + return self.contentInset.bottom; +} + +- (void)setMj_insetL:(CGFloat)mj_insetL +{ + UIEdgeInsets inset = self.contentInset; + inset.left = mj_insetL; + self.contentInset = inset; +} + +- (CGFloat)mj_insetL +{ + return self.contentInset.left; +} + +- (void)setMj_insetR:(CGFloat)mj_insetR +{ + UIEdgeInsets inset = self.contentInset; + inset.right = mj_insetR; + self.contentInset = inset; +} + +- (CGFloat)mj_insetR +{ + return self.contentInset.right; +} + +- (void)setMj_offsetX:(CGFloat)mj_offsetX +{ + CGPoint offset = self.contentOffset; + offset.x = mj_offsetX; + self.contentOffset = offset; +} + +- (CGFloat)mj_offsetX +{ + return self.contentOffset.x; +} + +- (void)setMj_offsetY:(CGFloat)mj_offsetY +{ + CGPoint offset = self.contentOffset; + offset.y = mj_offsetY; + self.contentOffset = offset; +} + +- (CGFloat)mj_offsetY +{ + return self.contentOffset.y; +} + +- (void)setMj_contentW:(CGFloat)mj_contentW +{ + CGSize size = self.contentSize; + size.width = mj_contentW; + self.contentSize = size; +} + +- (CGFloat)mj_contentW +{ + return self.contentSize.width; +} + +- (void)setMj_contentH:(CGFloat)mj_contentH +{ + CGSize size = self.contentSize; + size.height = mj_contentH; + self.contentSize = size; +} + +- (CGFloat)mj_contentH +{ + return self.contentSize.height; +} +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.h b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.h old mode 100644 new mode 100755 index 26cb006..17d4715 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.h +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.h @@ -1,83 +1,26 @@ -// +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 // UIScrollView+MJRefresh.h // MJRefreshExample // -// Created by MJ Lee on 14-5-28. -// Copyright (c) 2014年 itcast. All rights reserved. -// +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. +// 给ScrollView增加下拉刷新、上拉刷新的功能 #import +#import "MJRefreshConst.h" -@interface UIScrollView (MJRefresh) -#pragma mark - 下拉刷新 -/** - * 添加一个下拉刷新头部控件 - * - * @param callback 回调 - */ -- (void)addHeaderWithCallback:(void (^)())callback; - -/** - * 添加一个下拉刷新头部控件 - * - * @param target 目标 - * @param action 回调方法 - */ -- (void)addHeaderWithTarget:(id)target action:(SEL)action; - -/** - * 移除下拉刷新头部控件 - */ -- (void)removeHeader; - -/** - * 主动让下拉刷新头部控件进入刷新状态 - */ -- (void)headerBeginRefreshing; - -/** - * 让下拉刷新头部控件停止刷新状态 - */ -- (void)headerEndRefreshing; +@class MJRefreshHeader, MJRefreshFooter; -/** - * 下拉刷新头部控件的可见性 - */ -@property (nonatomic, assign, getter = isHeaderHidden) BOOL headerHidden; - -#pragma mark - 上拉刷新 -/** - * 添加一个上拉刷新尾部控件 - * - * @param callback 回调 - */ -- (void)addFooterWithCallback:(void (^)())callback; - -/** - * 添加一个上拉刷新尾部控件 - * - * @param target 目标 - * @param action 回调方法 - */ -- (void)addFooterWithTarget:(id)target action:(SEL)action; - -/** - * 移除上拉刷新尾部控件 - */ -- (void)removeFooter; - -/** - * 主动让上拉刷新尾部控件进入刷新状态 - */ -- (void)footerBeginRefreshing; - -/** - * 让上拉刷新尾部控件停止刷新状态 - */ -- (void)footerEndRefreshing; - -/** - * 下拉刷新头部控件的可见性 - */ -@property (nonatomic, assign, getter = isFooterHidden) BOOL footerHidden; +@interface UIScrollView (MJRefresh) +/** 下拉刷新控件 */ +@property (strong, nonatomic) MJRefreshHeader *mj_header; +@property (strong, nonatomic) MJRefreshHeader *header MJRefreshDeprecated("使用mj_header"); +/** 上拉刷新控件 */ +@property (strong, nonatomic) MJRefreshFooter *mj_footer; +@property (strong, nonatomic) MJRefreshFooter *footer MJRefreshDeprecated("使用mj_footer"); + +#pragma mark - other +- (NSInteger)mj_totalDataCount; +@property (copy, nonatomic) void (^mj_reloadDataBlock)(NSInteger totalDataCount); @end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.m b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.m old mode 100644 new mode 100755 index 88fa3e9..b1b9942 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.m +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIScrollView+MJRefresh.m @@ -1,203 +1,163 @@ -// +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 // UIScrollView+MJRefresh.m // MJRefreshExample // -// Created by MJ Lee on 14-5-28. -// Copyright (c) 2014年 itcast. All rights reserved. +// Created by MJ Lee on 15/3/4. +// Copyright (c) 2015年 小码哥. All rights reserved. // #import "UIScrollView+MJRefresh.h" -#import "MJRefreshHeaderView.h" -#import "MJRefreshFooterView.h" +#import "MJRefreshHeader.h" +#import "MJRefreshFooter.h" #import -@interface UIScrollView() -@property (weak, nonatomic) MJRefreshHeaderView *header; -@property (weak, nonatomic) MJRefreshFooterView *footer; -@end +@implementation NSObject (MJRefresh) + ++ (void)exchangeInstanceMethod1:(SEL)method1 method2:(SEL)method2 +{ + method_exchangeImplementations(class_getInstanceMethod(self, method1), class_getInstanceMethod(self, method2)); +} ++ (void)exchangeClassMethod1:(SEL)method1 method2:(SEL)method2 +{ + method_exchangeImplementations(class_getClassMethod(self, method1), class_getClassMethod(self, method2)); +} -@implementation UIScrollView (MJRefresh) +@end -#pragma mark - 运行时相关 -static char MJRefreshHeaderViewKey; -static char MJRefreshFooterViewKey; +@implementation UIScrollView (MJRefresh) -- (void)setHeader:(MJRefreshHeaderView *)header { - [self willChangeValueForKey:@"MJRefreshHeaderViewKey"]; - objc_setAssociatedObject(self, &MJRefreshHeaderViewKey, - header, - OBJC_ASSOCIATION_ASSIGN); - [self didChangeValueForKey:@"MJRefreshHeaderViewKey"]; +#pragma mark - header +static const char MJRefreshHeaderKey = '\0'; +- (void)setMj_header:(MJRefreshHeader *)mj_header +{ + if (mj_header != self.mj_header) { + // 删除旧的,添加新的 + [self.mj_header removeFromSuperview]; + [self insertSubview:mj_header atIndex:0]; + + // 存储新的 + [self willChangeValueForKey:@"mj_header"]; // KVO + objc_setAssociatedObject(self, &MJRefreshHeaderKey, + mj_header, OBJC_ASSOCIATION_ASSIGN); + [self didChangeValueForKey:@"mj_header"]; // KVO + } } -- (MJRefreshHeaderView *)header { - return objc_getAssociatedObject(self, &MJRefreshHeaderViewKey); +- (MJRefreshHeader *)mj_header +{ + return objc_getAssociatedObject(self, &MJRefreshHeaderKey); } -- (void)setFooter:(MJRefreshFooterView *)footer { - [self willChangeValueForKey:@"MJRefreshFooterViewKey"]; - objc_setAssociatedObject(self, &MJRefreshFooterViewKey, - footer, - OBJC_ASSOCIATION_ASSIGN); - [self didChangeValueForKey:@"MJRefreshFooterViewKey"]; +#pragma mark - footer +static const char MJRefreshFooterKey = '\0'; +- (void)setMj_footer:(MJRefreshFooter *)mj_footer +{ + if (mj_footer != self.mj_footer) { + // 删除旧的,添加新的 + [self.mj_footer removeFromSuperview]; + [self insertSubview:mj_footer atIndex:0]; + + // 存储新的 + [self willChangeValueForKey:@"mj_footer"]; // KVO + objc_setAssociatedObject(self, &MJRefreshFooterKey, + mj_footer, OBJC_ASSOCIATION_ASSIGN); + [self didChangeValueForKey:@"mj_footer"]; // KVO + } } -- (MJRefreshFooterView *)footer { - return objc_getAssociatedObject(self, &MJRefreshFooterViewKey); +- (MJRefreshFooter *)mj_footer +{ + return objc_getAssociatedObject(self, &MJRefreshFooterKey); } -#pragma mark - 下拉刷新 -/** - * 添加一个下拉刷新头部控件 - * - * @param callback 回调 - */ -- (void)addHeaderWithCallback:(void (^)())callback +#pragma mark - 过期 +- (void)setFooter:(MJRefreshFooter *)footer { - // 1.创建新的header - if (!self.header) { - MJRefreshHeaderView *header = [MJRefreshHeaderView header]; - [self addSubview:header]; - self.header = header; - } - - // 2.设置block回调 - self.header.beginRefreshingCallback = callback; -} - -/** - * 添加一个下拉刷新头部控件 - * - * @param target 目标 - * @param action 回调方法 - */ -- (void)addHeaderWithTarget:(id)target action:(SEL)action -{ - // 1.创建新的header - if (!self.header) { - MJRefreshHeaderView *header = [MJRefreshHeaderView header]; - [self addSubview:header]; - self.header = header; - } - - // 2.设置目标和回调方法 - self.header.beginRefreshingTaget = target; - self.header.beginRefreshingAction = action; + self.mj_footer = footer; } -/** - * 移除下拉刷新头部控件 - */ -- (void)removeHeader +- (MJRefreshFooter *)footer { - [self.header removeFromSuperview]; - self.header = nil; + return self.mj_footer; } -/** - * 主动让下拉刷新头部控件进入刷新状态 - */ -- (void)headerBeginRefreshing +- (void)setHeader:(MJRefreshHeader *)header { - [self.header beginRefreshing]; + self.mj_header = header; } -/** - * 让下拉刷新头部控件停止刷新状态 - */ -- (void)headerEndRefreshing +- (MJRefreshHeader *)header { - [self.header endRefreshing]; + return self.mj_header; } -/** - * 下拉刷新头部控件的可见性 - */ -- (void)setHeaderHidden:(BOOL)hidden +#pragma mark - other +- (NSInteger)mj_totalDataCount { - self.header.hidden = hidden; + NSInteger totalCount = 0; + if ([self isKindOfClass:[UITableView class]]) { + UITableView *tableView = (UITableView *)self; + + for (NSInteger section = 0; section - -@interface UIView (Extension) -@property (assign, nonatomic) CGFloat x; -@property (assign, nonatomic) CGFloat y; -@property (assign, nonatomic) CGFloat width; -@property (assign, nonatomic) CGFloat height; -@property (assign, nonatomic) CGSize size; -@property (assign, nonatomic) CGPoint origin; -@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+Extension.m b/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+Extension.m deleted file mode 100644 index 97d4dc1..0000000 --- a/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+Extension.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// UIView+Extension.m -// MJRefreshExample -// -// Created by MJ Lee on 14-5-28. -// Copyright (c) 2014年 itcast. All rights reserved. -// - -#import "UIView+Extension.h" - -@implementation UIView (Extension) -- (void)setX:(CGFloat)x -{ - CGRect frame = self.frame; - frame.origin.x = x; - self.frame = frame; -} - -- (CGFloat)x -{ - return self.frame.origin.x; -} - -- (void)setY:(CGFloat)y -{ - CGRect frame = self.frame; - frame.origin.y = y; - self.frame = frame; -} - -- (CGFloat)y -{ - return self.frame.origin.y; -} - -- (void)setWidth:(CGFloat)width -{ - CGRect frame = self.frame; - frame.size.width = width; - self.frame = frame; -} - -- (CGFloat)width -{ - return self.frame.size.width; -} - -- (void)setHeight:(CGFloat)height -{ - CGRect frame = self.frame; - frame.size.height = height; - self.frame = frame; -} - -- (CGFloat)height -{ - return self.frame.size.height; -} - -- (void)setSize:(CGSize)size -{ - CGRect frame = self.frame; - frame.size = size; - self.frame = frame; -} - -- (CGSize)size -{ - return self.frame.size; -} - -- (void)setOrigin:(CGPoint)origin -{ - CGRect frame = self.frame; - frame.origin = origin; - self.frame = frame; -} - -- (CGPoint)origin -{ - return self.frame.origin; -} -@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.h b/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.h new file mode 100755 index 0000000..7fde7c1 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.h @@ -0,0 +1,19 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// UIView+Extension.h +// MJRefreshExample +// +// Created by MJ Lee on 14-5-28. +// Copyright (c) 2014年 小码哥. All rights reserved. +// + +#import + +@interface UIView (MJExtension) +@property (assign, nonatomic) CGFloat mj_x; +@property (assign, nonatomic) CGFloat mj_y; +@property (assign, nonatomic) CGFloat mj_w; +@property (assign, nonatomic) CGFloat mj_h; +@property (assign, nonatomic) CGSize mj_size; +@property (assign, nonatomic) CGPoint mj_origin; +@end diff --git a/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.m b/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.m new file mode 100755 index 0000000..7e8eda2 --- /dev/null +++ b/BigShow1949/Classes/Main/Lib/MJRefresh/UIView+MJExtension.m @@ -0,0 +1,84 @@ +// 代码地址: https://github.com/CoderMJLee/MJRefresh +// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 +// UIView+Extension.m +// MJRefreshExample +// +// Created by MJ Lee on 14-5-28. +// Copyright (c) 2014年 小码哥. All rights reserved. +// + +#import "UIView+MJExtension.h" + +@implementation UIView (MJExtension) +- (void)setMj_x:(CGFloat)mj_x +{ + CGRect frame = self.frame; + frame.origin.x = mj_x; + self.frame = frame; +} + +- (CGFloat)mj_x +{ + return self.frame.origin.x; +} + +- (void)setMj_y:(CGFloat)mj_y +{ + CGRect frame = self.frame; + frame.origin.y = mj_y; + self.frame = frame; +} + +- (CGFloat)mj_y +{ + return self.frame.origin.y; +} + +- (void)setMj_w:(CGFloat)mj_w +{ + CGRect frame = self.frame; + frame.size.width = mj_w; + self.frame = frame; +} + +- (CGFloat)mj_w +{ + return self.frame.size.width; +} + +- (void)setMj_h:(CGFloat)mj_h +{ + CGRect frame = self.frame; + frame.size.height = mj_h; + self.frame = frame; +} + +- (CGFloat)mj_h +{ + return self.frame.size.height; +} + +- (void)setMj_size:(CGSize)mj_size +{ + CGRect frame = self.frame; + frame.size = mj_size; + self.frame = frame; +} + +- (CGSize)mj_size +{ + return self.frame.size; +} + +- (void)setMj_origin:(CGPoint)mj_origin +{ + CGRect frame = self.frame; + frame.origin = mj_origin; + self.frame = frame; +} + +- (CGPoint)mj_origin +{ + return self.frame.origin; +} +@end