diff --git a/.LCRefresh.podspec.swo b/.LCRefresh.podspec.swo new file mode 100644 index 0000000..3b7e6f7 Binary files /dev/null and b/.LCRefresh.podspec.swo differ diff --git a/.LCRefresh.podspec.swp b/.LCRefresh.podspec.swp new file mode 100644 index 0000000..279c779 Binary files /dev/null and b/.LCRefresh.podspec.swp differ diff --git a/LCRefresh.podspec b/LCRefresh.podspec index 00bcd8f..063604a 100644 --- a/LCRefresh.podspec +++ b/LCRefresh.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| s.name = 'LCRefresh' - s.version = '0.1.9' + s.version = '0.1.10' s.summary = "A Swift refresh tool used on iOS ." s.description = <<-DESC It is a Swift refresh tool used on iOS . which implement by Swift diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down.png b/LCRefresh/LCRefresh.bundle/lc_refresh_down.png similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down.png rename to LCRefresh/LCRefresh.bundle/lc_refresh_down.png diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png b/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png rename to LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png b/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png rename to LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefresh.swift b/LCRefresh/LCRefresh.swift similarity index 77% rename from LCRefresh/LCRefresh/LCRefresh/LCRefresh.swift rename to LCRefresh/LCRefresh.swift index 62f1ef5..c835717 100644 --- a/LCRefresh/LCRefresh/LCRefresh/LCRefresh.swift +++ b/LCRefresh/LCRefresh.swift @@ -356,123 +356,3 @@ extension UIScrollView{ } - -public final class LCRefreshHeader: UIView { - - public let image = UIImageView() - public let contenLab = UILabel() - public let activity = UIActivityIndicatorView() - - var refreshStatus: LCRefreshHeaderStatus? - var refreshBlock: (()->Void)? - - required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override public init(frame: CGRect) { - super.init(frame: frame) - - configView() - } - - public init(refreshBlock:@escaping (()->Void)) { - super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width: LCRefreshScreenWidth, height: LCRefreshHeaderHeight)) - self.backgroundColor = UIColor.clear - self.refreshBlock = refreshBlock - configView() - - } - - public init(width:CGFloat ,refreshBlock:@escaping (()->Void)) { - super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width:width , height: LCRefreshHeaderHeight)) - self.backgroundColor = UIColor.clear - self.refreshBlock = refreshBlock - configView() - - } - - func configView() { - addSubview(contenLab) - addSubview(image) - addSubview(activity) - - contenLab.frame = self.bounds - contenLab.textAlignment = .center - contenLab.text = "下拉可以刷新" - contenLab.font = UIFont.systemFont(ofSize: 14) - - image.frame = CGRect.init(x: 0, y: 0, width: 18, height: 30) - image.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) - - let bundleImage = UIImage.init(named: "LCRefresh.bundle/lc_refresh_down.png") - if bundleImage != nil { - image.image = bundleImage - }else{ - image.image = UIImage.init(named: "Frameworks/LCRefresh.framework/LCRefresh.bundle/lc_refresh_down.png") - } - - - activity.frame = CGRect.init(x: 0, y: 0, width: 30, height: 30) - activity.activityIndicatorViewStyle = .gray - activity.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) - - } - - func setStatus(_ status:LCRefreshHeaderStatus){ - refreshStatus = status - switch status { - case .normal: - setNomalStatus() - break - case .waitRefresh: - setWaitRefreshStatus() - break - case .refreshing: - setRefreshingStatus() - break - } - } -} - -extension LCRefreshHeader{ - /** 各种状态切换 */ - func setNomalStatus() { - if activity.isAnimating { - activity.stopAnimating() - } - activity.isHidden = true - - contenLab.text = "下拉可以刷新" - image.isHidden = false - - UIView.animate(withDuration: 0.2, animations: { - self.image.transform = CGAffineTransform.identity - }) - } - - func setWaitRefreshStatus() { - if activity.isAnimating { - activity.stopAnimating() - } - activity.isHidden = true - - contenLab.text = "松开立即刷新" - image.isHidden = false - - UIView.animate(withDuration: 0.2, animations: { - self.image.transform = CGAffineTransform(rotationAngle: CGFloat(-M_PI)) - - }) - } - - func setRefreshingStatus() { - activity.isHidden = false - activity.startAnimating() - - contenLab.text = "正在刷新数据..." - image.isHidden = true - } - -} - diff --git a/LCRefresh/LCRefresh.xcodeproj/project.pbxproj b/LCRefresh/LCRefresh.xcodeproj/project.pbxproj deleted file mode 100644 index 8bdb7d2..0000000 --- a/LCRefresh/LCRefresh.xcodeproj/project.pbxproj +++ /dev/null @@ -1,554 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 573C9DC91E0E6ABC00AF0C1D /* LCRefresh.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 573C9DC81E0E6ABC00AF0C1D /* LCRefresh.bundle */; }; - 57816BE51D509051000BF2B3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57816BE41D509051000BF2B3 /* AppDelegate.swift */; }; - 57816BE71D509051000BF2B3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57816BE61D509051000BF2B3 /* ViewController.swift */; }; - 57816BEA1D509051000BF2B3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57816BE81D509051000BF2B3 /* Main.storyboard */; }; - 57816BEC1D509051000BF2B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 57816BEB1D509051000BF2B3 /* Assets.xcassets */; }; - 57816BEF1D509051000BF2B3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57816BED1D509051000BF2B3 /* LaunchScreen.storyboard */; }; - 57816BFA1D509051000BF2B3 /* LCRefreshTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57816BF91D509051000BF2B3 /* LCRefreshTests.swift */; }; - 57816C051D509051000BF2B3 /* LCRefreshUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57816C041D509051000BF2B3 /* LCRefreshUITests.swift */; }; - 57816C181D509EB8000BF2B3 /* LCRefresh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57816C171D509EB8000BF2B3 /* LCRefresh.swift */; }; - 57CBCF8C1D52D79C003F6C06 /* LCRefreshEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57CBCF8B1D52D79C003F6C06 /* LCRefreshEnum.swift */; }; - 57E5C9711D51811700C9F892 /* LCRefreshConst.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E5C9701D51811700C9F892 /* LCRefreshConst.swift */; }; - 57E5C9791D5188BB00C9F892 /* LCRefreshHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E5C9781D5188BB00C9F892 /* LCRefreshHeader.swift */; }; - 57E5C9831D51F63500C9F892 /* LCRefreshFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E5C9821D51F63500C9F892 /* LCRefreshFooter.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 57816BF61D509051000BF2B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 57816BD91D509051000BF2B3 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57816BE01D509051000BF2B3; - remoteInfo = LCRefresh; - }; - 57816C011D509051000BF2B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 57816BD91D509051000BF2B3 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57816BE01D509051000BF2B3; - remoteInfo = LCRefresh; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 573C9DC81E0E6ABC00AF0C1D /* LCRefresh.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = LCRefresh.bundle; sourceTree = ""; }; - 57816BE11D509051000BF2B3 /* LCRefresh.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LCRefresh.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 57816BE41D509051000BF2B3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 57816BE61D509051000BF2B3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 57816BE91D509051000BF2B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 57816BEB1D509051000BF2B3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 57816BEE1D509051000BF2B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 57816BF01D509051000BF2B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 57816BF51D509051000BF2B3 /* LCRefreshTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCRefreshTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 57816BF91D509051000BF2B3 /* LCRefreshTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LCRefreshTests.swift; sourceTree = ""; }; - 57816BFB1D509051000BF2B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 57816C001D509051000BF2B3 /* LCRefreshUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCRefreshUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 57816C041D509051000BF2B3 /* LCRefreshUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LCRefreshUITests.swift; sourceTree = ""; }; - 57816C061D509051000BF2B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 57816C171D509EB8000BF2B3 /* LCRefresh.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefresh.swift; sourceTree = ""; }; - 57CBCF8B1D52D79C003F6C06 /* LCRefreshEnum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshEnum.swift; sourceTree = ""; }; - 57E5C9701D51811700C9F892 /* LCRefreshConst.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshConst.swift; sourceTree = ""; }; - 57E5C9781D5188BB00C9F892 /* LCRefreshHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshHeader.swift; sourceTree = ""; }; - 57E5C9821D51F63500C9F892 /* LCRefreshFooter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshFooter.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 57816BDE1D509051000BF2B3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BF21D509051000BF2B3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BFD1D509051000BF2B3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 57816BD81D509051000BF2B3 = { - isa = PBXGroup; - children = ( - 57816BE31D509051000BF2B3 /* LCRefresh */, - 57816BF81D509051000BF2B3 /* LCRefreshTests */, - 57816C031D509051000BF2B3 /* LCRefreshUITests */, - 57816BE21D509051000BF2B3 /* Products */, - ); - sourceTree = ""; - }; - 57816BE21D509051000BF2B3 /* Products */ = { - isa = PBXGroup; - children = ( - 57816BE11D509051000BF2B3 /* LCRefresh.app */, - 57816BF51D509051000BF2B3 /* LCRefreshTests.xctest */, - 57816C001D509051000BF2B3 /* LCRefreshUITests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 57816BE31D509051000BF2B3 /* LCRefresh */ = { - isa = PBXGroup; - children = ( - 57816C161D509E44000BF2B3 /* LCRefresh */, - 57816BE41D509051000BF2B3 /* AppDelegate.swift */, - 57816BE61D509051000BF2B3 /* ViewController.swift */, - 57816BE81D509051000BF2B3 /* Main.storyboard */, - 57816BEB1D509051000BF2B3 /* Assets.xcassets */, - 57816BED1D509051000BF2B3 /* LaunchScreen.storyboard */, - 57816BF01D509051000BF2B3 /* Info.plist */, - ); - path = LCRefresh; - sourceTree = ""; - }; - 57816BF81D509051000BF2B3 /* LCRefreshTests */ = { - isa = PBXGroup; - children = ( - 57816BF91D509051000BF2B3 /* LCRefreshTests.swift */, - 57816BFB1D509051000BF2B3 /* Info.plist */, - ); - path = LCRefreshTests; - sourceTree = ""; - }; - 57816C031D509051000BF2B3 /* LCRefreshUITests */ = { - isa = PBXGroup; - children = ( - 57816C041D509051000BF2B3 /* LCRefreshUITests.swift */, - 57816C061D509051000BF2B3 /* Info.plist */, - ); - path = LCRefreshUITests; - sourceTree = ""; - }; - 57816C161D509E44000BF2B3 /* LCRefresh */ = { - isa = PBXGroup; - children = ( - 57816C171D509EB8000BF2B3 /* LCRefresh.swift */, - 57CBCF8B1D52D79C003F6C06 /* LCRefreshEnum.swift */, - 57E5C9701D51811700C9F892 /* LCRefreshConst.swift */, - 57E5C9781D5188BB00C9F892 /* LCRefreshHeader.swift */, - 57E5C9821D51F63500C9F892 /* LCRefreshFooter.swift */, - 573C9DC81E0E6ABC00AF0C1D /* LCRefresh.bundle */, - ); - path = LCRefresh; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 57816BE01D509051000BF2B3 /* LCRefresh */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57816C091D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefresh" */; - buildPhases = ( - 57816BDD1D509051000BF2B3 /* Sources */, - 57816BDE1D509051000BF2B3 /* Frameworks */, - 57816BDF1D509051000BF2B3 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = LCRefresh; - productName = LCRefresh; - productReference = 57816BE11D509051000BF2B3 /* LCRefresh.app */; - productType = "com.apple.product-type.application"; - }; - 57816BF41D509051000BF2B3 /* LCRefreshTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57816C0C1D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefreshTests" */; - buildPhases = ( - 57816BF11D509051000BF2B3 /* Sources */, - 57816BF21D509051000BF2B3 /* Frameworks */, - 57816BF31D509051000BF2B3 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 57816BF71D509051000BF2B3 /* PBXTargetDependency */, - ); - name = LCRefreshTests; - productName = LCRefreshTests; - productReference = 57816BF51D509051000BF2B3 /* LCRefreshTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 57816BFF1D509051000BF2B3 /* LCRefreshUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 57816C0F1D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefreshUITests" */; - buildPhases = ( - 57816BFC1D509051000BF2B3 /* Sources */, - 57816BFD1D509051000BF2B3 /* Frameworks */, - 57816BFE1D509051000BF2B3 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 57816C021D509051000BF2B3 /* PBXTargetDependency */, - ); - name = LCRefreshUITests; - productName = LCRefreshUITests; - productReference = 57816C001D509051000BF2B3 /* LCRefreshUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 57816BD91D509051000BF2B3 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0810; - ORGANIZATIONNAME = West; - TargetAttributes = { - 57816BE01D509051000BF2B3 = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0810; - }; - 57816BF41D509051000BF2B3 = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0810; - TestTargetID = 57816BE01D509051000BF2B3; - }; - 57816BFF1D509051000BF2B3 = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0810; - TestTargetID = 57816BE01D509051000BF2B3; - }; - }; - }; - buildConfigurationList = 57816BDC1D509051000BF2B3 /* Build configuration list for PBXProject "LCRefresh" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 57816BD81D509051000BF2B3; - productRefGroup = 57816BE21D509051000BF2B3 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 57816BE01D509051000BF2B3 /* LCRefresh */, - 57816BF41D509051000BF2B3 /* LCRefreshTests */, - 57816BFF1D509051000BF2B3 /* LCRefreshUITests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 57816BDF1D509051000BF2B3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57816BEF1D509051000BF2B3 /* LaunchScreen.storyboard in Resources */, - 573C9DC91E0E6ABC00AF0C1D /* LCRefresh.bundle in Resources */, - 57816BEC1D509051000BF2B3 /* Assets.xcassets in Resources */, - 57816BEA1D509051000BF2B3 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BF31D509051000BF2B3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BFE1D509051000BF2B3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 57816BDD1D509051000BF2B3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57816C181D509EB8000BF2B3 /* LCRefresh.swift in Sources */, - 57E5C9711D51811700C9F892 /* LCRefreshConst.swift in Sources */, - 57816BE71D509051000BF2B3 /* ViewController.swift in Sources */, - 57816BE51D509051000BF2B3 /* AppDelegate.swift in Sources */, - 57E5C9791D5188BB00C9F892 /* LCRefreshHeader.swift in Sources */, - 57CBCF8C1D52D79C003F6C06 /* LCRefreshEnum.swift in Sources */, - 57E5C9831D51F63500C9F892 /* LCRefreshFooter.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BF11D509051000BF2B3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57816BFA1D509051000BF2B3 /* LCRefreshTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 57816BFC1D509051000BF2B3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 57816C051D509051000BF2B3 /* LCRefreshUITests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 57816BF71D509051000BF2B3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 57816BE01D509051000BF2B3 /* LCRefresh */; - targetProxy = 57816BF61D509051000BF2B3 /* PBXContainerItemProxy */; - }; - 57816C021D509051000BF2B3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 57816BE01D509051000BF2B3 /* LCRefresh */; - targetProxy = 57816C011D509051000BF2B3 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 57816BE81D509051000BF2B3 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 57816BE91D509051000BF2B3 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 57816BED1D509051000BF2B3 /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 57816BEE1D509051000BF2B3 /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 57816C071D509051000BF2B3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 57816C081D509051000BF2B3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 57816C0A1D509051000BF2B3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = LCRefresh/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefresh; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 57816C0B1D509051000BF2B3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = LCRefresh/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefresh; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; - 57816C0D1D509051000BF2B3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = LCRefreshTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCRefresh.app/LCRefresh"; - }; - name = Debug; - }; - 57816C0E1D509051000BF2B3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = LCRefreshTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCRefresh.app/LCRefresh"; - }; - name = Release; - }; - 57816C101D509051000BF2B3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = LCRefreshUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_TARGET_NAME = LCRefresh; - }; - name = Debug; - }; - 57816C111D509051000BF2B3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = LCRefreshUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_TARGET_NAME = LCRefresh; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 57816BDC1D509051000BF2B3 /* Build configuration list for PBXProject "LCRefresh" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57816C071D509051000BF2B3 /* Debug */, - 57816C081D509051000BF2B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 57816C091D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefresh" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57816C0A1D509051000BF2B3 /* Debug */, - 57816C0B1D509051000BF2B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 57816C0C1D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefreshTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57816C0D1D509051000BF2B3 /* Debug */, - 57816C0E1D509051000BF2B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 57816C0F1D509051000BF2B3 /* Build configuration list for PBXNativeTarget "LCRefreshUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 57816C101D509051000BF2B3 /* Debug */, - 57816C111D509051000BF2B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 57816BD91D509051000BF2B3 /* Project object */; -} diff --git a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate b/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 96c9d7d..0000000 Binary files a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b454..0000000 --- a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefreshHeader.swift b/LCRefresh/LCRefresh/LCRefresh/LCRefreshHeader.swift deleted file mode 100644 index d617476..0000000 --- a/LCRefresh/LCRefresh/LCRefresh/LCRefreshHeader.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// LCRefreshHeader.swift -// LCRefresh -// -// Created by 刘通超 on 16/8/2. -// Copyright © 2016年 West. All rights reserved. -// - -import UIKit - - - - diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefreshConst.swift b/LCRefresh/LCRefreshConst.swift similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefreshConst.swift rename to LCRefresh/LCRefreshConst.swift diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefreshEnum.swift b/LCRefresh/LCRefreshEnum.swift similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefreshEnum.swift rename to LCRefresh/LCRefreshEnum.swift diff --git a/LCRefresh/LCRefresh/LCRefresh/LCRefreshFooter.swift b/LCRefresh/LCRefreshFooter.swift similarity index 100% rename from LCRefresh/LCRefresh/LCRefresh/LCRefreshFooter.swift rename to LCRefresh/LCRefreshFooter.swift diff --git a/LCRefresh/LCRefreshHeader.swift b/LCRefresh/LCRefreshHeader.swift new file mode 100644 index 0000000..9aaabe1 --- /dev/null +++ b/LCRefresh/LCRefreshHeader.swift @@ -0,0 +1,131 @@ +// +// LCRefreshHeader.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/2. +// Copyright © 2016年 West. All rights reserved. +// + +import UIKit + +public final class LCRefreshHeader: UIView { + + public let image = UIImageView() + public let contenLab = UILabel() + public let activity = UIActivityIndicatorView() + + var refreshStatus: LCRefreshHeaderStatus? + var refreshBlock: (()->Void)? + + required public init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override public init(frame: CGRect) { + super.init(frame: frame) + + configView() + } + + public init(refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width: LCRefreshScreenWidth, height: LCRefreshHeaderHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + + } + + public init(width:CGFloat ,refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width:width , height: LCRefreshHeaderHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + + } + + func configView() { + addSubview(contenLab) + addSubview(image) + addSubview(activity) + + contenLab.frame = self.bounds + contenLab.textAlignment = .center + contenLab.text = "下拉可以刷新" + contenLab.font = UIFont.systemFont(ofSize: 14) + + image.frame = CGRect.init(x: 0, y: 0, width: 18, height: 30) + image.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) + + let bundleImage = UIImage.init(named: "LCRefresh.bundle/lc_refresh_down.png") + if bundleImage != nil { + image.image = bundleImage + }else{ + image.image = UIImage.init(named: "Frameworks/LCRefresh.framework/LCRefresh.bundle/lc_refresh_down.png") + } + + + activity.frame = CGRect.init(x: 0, y: 0, width: 30, height: 30) + activity.activityIndicatorViewStyle = .gray + activity.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) + + } + + func setStatus(_ status:LCRefreshHeaderStatus){ + refreshStatus = status + switch status { + case .normal: + setNomalStatus() + break + case .waitRefresh: + setWaitRefreshStatus() + break + case .refreshing: + setRefreshingStatus() + break + } + } +} + +extension LCRefreshHeader{ + /** 各种状态切换 */ + func setNomalStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + + contenLab.text = "下拉可以刷新" + image.isHidden = false + + UIView.animate(withDuration: 0.2, animations: { + self.image.transform = CGAffineTransform.identity + }) + } + + func setWaitRefreshStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + + contenLab.text = "松开立即刷新" + image.isHidden = false + + UIView.animate(withDuration: 0.2, animations: { + self.image.transform = CGAffineTransform(rotationAngle: CGFloat(-M_PI)) + + }) + } + + func setRefreshingStatus() { + activity.isHidden = false + activity.startAnimating() + + contenLab.text = "正在刷新数据..." + image.isHidden = true + } + +} + + + diff --git a/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.pbxproj b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0a35787 --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.pbxproj @@ -0,0 +1,558 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 57658A591E150D5F00218405 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A581E150D5F00218405 /* AppDelegate.swift */; }; + 57658A5B1E150D5F00218405 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A5A1E150D5F00218405 /* ViewController.swift */; }; + 57658A5E1E150D5F00218405 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57658A5C1E150D5F00218405 /* Main.storyboard */; }; + 57658A601E150D5F00218405 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 57658A5F1E150D5F00218405 /* Assets.xcassets */; }; + 57658A631E150D5F00218405 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57658A611E150D5F00218405 /* LaunchScreen.storyboard */; }; + 57658A6E1E150D6000218405 /* LCRefreshDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A6D1E150D6000218405 /* LCRefreshDemoTests.swift */; }; + 57658A791E150D6000218405 /* LCRefreshDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A781E150D6000218405 /* LCRefreshDemoUITests.swift */; }; + 57658A8D1E150E6D00218405 /* LCRefresh.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 57658A871E150E6D00218405 /* LCRefresh.bundle */; }; + 57658A8E1E150E6D00218405 /* LCRefresh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A881E150E6D00218405 /* LCRefresh.swift */; }; + 57658A8F1E150E6D00218405 /* LCRefreshConst.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A891E150E6D00218405 /* LCRefreshConst.swift */; }; + 57658A901E150E6D00218405 /* LCRefreshEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A8A1E150E6D00218405 /* LCRefreshEnum.swift */; }; + 57658A911E150E6D00218405 /* LCRefreshFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A8B1E150E6D00218405 /* LCRefreshFooter.swift */; }; + 57658A921E150E6D00218405 /* LCRefreshHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57658A8C1E150E6D00218405 /* LCRefreshHeader.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 57658A6A1E150D6000218405 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 57658A4D1E150D5F00218405 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 57658A541E150D5F00218405; + remoteInfo = LCRefreshDemo; + }; + 57658A751E150D6000218405 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 57658A4D1E150D5F00218405 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 57658A541E150D5F00218405; + remoteInfo = LCRefreshDemo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 57658A551E150D5F00218405 /* LCRefreshDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LCRefreshDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 57658A581E150D5F00218405 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 57658A5A1E150D5F00218405 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 57658A5D1E150D5F00218405 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 57658A5F1E150D5F00218405 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 57658A621E150D5F00218405 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 57658A641E150D5F00218405 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 57658A691E150D6000218405 /* LCRefreshDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCRefreshDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 57658A6D1E150D6000218405 /* LCRefreshDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LCRefreshDemoTests.swift; sourceTree = ""; }; + 57658A6F1E150D6000218405 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 57658A741E150D6000218405 /* LCRefreshDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LCRefreshDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 57658A781E150D6000218405 /* LCRefreshDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LCRefreshDemoUITests.swift; sourceTree = ""; }; + 57658A7A1E150D6000218405 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 57658A871E150E6D00218405 /* LCRefresh.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = LCRefresh.bundle; sourceTree = ""; }; + 57658A881E150E6D00218405 /* LCRefresh.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefresh.swift; sourceTree = ""; }; + 57658A891E150E6D00218405 /* LCRefreshConst.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshConst.swift; sourceTree = ""; }; + 57658A8A1E150E6D00218405 /* LCRefreshEnum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshEnum.swift; sourceTree = ""; }; + 57658A8B1E150E6D00218405 /* LCRefreshFooter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshFooter.swift; sourceTree = ""; }; + 57658A8C1E150E6D00218405 /* LCRefreshHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LCRefreshHeader.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 57658A521E150D5F00218405 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A661E150D6000218405 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A711E150D6000218405 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 57658A4C1E150D5F00218405 = { + isa = PBXGroup; + children = ( + 57658A571E150D5F00218405 /* LCRefreshDemo */, + 57658A6C1E150D6000218405 /* LCRefreshDemoTests */, + 57658A771E150D6000218405 /* LCRefreshDemoUITests */, + 57658A561E150D5F00218405 /* Products */, + ); + sourceTree = ""; + }; + 57658A561E150D5F00218405 /* Products */ = { + isa = PBXGroup; + children = ( + 57658A551E150D5F00218405 /* LCRefreshDemo.app */, + 57658A691E150D6000218405 /* LCRefreshDemoTests.xctest */, + 57658A741E150D6000218405 /* LCRefreshDemoUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 57658A571E150D5F00218405 /* LCRefreshDemo */ = { + isa = PBXGroup; + children = ( + 57658A861E150E6D00218405 /* LCRefresh */, + 57658A581E150D5F00218405 /* AppDelegate.swift */, + 57658A5A1E150D5F00218405 /* ViewController.swift */, + 57658A5C1E150D5F00218405 /* Main.storyboard */, + 57658A5F1E150D5F00218405 /* Assets.xcassets */, + 57658A611E150D5F00218405 /* LaunchScreen.storyboard */, + 57658A641E150D5F00218405 /* Info.plist */, + ); + path = LCRefreshDemo; + sourceTree = ""; + }; + 57658A6C1E150D6000218405 /* LCRefreshDemoTests */ = { + isa = PBXGroup; + children = ( + 57658A6D1E150D6000218405 /* LCRefreshDemoTests.swift */, + 57658A6F1E150D6000218405 /* Info.plist */, + ); + path = LCRefreshDemoTests; + sourceTree = ""; + }; + 57658A771E150D6000218405 /* LCRefreshDemoUITests */ = { + isa = PBXGroup; + children = ( + 57658A781E150D6000218405 /* LCRefreshDemoUITests.swift */, + 57658A7A1E150D6000218405 /* Info.plist */, + ); + path = LCRefreshDemoUITests; + sourceTree = ""; + }; + 57658A861E150E6D00218405 /* LCRefresh */ = { + isa = PBXGroup; + children = ( + 57658A871E150E6D00218405 /* LCRefresh.bundle */, + 57658A881E150E6D00218405 /* LCRefresh.swift */, + 57658A891E150E6D00218405 /* LCRefreshConst.swift */, + 57658A8A1E150E6D00218405 /* LCRefreshEnum.swift */, + 57658A8B1E150E6D00218405 /* LCRefreshFooter.swift */, + 57658A8C1E150E6D00218405 /* LCRefreshHeader.swift */, + ); + path = LCRefresh; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 57658A541E150D5F00218405 /* LCRefreshDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 57658A7D1E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemo" */; + buildPhases = ( + 57658A511E150D5F00218405 /* Sources */, + 57658A521E150D5F00218405 /* Frameworks */, + 57658A531E150D5F00218405 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LCRefreshDemo; + productName = LCRefreshDemo; + productReference = 57658A551E150D5F00218405 /* LCRefreshDemo.app */; + productType = "com.apple.product-type.application"; + }; + 57658A681E150D6000218405 /* LCRefreshDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 57658A801E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemoTests" */; + buildPhases = ( + 57658A651E150D6000218405 /* Sources */, + 57658A661E150D6000218405 /* Frameworks */, + 57658A671E150D6000218405 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 57658A6B1E150D6000218405 /* PBXTargetDependency */, + ); + name = LCRefreshDemoTests; + productName = LCRefreshDemoTests; + productReference = 57658A691E150D6000218405 /* LCRefreshDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 57658A731E150D6000218405 /* LCRefreshDemoUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 57658A831E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemoUITests" */; + buildPhases = ( + 57658A701E150D6000218405 /* Sources */, + 57658A711E150D6000218405 /* Frameworks */, + 57658A721E150D6000218405 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 57658A761E150D6000218405 /* PBXTargetDependency */, + ); + name = LCRefreshDemoUITests; + productName = LCRefreshDemoUITests; + productReference = 57658A741E150D6000218405 /* LCRefreshDemoUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 57658A4D1E150D5F00218405 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "北京京师乐学教育科技有限公司"; + TargetAttributes = { + 57658A541E150D5F00218405 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + }; + 57658A681E150D6000218405 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + TestTargetID = 57658A541E150D5F00218405; + }; + 57658A731E150D6000218405 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + TestTargetID = 57658A541E150D5F00218405; + }; + }; + }; + buildConfigurationList = 57658A501E150D5F00218405 /* Build configuration list for PBXProject "LCRefreshDemo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 57658A4C1E150D5F00218405; + productRefGroup = 57658A561E150D5F00218405 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 57658A541E150D5F00218405 /* LCRefreshDemo */, + 57658A681E150D6000218405 /* LCRefreshDemoTests */, + 57658A731E150D6000218405 /* LCRefreshDemoUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 57658A531E150D5F00218405 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 57658A631E150D5F00218405 /* LaunchScreen.storyboard in Resources */, + 57658A601E150D5F00218405 /* Assets.xcassets in Resources */, + 57658A8D1E150E6D00218405 /* LCRefresh.bundle in Resources */, + 57658A5E1E150D5F00218405 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A671E150D6000218405 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A721E150D6000218405 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 57658A511E150D5F00218405 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 57658A8F1E150E6D00218405 /* LCRefreshConst.swift in Sources */, + 57658A8E1E150E6D00218405 /* LCRefresh.swift in Sources */, + 57658A901E150E6D00218405 /* LCRefreshEnum.swift in Sources */, + 57658A5B1E150D5F00218405 /* ViewController.swift in Sources */, + 57658A591E150D5F00218405 /* AppDelegate.swift in Sources */, + 57658A911E150E6D00218405 /* LCRefreshFooter.swift in Sources */, + 57658A921E150E6D00218405 /* LCRefreshHeader.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A651E150D6000218405 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 57658A6E1E150D6000218405 /* LCRefreshDemoTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 57658A701E150D6000218405 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 57658A791E150D6000218405 /* LCRefreshDemoUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 57658A6B1E150D6000218405 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 57658A541E150D5F00218405 /* LCRefreshDemo */; + targetProxy = 57658A6A1E150D6000218405 /* PBXContainerItemProxy */; + }; + 57658A761E150D6000218405 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 57658A541E150D5F00218405 /* LCRefreshDemo */; + targetProxy = 57658A751E150D6000218405 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 57658A5C1E150D5F00218405 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 57658A5D1E150D5F00218405 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 57658A611E150D5F00218405 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 57658A621E150D5F00218405 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 57658A7B1E150D6000218405 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 57658A7C1E150D6000218405 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 57658A7E1E150D6000218405 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = LCRefreshDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 57658A7F1E150D6000218405 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = LCRefreshDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 57658A811E150D6000218405 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = LCRefreshDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCRefreshDemo.app/LCRefreshDemo"; + }; + name = Debug; + }; + 57658A821E150D6000218405 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = LCRefreshDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LCRefreshDemo.app/LCRefreshDemo"; + }; + name = Release; + }; + 57658A841E150D6000218405 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = LCRefreshDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = LCRefreshDemo; + }; + name = Debug; + }; + 57658A851E150D6000218405 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + INFOPLIST_FILE = LCRefreshDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = LX.LCRefreshDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = LCRefreshDemo; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 57658A501E150D5F00218405 /* Build configuration list for PBXProject "LCRefreshDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 57658A7B1E150D6000218405 /* Debug */, + 57658A7C1E150D6000218405 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 57658A7D1E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 57658A7E1E150D6000218405 /* Debug */, + 57658A7F1E150D6000218405 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 57658A801E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 57658A811E150D6000218405 /* Debug */, + 57658A821E150D6000218405 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 57658A831E150D6000218405 /* Build configuration list for PBXNativeTarget "LCRefreshDemoUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 57658A841E150D6000218405 /* Debug */, + 57658A851E150D6000218405 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 57658A4D1E150D5F00218405 /* Project object */; +} diff --git a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 68% rename from LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 2e1cfe5..72bf5df 100644 --- a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:LCRefreshDemo.xcodeproj"> diff --git a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcshareddata/LCRefresh.xcscmblueprint b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcshareddata/LCRefreshDemo.xcscmblueprint similarity index 79% rename from LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcshareddata/LCRefresh.xcscmblueprint rename to LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcshareddata/LCRefreshDemo.xcscmblueprint index c296b14..2b0f801 100644 --- a/LCRefresh/LCRefresh.xcodeproj/project.xcworkspace/xcshareddata/LCRefresh.xcscmblueprint +++ b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcshareddata/LCRefreshDemo.xcscmblueprint @@ -4,17 +4,17 @@ }, "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "EF8AAB5D48718313968E67A84B50952F6676DAC9" : 0, - "2025C4BD2C49A4AA43AFEBC7C7C704CDB57808E3" : 0 + "EF8AAB5D48718313968E67A84B50952F6676DAC9" : 9223372036854775807, + "2025C4BD2C49A4AA43AFEBC7C7C704CDB57808E3" : 9223372036854775807 }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "E2032FE2-3C4B-4B1C-AE42-D0CA670DE6A9", + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "B5094EE6-1ACF-4A6B-9FF2-245C5E3B6634", "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { "EF8AAB5D48718313968E67A84B50952F6676DAC9" : "..", "2025C4BD2C49A4AA43AFEBC7C7C704CDB57808E3" : "LCRefresh\/" }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "LCRefresh", + "DVTSourceControlWorkspaceBlueprintNameKey" : "LCRefreshDemo", "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "LCRefresh\/LCRefresh.xcodeproj", + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "LCRefreshDemo\/LCRefreshDemo.xcodeproj", "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ { "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/liutongchao\/LCRefresh.git", diff --git a/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..5960f72 Binary files /dev/null and b/LCRefreshDemo/LCRefreshDemo.xcodeproj/project.xcworkspace/xcuserdata/West.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefresh.xcscheme b/LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefreshDemo.xcscheme similarity index 66% rename from LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefresh.xcscheme rename to LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefreshDemo.xcscheme index 9bf900a..3d21c69 100644 --- a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefresh.xcscheme +++ b/LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/LCRefreshDemo.xcscheme @@ -1,6 +1,6 @@ + BlueprintIdentifier = "57658A541E150D5F00218405" + BuildableName = "LCRefreshDemo.app" + BlueprintName = "LCRefreshDemo" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> @@ -32,30 +32,30 @@ skipped = "NO"> + BlueprintIdentifier = "57658A681E150D6000218405" + BuildableName = "LCRefreshDemoTests.xctest" + BlueprintName = "LCRefreshDemoTests" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> + BlueprintIdentifier = "57658A731E150D6000218405" + BuildableName = "LCRefreshDemoUITests.xctest" + BlueprintName = "LCRefreshDemoUITests" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> + BlueprintIdentifier = "57658A541E150D5F00218405" + BuildableName = "LCRefreshDemo.app" + BlueprintName = "LCRefreshDemo" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> @@ -75,10 +75,10 @@ runnableDebuggingMode = "0"> + BlueprintIdentifier = "57658A541E150D5F00218405" + BuildableName = "LCRefreshDemo.app" + BlueprintName = "LCRefreshDemo" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> @@ -94,10 +94,10 @@ runnableDebuggingMode = "0"> + BlueprintIdentifier = "57658A541E150D5F00218405" + BuildableName = "LCRefreshDemo.app" + BlueprintName = "LCRefreshDemo" + ReferencedContainer = "container:LCRefreshDemo.xcodeproj"> diff --git a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist b/LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist similarity index 77% rename from LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist rename to LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist index ad4ff6a..363abec 100644 --- a/LCRefresh/LCRefresh.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/LCRefreshDemo/LCRefreshDemo.xcodeproj/xcuserdata/West.xcuserdatad/xcschemes/xcschememanagement.plist @@ -4,7 +4,7 @@ SchemeUserState - LCRefresh.xcscheme + LCRefreshDemo.xcscheme orderHint 0 @@ -12,17 +12,17 @@ SuppressBuildableAutocreation - 57816BE01D509051000BF2B3 + 57658A541E150D5F00218405 primary - 57816BF41D509051000BF2B3 + 57658A681E150D6000218405 primary - 57816BFF1D509051000BF2B3 + 57658A731E150D6000218405 primary diff --git a/LCRefresh/LCRefresh/AppDelegate.swift b/LCRefreshDemo/LCRefreshDemo/AppDelegate.swift similarity index 84% rename from LCRefresh/LCRefresh/AppDelegate.swift rename to LCRefreshDemo/LCRefreshDemo/AppDelegate.swift index 839a2e9..afde22c 100644 --- a/LCRefresh/LCRefresh/AppDelegate.swift +++ b/LCRefreshDemo/LCRefreshDemo/AppDelegate.swift @@ -1,9 +1,9 @@ // // AppDelegate.swift -// LCRefresh +// LCRefreshDemo // -// Created by 刘通超 on 16/8/2. -// Copyright © 2016年 West. All rights reserved. +// Created by 刘通超 on 2016/12/29. +// Copyright © 2016年 北京京师乐学教育科技有限公司. All rights reserved. // import UIKit @@ -21,7 +21,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { @@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { diff --git a/LCRefresh/LCRefresh/Assets.xcassets/AppIcon.appiconset/Contents.json b/LCRefreshDemo/LCRefreshDemo/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 77% rename from LCRefresh/LCRefresh/Assets.xcassets/AppIcon.appiconset/Contents.json rename to LCRefreshDemo/LCRefreshDemo/Assets.xcassets/AppIcon.appiconset/Contents.json index b8236c6..118c98f 100644 --- a/LCRefresh/LCRefresh/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/LCRefreshDemo/LCRefreshDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,15 +1,5 @@ { "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, { "idiom" : "iphone", "size" : "29x29", diff --git a/LCRefresh/LCRefresh/Base.lproj/LaunchScreen.storyboard b/LCRefreshDemo/LCRefreshDemo/Base.lproj/LaunchScreen.storyboard similarity index 70% rename from LCRefresh/LCRefresh/Base.lproj/LaunchScreen.storyboard rename to LCRefreshDemo/LCRefreshDemo/Base.lproj/LaunchScreen.storyboard index 2e721e1..fdf3f97 100644 --- a/LCRefresh/LCRefresh/Base.lproj/LaunchScreen.storyboard +++ b/LCRefreshDemo/LCRefreshDemo/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -13,10 +14,9 @@ - + - - + diff --git a/LCRefresh/LCRefresh/Base.lproj/Main.storyboard b/LCRefreshDemo/LCRefreshDemo/Base.lproj/Main.storyboard similarity index 67% rename from LCRefresh/LCRefresh/Base.lproj/Main.storyboard rename to LCRefreshDemo/LCRefreshDemo/Base.lproj/Main.storyboard index 8e194e7..938781c 100644 --- a/LCRefresh/LCRefresh/Base.lproj/Main.storyboard +++ b/LCRefreshDemo/LCRefreshDemo/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -10,56 +10,56 @@ - + - - + + - + - + - + - + - - + + - + - + - - + + - - - - + + + + - + - + - + diff --git a/LCRefresh/LCRefresh/Info.plist b/LCRefreshDemo/LCRefreshDemo/Info.plist similarity index 95% rename from LCRefresh/LCRefresh/Info.plist rename to LCRefreshDemo/LCRefreshDemo/Info.plist index 6905cc6..38e98af 100644 --- a/LCRefresh/LCRefresh/Info.plist +++ b/LCRefreshDemo/LCRefreshDemo/Info.plist @@ -16,8 +16,6 @@ APPL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down.png b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down.png new file mode 100644 index 0000000..c758351 Binary files /dev/null and b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down.png differ diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png new file mode 100644 index 0000000..464a292 Binary files /dev/null and b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@2x.png differ diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png new file mode 100644 index 0000000..1e1465b Binary files /dev/null and b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.bundle/lc_refresh_down@3x.png differ diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.swift b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.swift new file mode 100644 index 0000000..c835717 --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefresh.swift @@ -0,0 +1,358 @@ +// +// LCRefresh.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/2. +// Copyright © 2016年 West. All rights reserved. +// + +import UIKit + +/** 动态绑定属性 **/ +extension UIScrollView{ + /** 是否有观察者 **/ + var isHaveObserver: Bool { + get{ + let key = UnsafeRawPointer.init(bitPattern: "isHaveObserver".hashValue) + let result = objc_getAssociatedObject(self, key) + + guard result != nil else { + return false + } + return result as! Bool + } + set{ + let key = UnsafeRawPointer.init(bitPattern: "isHaveObserver".hashValue) + objc_setAssociatedObject(self, key, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + } + + } + /** 当前刷新 header of footer **/ + var refreshObj: LCRefreshObject { + get{ + let key = UnsafeRawPointer.init(bitPattern: "refreshObj".hashValue) + let result = objc_getAssociatedObject(self, key) + + guard result != nil else { + return .none + } + return result as! LCRefreshObject + } + set{ + let key = UnsafeRawPointer.init(bitPattern: "refreshObj".hashValue) + objc_setAssociatedObject(self, key, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + } + + } + /** 上次刷新对象 **/ + var lastRefreshObj: LCRefreshObject { + get{ + let key = UnsafeRawPointer.init(bitPattern: "lastRefreshObj".hashValue) + let result = objc_getAssociatedObject(self, key) + + guard result != nil else { + return .none + } + return result as! LCRefreshObject + } + set{ + let key = UnsafeRawPointer.init(bitPattern: "lastRefreshObj".hashValue) + objc_setAssociatedObject(self, key, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + } + + } + + /** header **/ + public var refreshHeader: LCRefreshHeader? { + get{ + let key = UnsafeRawPointer.init(bitPattern: "refreshHeader".hashValue) + let result = objc_getAssociatedObject(self, key) as? LCRefreshHeader + return result + } + set{ + let key = UnsafeRawPointer.init(bitPattern: "refreshHeader".hashValue) + objc_setAssociatedObject(self, key, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + + let result = objc_getAssociatedObject(self, key) as? LCRefreshHeader + if result != nil { + self.addSubview(result!) + } + //添加滑动监测 + addOffsetObserver() + weak var weakSelf = self + weakSelf!.panGestureRecognizer.addTarget(weakSelf!, action: #selector(UIScrollView.scrollViewDragging(_:))) + } + + } + /** footer **/ + public var refreshFooter: LCRefreshFooter? { + get{ + let key = UnsafeRawPointer.init(bitPattern: "refreshFooter".hashValue) + let result = objc_getAssociatedObject(self, key) as? LCRefreshFooter + return result + } + set{ + let key = UnsafeRawPointer.init(bitPattern: "refreshFooter".hashValue) + objc_setAssociatedObject(self, key, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) + + let result = objc_getAssociatedObject(self, key) as? LCRefreshFooter + if result != nil { + result!.isHidden = true + self.addSubview(result!) + } + //添加滑动监测 + addOffsetObserver() + weak var weakSelf = self + weakSelf!.panGestureRecognizer.addTarget(weakSelf!, action: #selector(UIScrollView.scrollViewDragging(_:))) + } + + } +} + +extension UIScrollView{ + //MARK: /** Header 相关 */ + /** header 刷新状态 */ + public func isHeaderRefreshing() -> Bool { + guard self.refreshHeader != nil else{ + return false + } + + return self.refreshHeader!.refreshStatus == .refreshing ? true: false + } + + /** header 结束刷新 */ + public func endHeaderRefreshing() { + + guard self.refreshHeader != nil else{ + return + } + weak var weakSelf = self + + //在nav下会产生top偏移 + let insetTop = self.contentInset.top; + if self.lastRefreshObj == .header || self.lastRefreshObj == .none{ + weakSelf!.setContentOffset(CGPoint(x: 0, y: -insetTop), animated: true) + } + self.refreshHeader!.setStatus(.normal) + + lastRefreshObj = .header + } + + func addOffsetObserver() { + if(!self.isHaveObserver){ + weak var weakSelf = self + self.addObserver(weakSelf!, forKeyPath: "contentOffset", options: NSKeyValueObservingOptions.new, context: nil) + isHaveObserver = true; + } + + } +} + +extension UIScrollView{ + //MARK: /** Footer 相关 */ + /** footer 刷新状态 */ + public func isFooterRefreshing() -> Bool { + guard self.refreshFooter != nil else{ + return false + } + + return self.refreshFooter!.refreshStatus == .refreshing ? true: false + } + + /** footer 结束刷新 */ + public func endFooterRefreshing() { + weak var weakSelf = self + guard self.refreshFooter != nil else{ + return + } + let size = weakSelf!.contentSize + weakSelf!.contentSize = CGSize(width: size.width, height: size.height - LCRefreshFooterHeight) + + /** 1、数据没有充满屏幕 + 2、数据已经填充满屏幕 **/ + + if size.height < weakSelf!.bounds.size.height { + weakSelf!.setContentOffset(CGPoint(x: 0, y: 0), animated: true) + }else{ + let offSet = weakSelf!.contentSize.height-weakSelf!.bounds.size.height + weakSelf!.setContentOffset(CGPoint(x: 0, y: offSet), animated: true) + } + self.refreshFooter!.setStatus(LCRefreshFooterStatus.normal) + self.refreshFooter!.isHidden = true + + lastRefreshObj = .footer + } +} + +extension UIScrollView{ + //MARK: /** 数据加载完毕状态 **/ + public func setDataLoadover() { + weak var weakSelf = self + guard self.refreshFooter != nil else{ + return + } + let size = weakSelf!.contentSize + self.refreshFooter!.isHidden = false + self.refreshFooter!.frame = CGRect(x: LCRefreshFooterX, y: size.height, width: LCRefreshScreenWidth, height: LCRefreshFooterHeight) + + weakSelf!.contentSize = CGSize(width: size.width, height: size.height + LCRefreshFooterHeight) + self.refreshFooter!.setStatus(.loadover) + } + + /** 初始化状态 **/ + public func resetDataLoad() { + guard self.refreshFooter != nil else{ + return + } + self.refreshFooter!.isHidden = true + self.refreshFooter!.setStatus(.normal) + } +} + +extension UIScrollView{ + //MARK: 滑动监测 + + open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + if keyPath == "contentOffset" { + let offSet = self.contentOffset.y + let scrollHeight = self.bounds.size.height + let inset = self.contentInset + var currentOffset = offSet + scrollHeight - inset.bottom + let maximumOffset = self.contentSize.height + + /** 数据未充满屏幕的情况 **/ + if maximumOffset < scrollHeight { + currentOffset = offSet + maximumOffset - inset.bottom + } + + if offSet < 0 { + /** 下拉刷新 */ + guard self.refreshHeader != nil else{ + return + } + scrollHeader(offSet) + self.refreshObj = LCRefreshObject.header + + + }else if currentOffset - maximumOffset > 0 { + /** 上拉刷新 */ + + guard self.refreshFooter != nil else{ + return + } + guard self.refreshFooter!.refreshStatus != .loadover else { + return + } + + scrollFooter(currentOffset - maximumOffset) + self.refreshObj = .footer + + }else{ + /** 无刷新对象 */ + self.refreshObj = LCRefreshObject.none + } + + } + } + + func scrollHeader(_ offSet: CGFloat) {//参数为负数 + guard self.refreshHeader != nil else{ + print("Header加载失败") + return + } + guard self.refreshHeader!.refreshStatus != .refreshing else{ + return + } + if offSet < -LCRefreshHeaderHeight { + self.refreshHeader!.setStatus(LCRefreshHeaderStatus.waitRefresh) + }else{ + self.refreshHeader!.setStatus(LCRefreshHeaderStatus.normal) + } + + } + + func scrollFooter(_ offSet: CGFloat) { + weak var weakSelf = self + guard self.refreshFooter != nil else{ + print("Footer加载失败") + return + } + guard self.refreshFooter!.refreshStatus != .refreshing else{ + return + } + + self.refreshFooter!.isHidden = false + self.refreshFooter!.frame = CGRect(x: LCRefreshFooterX, y: weakSelf!.contentSize.height, width: LCRefreshScreenWidth, height: LCRefreshFooterHeight) + + if offSet > LCRefreshFooterHeight { + self.refreshFooter!.setStatus(LCRefreshFooterStatus.waitRefresh) + }else{ + self.refreshFooter!.setStatus(LCRefreshFooterStatus.normal) + } + + } + + /** 拖拽相关 */ + func scrollViewDragging(_ pan: UIPanGestureRecognizer){ + if pan.state == .ended{ + if self.refreshObj == LCRefreshObject.header { + draggHeader() + + }else if self.refreshObj == LCRefreshObject.footer{ + draggFooter() + } + } + } + + func draggHeader(){ + + weak var weakSelf = self + guard self.refreshHeader != nil else{ + print("Header加载失败") + return + } + //在nav下会产生top偏移 + let insetTop = self.contentInset.top; + + if self.refreshHeader!.refreshStatus == LCRefreshHeaderStatus.waitRefresh { + weakSelf!.setContentOffset(CGPoint(x: 0, y: -(LCRefreshHeaderHeight+insetTop)), animated: true) + self.refreshHeader!.setStatus(LCRefreshHeaderStatus.refreshing) + if self.refreshHeader!.refreshBlock != nil { + self.refreshHeader!.refreshBlock!() + } + }else if self.refreshHeader!.refreshStatus == LCRefreshHeaderStatus.refreshing{ + weakSelf!.setContentOffset(CGPoint(x: 0, y: (LCRefreshHeaderHeight+insetTop)), animated: true) + + } + } + + func draggFooter() { + weak var weakSelf = self + guard self.refreshFooter != nil else{ + print("Footer加载失败") + return + } + if self.refreshFooter!.refreshStatus == .waitRefresh { + /** 设置scroll的contentsize 以及滑动offset **/ + let size = weakSelf!.contentSize + weakSelf!.contentSize = CGSize(width: size.width, height: size.height + LCRefreshFooterHeight) + /** 1、数据没有充满屏幕 + 2、数据已经填充满屏幕 + **/ + if size.height < weakSelf!.bounds.size.height { + weakSelf!.setContentOffset(CGPoint(x: 0, y: 0), animated: true) + }else{ + let offSet = weakSelf!.contentSize.height-weakSelf!.bounds.size.height + weakSelf!.setContentOffset(CGPoint(x: 0, y: offSet), animated: true) + } + /** 切换状态 **/ + self.refreshFooter!.setStatus(LCRefreshFooterStatus.refreshing) + + if self.refreshFooter!.refreshBlock != nil { + self.refreshFooter!.refreshBlock!() + } + } + } + +} + diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshConst.swift b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshConst.swift new file mode 100644 index 0000000..bdb26b1 --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshConst.swift @@ -0,0 +1,25 @@ +// +// LCRefreshConst.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/3. +// Copyright © 2016年 West. All rights reserved. +// + +import UIKit + +let LCRefreshScreenWidth: CGFloat = UIScreen.main.bounds.width +let LCRefreshScreenHeight: CGFloat = UIScreen.main.bounds.height + +let LCRefreshHeaderX: CGFloat = 0 +let LCRefreshHeaderY: CGFloat = -50 +let LCRefreshHeaderWidth: CGFloat = 300 +let LCRefreshHeaderHeight: CGFloat = 50 +let LCRefreshHeaderCenter = CGPoint(x: UIScreen.main.bounds.width / 2, y: LCRefreshHeaderHeight / 2) + +let LCRefreshFooterX: CGFloat = 0 +let LCRefreshFooterY: CGFloat = 0 +let LCRefreshFooterWidth: CGFloat = 300 +let LCRefreshFooterHeight: CGFloat = 50 +let LCRefreshFooterCenter = CGPoint(x: UIScreen.main.bounds.width / 2, y: LCRefreshHeaderHeight / 2) + diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshEnum.swift b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshEnum.swift new file mode 100644 index 0000000..4ff53b1 --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshEnum.swift @@ -0,0 +1,33 @@ +// +// LCRefreshEnum.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/4. +// Copyright © 2016年 West. All rights reserved. +// + +import Foundation + +/** Header 刷新状态 */ +enum LCRefreshHeaderStatus { + case + normal, + waitRefresh, + refreshing +} +/** Footer 刷新状态 */ +enum LCRefreshFooterStatus { + case + normal, + waitRefresh, + refreshing, + loadover +} + +/** 当前刷新对象 */ +enum LCRefreshObject { + case none, + header, + footer +} + diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshFooter.swift b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshFooter.swift new file mode 100644 index 0000000..5621d2f --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshFooter.swift @@ -0,0 +1,116 @@ +// +// LCRefreshFooter.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/3. +// Copyright © 2016年 West. All rights reserved. +// + +import UIKit + +public final class LCRefreshFooter: UIView { + + public let contenLab = UILabel() + public let activity = UIActivityIndicatorView() + + var refreshStatus: LCRefreshFooterStatus? + var refreshBlock: (()->Void)? + + required public init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override public init(frame: CGRect) { + super.init(frame: frame) + + configView() + } + + public init(refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshFooterX, y: LCRefreshFooterY, width: LCRefreshScreenWidth, height: LCRefreshFooterHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + } + + public init(width:CGFloat ,refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshFooterX, y: LCRefreshFooterY, width: width, height: LCRefreshFooterHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + } + + func configView() { + addSubview(contenLab) + addSubview(activity) + + contenLab.frame = self.bounds + contenLab.textAlignment = .center + contenLab.text = "上拉加载更多数据" + contenLab.font = UIFont.systemFont(ofSize: 14) + + activity.frame = CGRect.init(x: 0, y: 0, width: 30, height: 30) + activity.activityIndicatorViewStyle = .gray + activity.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) + + } + + + func setStatus(_ status:LCRefreshFooterStatus){ + refreshStatus = status + switch status { + case .normal: + setNomalStatus() + break + case .waitRefresh: + setWaitRefreshStatus() + break + case .refreshing: + setRefreshingStatus() + break + case .loadover: + setLoadoverStatus() + break + } + } + +} + + +extension LCRefreshFooter{ + /** 各种状态切换 */ + func setNomalStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + contenLab.text = "上拉加载更多数据" + } + + func setWaitRefreshStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + + contenLab.text = "松开加载更多数据" + } + + func setRefreshingStatus() { + activity.isHidden = false + activity.startAnimating() + + contenLab.text = "正在加载更多数据..." + } + + func setLoadoverStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + contenLab.text = "全部加载完毕" + } + + +} + diff --git a/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshHeader.swift b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshHeader.swift new file mode 100644 index 0000000..9aaabe1 --- /dev/null +++ b/LCRefreshDemo/LCRefreshDemo/LCRefresh/LCRefreshHeader.swift @@ -0,0 +1,131 @@ +// +// LCRefreshHeader.swift +// LCRefresh +// +// Created by 刘通超 on 16/8/2. +// Copyright © 2016年 West. All rights reserved. +// + +import UIKit + +public final class LCRefreshHeader: UIView { + + public let image = UIImageView() + public let contenLab = UILabel() + public let activity = UIActivityIndicatorView() + + var refreshStatus: LCRefreshHeaderStatus? + var refreshBlock: (()->Void)? + + required public init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override public init(frame: CGRect) { + super.init(frame: frame) + + configView() + } + + public init(refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width: LCRefreshScreenWidth, height: LCRefreshHeaderHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + + } + + public init(width:CGFloat ,refreshBlock:@escaping (()->Void)) { + super.init(frame: CGRect(x: LCRefreshHeaderX, y: LCRefreshHeaderY, width:width , height: LCRefreshHeaderHeight)) + self.backgroundColor = UIColor.clear + self.refreshBlock = refreshBlock + configView() + + } + + func configView() { + addSubview(contenLab) + addSubview(image) + addSubview(activity) + + contenLab.frame = self.bounds + contenLab.textAlignment = .center + contenLab.text = "下拉可以刷新" + contenLab.font = UIFont.systemFont(ofSize: 14) + + image.frame = CGRect.init(x: 0, y: 0, width: 18, height: 30) + image.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) + + let bundleImage = UIImage.init(named: "LCRefresh.bundle/lc_refresh_down.png") + if bundleImage != nil { + image.image = bundleImage + }else{ + image.image = UIImage.init(named: "Frameworks/LCRefresh.framework/LCRefresh.bundle/lc_refresh_down.png") + } + + + activity.frame = CGRect.init(x: 0, y: 0, width: 30, height: 30) + activity.activityIndicatorViewStyle = .gray + activity.center = CGPoint.init(x: 40, y: LCRefreshHeaderHeight/2) + + } + + func setStatus(_ status:LCRefreshHeaderStatus){ + refreshStatus = status + switch status { + case .normal: + setNomalStatus() + break + case .waitRefresh: + setWaitRefreshStatus() + break + case .refreshing: + setRefreshingStatus() + break + } + } +} + +extension LCRefreshHeader{ + /** 各种状态切换 */ + func setNomalStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + + contenLab.text = "下拉可以刷新" + image.isHidden = false + + UIView.animate(withDuration: 0.2, animations: { + self.image.transform = CGAffineTransform.identity + }) + } + + func setWaitRefreshStatus() { + if activity.isAnimating { + activity.stopAnimating() + } + activity.isHidden = true + + contenLab.text = "松开立即刷新" + image.isHidden = false + + UIView.animate(withDuration: 0.2, animations: { + self.image.transform = CGAffineTransform(rotationAngle: CGFloat(-M_PI)) + + }) + } + + func setRefreshingStatus() { + activity.isHidden = false + activity.startAnimating() + + contenLab.text = "正在刷新数据..." + image.isHidden = true + } + +} + + + diff --git a/LCRefresh/LCRefresh/ViewController.swift b/LCRefreshDemo/LCRefreshDemo/ViewController.swift similarity index 93% rename from LCRefresh/LCRefresh/ViewController.swift rename to LCRefreshDemo/LCRefreshDemo/ViewController.swift index 6eab384..40596cf 100644 --- a/LCRefresh/LCRefresh/ViewController.swift +++ b/LCRefreshDemo/LCRefreshDemo/ViewController.swift @@ -1,9 +1,9 @@ // // ViewController.swift -// LCRefresh +// LCRefreshDemo // -// Created by 刘通超 on 16/8/2. -// Copyright © 2016年 West. All rights reserved. +// Created by 刘通超 on 2016/12/29. +// Copyright © 2016年 北京京师乐学教育科技有限公司. All rights reserved. // import UIKit @@ -13,7 +13,7 @@ class ViewController: UIViewController { @IBOutlet weak var table: UITableView! var numRows = 5 var PERSON_ID_NUMBER_PROPERTY = UnsafeRawPointer.init(bitPattern: "Instance".hashValue) - + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. @@ -23,9 +23,9 @@ class ViewController: UIViewController { print("header") weakSelf!.perform(#selector(ViewController.headerRefresh), with: nil, afterDelay: 2) }) - + table.refreshHeader = header - table.refreshFooter = LCRefreshFooter.init(refreshBlock: { + table.refreshFooter = LCRefreshFooter.init(refreshBlock: { print("footer") weakSelf!.perform(#selector(ViewController.footerRefresh), with: nil, afterDelay: 2) }) @@ -33,7 +33,7 @@ class ViewController: UIViewController { table.tableFooterView = UIView.init(frame: CGRect(x: 0, y: 0, width: 300, height: 5)) } - + func headerRefresh() { weak var weakSelf = self @@ -41,7 +41,7 @@ class ViewController: UIViewController { if weakSelf!.table.isHeaderRefreshing() { weakSelf!.table.endHeaderRefreshing() } - + weakSelf!.numRows = 5 weakSelf!.table.reloadData() @@ -50,7 +50,7 @@ class ViewController: UIViewController { func footerRefresh() { weak var weakSelf = self - + if weakSelf!.table.isFooterRefreshing() { weakSelf!.table.endFooterRefreshing() } @@ -61,7 +61,7 @@ class ViewController: UIViewController { weakSelf!.table.setDataLoadover() } } - + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -84,7 +84,7 @@ extension ViewController:UITableViewDataSource{ return cell } - + } extension ViewController:UITableViewDelegate{ diff --git a/LCRefresh/LCRefreshTests/Info.plist b/LCRefreshDemo/LCRefreshDemoTests/Info.plist similarity index 92% rename from LCRefresh/LCRefreshTests/Info.plist rename to LCRefreshDemo/LCRefreshDemoTests/Info.plist index ba72822..6c6c23c 100644 --- a/LCRefresh/LCRefreshTests/Info.plist +++ b/LCRefreshDemo/LCRefreshDemoTests/Info.plist @@ -16,8 +16,6 @@ BNDL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/LCRefresh/LCRefreshTests/LCRefreshTests.swift b/LCRefreshDemo/LCRefreshDemoTests/LCRefreshDemoTests.swift similarity index 75% rename from LCRefresh/LCRefreshTests/LCRefreshTests.swift rename to LCRefreshDemo/LCRefreshDemoTests/LCRefreshDemoTests.swift index 763f606..0f49f26 100644 --- a/LCRefresh/LCRefreshTests/LCRefreshTests.swift +++ b/LCRefreshDemo/LCRefreshDemoTests/LCRefreshDemoTests.swift @@ -1,15 +1,15 @@ // -// LCRefreshTests.swift -// LCRefreshTests +// LCRefreshDemoTests.swift +// LCRefreshDemoTests // -// Created by 刘通超 on 16/8/2. -// Copyright © 2016年 West. All rights reserved. +// Created by 刘通超 on 2016/12/29. +// Copyright © 2016年 北京京师乐学教育科技有限公司. All rights reserved. // import XCTest -@testable import LCRefresh +@testable import LCRefreshDemo -class LCRefreshTests: XCTestCase { +class LCRefreshDemoTests: XCTestCase { override func setUp() { super.setUp() diff --git a/LCRefresh/LCRefreshUITests/Info.plist b/LCRefreshDemo/LCRefreshDemoUITests/Info.plist similarity index 92% rename from LCRefresh/LCRefreshUITests/Info.plist rename to LCRefreshDemo/LCRefreshDemoUITests/Info.plist index ba72822..6c6c23c 100644 --- a/LCRefresh/LCRefreshUITests/Info.plist +++ b/LCRefreshDemo/LCRefreshDemoUITests/Info.plist @@ -16,8 +16,6 @@ BNDL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/LCRefresh/LCRefreshUITests/LCRefreshUITests.swift b/LCRefreshDemo/LCRefreshDemoUITests/LCRefreshDemoUITests.swift similarity index 82% rename from LCRefresh/LCRefreshUITests/LCRefreshUITests.swift rename to LCRefreshDemo/LCRefreshDemoUITests/LCRefreshDemoUITests.swift index 94a39ff..4f3dade 100644 --- a/LCRefresh/LCRefreshUITests/LCRefreshUITests.swift +++ b/LCRefreshDemo/LCRefreshDemoUITests/LCRefreshDemoUITests.swift @@ -1,14 +1,14 @@ // -// LCRefreshUITests.swift -// LCRefreshUITests +// LCRefreshDemoUITests.swift +// LCRefreshDemoUITests // -// Created by 刘通超 on 16/8/2. -// Copyright © 2016年 West. All rights reserved. +// Created by 刘通超 on 2016/12/29. +// Copyright © 2016年 北京京师乐学教育科技有限公司. All rights reserved. // import XCTest -class LCRefreshUITests: XCTestCase { +class LCRefreshDemoUITests: XCTestCase { override func setUp() { super.setUp()