commit 5f4d53604428bec54562f9355916a012268eb619 Author: WenchaoD Date: Fri Feb 10 22:27:00 2017 +0800 First commit. diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.pbxproj b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e682a5d --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.pbxproj @@ -0,0 +1,555 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + F9C6941D1E40C543007084B6 /* FSPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694171E40C543007084B6 /* FSPageControl.swift */; }; + F9C6941E1E40C543007084B6 /* FSPagerCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694181E40C543007084B6 /* FSPagerCollectionView.swift */; }; + F9C6941F1E40C543007084B6 /* FSPagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694191E40C543007084B6 /* FSPagerView.swift */; }; + F9C694201E40C543007084B6 /* FSPagerViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6941A1E40C543007084B6 /* FSPagerViewCell.swift */; }; + F9C694211E40C543007084B6 /* FSPageViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6941B1E40C543007084B6 /* FSPageViewLayout.swift */; }; + F9C694221E40C543007084B6 /* FSPageViewTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6941C1E40C543007084B6 /* FSPageViewTransformer.swift */; }; + F9C6942F1E40C583007084B6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694241E40C583007084B6 /* AppDelegate.swift */; }; + F9C694301E40C583007084B6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F9C694251E40C583007084B6 /* Assets.xcassets */; }; + F9C694311E40C583007084B6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9C694261E40C583007084B6 /* LaunchScreen.storyboard */; }; + F9C694321E40C583007084B6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9C694281E40C583007084B6 /* Main.storyboard */; }; + F9C694331E40C583007084B6 /* BasicExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6942A1E40C583007084B6 /* BasicExampleViewController.swift */; }; + F9C694341E40C583007084B6 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = F9C6942B1E40C583007084B6 /* Info.plist */; }; + F9C694351E40C583007084B6 /* PageControlExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6942C1E40C583007084B6 /* PageControlExampleViewController.swift */; }; + F9C694361E40C583007084B6 /* TransformerExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6942E1E40C583007084B6 /* TransformerExampleViewController.swift */; }; + F9C6945A1E40C720007084B6 /* FSPagerViewExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694591E40C720007084B6 /* FSPagerViewExampleUITests.swift */; }; + F9C694711E40C8DA007084B6 /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694621E40C8DA007084B6 /* 1.jpg */; }; + F9C694721E40C8DA007084B6 /* 1_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694631E40C8DA007084B6 /* 1_1.jpg */; }; + F9C694731E40C8DA007084B6 /* 1_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694641E40C8DA007084B6 /* 1_2.jpg */; }; + F9C694741E40C8DA007084B6 /* 1_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694651E40C8DA007084B6 /* 1_3.jpg */; }; + F9C694751E40C8DA007084B6 /* 1_4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694661E40C8DA007084B6 /* 1_4.jpg */; }; + F9C694761E40C8DA007084B6 /* 1_5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694671E40C8DA007084B6 /* 1_5.jpg */; }; + F9C694771E40C8DA007084B6 /* 1_6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694681E40C8DA007084B6 /* 1_6.jpg */; }; + F9C694781E40C8DA007084B6 /* 1_7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694691E40C8DA007084B6 /* 1_7.jpg */; }; + F9C694791E40C8DA007084B6 /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946A1E40C8DA007084B6 /* 2.jpg */; }; + F9C6947A1E40C8DA007084B6 /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946B1E40C8DA007084B6 /* 3.jpg */; }; + F9C6947B1E40C8DA007084B6 /* 4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946C1E40C8DA007084B6 /* 4.jpg */; }; + F9C6947C1E40C8DA007084B6 /* 5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946D1E40C8DA007084B6 /* 5.jpg */; }; + F9C6947D1E40C8DA007084B6 /* 6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946E1E40C8DA007084B6 /* 6.jpg */; }; + F9C6947E1E40C8DA007084B6 /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C6946F1E40C8DA007084B6 /* 7.jpg */; }; + F9C6947F1E40C8DA007084B6 /* background.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F9C694701E40C8DA007084B6 /* background.jpg */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + F9C6945C1E40C720007084B6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F97C966F1E1FDE25002D9E7E /* Project object */; + proxyType = 1; + remoteGlobalIDString = F97C96761E1FDE25002D9E7E; + remoteInfo = FSPagerViewExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + F97C96771E1FDE25002D9E7E /* FSPagerViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSPagerViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + F9C694171E40C543007084B6 /* FSPageControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageControl.swift; sourceTree = ""; }; + F9C694181E40C543007084B6 /* FSPagerCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerCollectionView.swift; sourceTree = ""; }; + F9C694191E40C543007084B6 /* FSPagerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerView.swift; sourceTree = ""; }; + F9C6941A1E40C543007084B6 /* FSPagerViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerViewCell.swift; sourceTree = ""; }; + F9C6941B1E40C543007084B6 /* FSPageViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageViewLayout.swift; sourceTree = ""; }; + F9C6941C1E40C543007084B6 /* FSPageViewTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageViewTransformer.swift; sourceTree = ""; }; + F9C694241E40C583007084B6 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + F9C694251E40C583007084B6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + F9C694271E40C583007084B6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + F9C694291E40C583007084B6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + F9C6942A1E40C583007084B6 /* BasicExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicExampleViewController.swift; sourceTree = ""; }; + F9C6942B1E40C583007084B6 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F9C6942C1E40C583007084B6 /* PageControlExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageControlExampleViewController.swift; sourceTree = ""; }; + F9C6942E1E40C583007084B6 /* TransformerExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransformerExampleViewController.swift; sourceTree = ""; }; + F9C694571E40C720007084B6 /* FSPagerViewExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FSPagerViewExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + F9C694591E40C720007084B6 /* FSPagerViewExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FSPagerViewExampleUITests.swift; sourceTree = ""; }; + F9C6945B1E40C720007084B6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F9C694621E40C8DA007084B6 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = ""; }; + F9C694631E40C8DA007084B6 /* 1_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_1.jpg; sourceTree = ""; }; + F9C694641E40C8DA007084B6 /* 1_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_2.jpg; sourceTree = ""; }; + F9C694651E40C8DA007084B6 /* 1_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_3.jpg; sourceTree = ""; }; + F9C694661E40C8DA007084B6 /* 1_4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_4.jpg; sourceTree = ""; }; + F9C694671E40C8DA007084B6 /* 1_5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_5.jpg; sourceTree = ""; }; + F9C694681E40C8DA007084B6 /* 1_6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_6.jpg; sourceTree = ""; }; + F9C694691E40C8DA007084B6 /* 1_7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_7.jpg; sourceTree = ""; }; + F9C6946A1E40C8DA007084B6 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = ""; }; + F9C6946B1E40C8DA007084B6 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = ""; }; + F9C6946C1E40C8DA007084B6 /* 4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 4.jpg; sourceTree = ""; }; + F9C6946D1E40C8DA007084B6 /* 5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 5.jpg; sourceTree = ""; }; + F9C6946E1E40C8DA007084B6 /* 6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 6.jpg; sourceTree = ""; }; + F9C6946F1E40C8DA007084B6 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = ""; }; + F9C694701E40C8DA007084B6 /* background.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = background.jpg; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F97C96741E1FDE25002D9E7E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9C694541E40C720007084B6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + F97C966E1E1FDE25002D9E7E = { + isa = PBXGroup; + children = ( + F9C694161E40C543007084B6 /* FSPagerView */, + F9C694231E40C583007084B6 /* FSPagerViewExample */, + F9C694581E40C720007084B6 /* FSPagerViewExampleUITests */, + F97C96781E1FDE25002D9E7E /* Products */, + ); + sourceTree = ""; + }; + F97C96781E1FDE25002D9E7E /* Products */ = { + isa = PBXGroup; + children = ( + F97C96771E1FDE25002D9E7E /* FSPagerViewExample.app */, + F9C694571E40C720007084B6 /* FSPagerViewExampleUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + F9C694161E40C543007084B6 /* FSPagerView */ = { + isa = PBXGroup; + children = ( + F9C694191E40C543007084B6 /* FSPagerView.swift */, + F9C694171E40C543007084B6 /* FSPageControl.swift */, + F9C694181E40C543007084B6 /* FSPagerCollectionView.swift */, + F9C6941A1E40C543007084B6 /* FSPagerViewCell.swift */, + F9C6941B1E40C543007084B6 /* FSPageViewLayout.swift */, + F9C6941C1E40C543007084B6 /* FSPageViewTransformer.swift */, + ); + name = FSPagerView; + path = ../FSPagerView; + sourceTree = ""; + }; + F9C694231E40C583007084B6 /* FSPagerViewExample */ = { + isa = PBXGroup; + children = ( + F9C694241E40C583007084B6 /* AppDelegate.swift */, + F9C6942A1E40C583007084B6 /* BasicExampleViewController.swift */, + F9C6942E1E40C583007084B6 /* TransformerExampleViewController.swift */, + F9C6942C1E40C583007084B6 /* PageControlExampleViewController.swift */, + F9C694251E40C583007084B6 /* Assets.xcassets */, + F9C694261E40C583007084B6 /* LaunchScreen.storyboard */, + F9C694281E40C583007084B6 /* Main.storyboard */, + F9C694611E40C8DA007084B6 /* Resources */, + F9C694371E40C59E007084B6 /* Supporting Files */, + F9C6942D1E40C583007084B6 /* Resources */, + ); + path = FSPagerViewExample; + sourceTree = ""; + }; + F9C6942D1E40C583007084B6 /* Resources */ = { + isa = PBXGroup; + children = ( + ); + path = Resources; + sourceTree = ""; + }; + F9C694371E40C59E007084B6 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + F9C6942B1E40C583007084B6 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + F9C694581E40C720007084B6 /* FSPagerViewExampleUITests */ = { + isa = PBXGroup; + children = ( + F9C694591E40C720007084B6 /* FSPagerViewExampleUITests.swift */, + F9C6945B1E40C720007084B6 /* Info.plist */, + ); + path = FSPagerViewExampleUITests; + sourceTree = ""; + }; + F9C694611E40C8DA007084B6 /* Resources */ = { + isa = PBXGroup; + children = ( + F9C694621E40C8DA007084B6 /* 1.jpg */, + F9C694631E40C8DA007084B6 /* 1_1.jpg */, + F9C694641E40C8DA007084B6 /* 1_2.jpg */, + F9C694651E40C8DA007084B6 /* 1_3.jpg */, + F9C694661E40C8DA007084B6 /* 1_4.jpg */, + F9C694671E40C8DA007084B6 /* 1_5.jpg */, + F9C694681E40C8DA007084B6 /* 1_6.jpg */, + F9C694691E40C8DA007084B6 /* 1_7.jpg */, + F9C6946A1E40C8DA007084B6 /* 2.jpg */, + F9C6946B1E40C8DA007084B6 /* 3.jpg */, + F9C6946C1E40C8DA007084B6 /* 4.jpg */, + F9C6946D1E40C8DA007084B6 /* 5.jpg */, + F9C6946E1E40C8DA007084B6 /* 6.jpg */, + F9C6946F1E40C8DA007084B6 /* 7.jpg */, + F9C694701E40C8DA007084B6 /* background.jpg */, + ); + name = Resources; + path = ../../Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F97C96761E1FDE25002D9E7E /* FSPagerViewExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = F97C969F1E1FDE25002D9E7E /* Build configuration list for PBXNativeTarget "FSPagerViewExample" */; + buildPhases = ( + F97C96731E1FDE25002D9E7E /* Sources */, + F97C96741E1FDE25002D9E7E /* Frameworks */, + F97C96751E1FDE25002D9E7E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FSPagerViewExample; + productName = FSPageSliderExample; + productReference = F97C96771E1FDE25002D9E7E /* FSPagerViewExample.app */; + productType = "com.apple.product-type.application"; + }; + F9C694561E40C720007084B6 /* FSPagerViewExampleUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = F9C6945E1E40C720007084B6 /* Build configuration list for PBXNativeTarget "FSPagerViewExampleUITests" */; + buildPhases = ( + F9C694531E40C720007084B6 /* Sources */, + F9C694541E40C720007084B6 /* Frameworks */, + F9C694551E40C720007084B6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + F9C6945D1E40C720007084B6 /* PBXTargetDependency */, + ); + name = FSPagerViewExampleUITests; + productName = FSPagerViewExampleUITests; + productReference = F9C694571E40C720007084B6 /* FSPagerViewExampleUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F97C966F1E1FDE25002D9E7E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Wenchao Ding"; + TargetAttributes = { + F97C96761E1FDE25002D9E7E = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = HZF422TY46; + ProvisioningStyle = Automatic; + }; + F9C694561E40C720007084B6 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = HZF422TY46; + ProvisioningStyle = Automatic; + TestTargetID = F97C96761E1FDE25002D9E7E; + }; + }; + }; + buildConfigurationList = F97C96721E1FDE25002D9E7E /* Build configuration list for PBXProject "FSPagerViewExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = F97C966E1E1FDE25002D9E7E; + productRefGroup = F97C96781E1FDE25002D9E7E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F97C96761E1FDE25002D9E7E /* FSPagerViewExample */, + F9C694561E40C720007084B6 /* FSPagerViewExampleUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + F97C96751E1FDE25002D9E7E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9C694751E40C8DA007084B6 /* 1_4.jpg in Resources */, + F9C694321E40C583007084B6 /* Main.storyboard in Resources */, + F9C694741E40C8DA007084B6 /* 1_3.jpg in Resources */, + F9C6947B1E40C8DA007084B6 /* 4.jpg in Resources */, + F9C694731E40C8DA007084B6 /* 1_2.jpg in Resources */, + F9C694301E40C583007084B6 /* Assets.xcassets in Resources */, + F9C6947A1E40C8DA007084B6 /* 3.jpg in Resources */, + F9C694341E40C583007084B6 /* Info.plist in Resources */, + F9C694721E40C8DA007084B6 /* 1_1.jpg in Resources */, + F9C6947D1E40C8DA007084B6 /* 6.jpg in Resources */, + F9C6947C1E40C8DA007084B6 /* 5.jpg in Resources */, + F9C694761E40C8DA007084B6 /* 1_5.jpg in Resources */, + F9C694311E40C583007084B6 /* LaunchScreen.storyboard in Resources */, + F9C694791E40C8DA007084B6 /* 2.jpg in Resources */, + F9C694781E40C8DA007084B6 /* 1_7.jpg in Resources */, + F9C6947E1E40C8DA007084B6 /* 7.jpg in Resources */, + F9C694711E40C8DA007084B6 /* 1.jpg in Resources */, + F9C6947F1E40C8DA007084B6 /* background.jpg in Resources */, + F9C694771E40C8DA007084B6 /* 1_6.jpg in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9C694551E40C720007084B6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + F97C96731E1FDE25002D9E7E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9C6942F1E40C583007084B6 /* AppDelegate.swift in Sources */, + F9C6941D1E40C543007084B6 /* FSPageControl.swift in Sources */, + F9C6941E1E40C543007084B6 /* FSPagerCollectionView.swift in Sources */, + F9C6941F1E40C543007084B6 /* FSPagerView.swift in Sources */, + F9C694351E40C583007084B6 /* PageControlExampleViewController.swift in Sources */, + F9C694221E40C543007084B6 /* FSPageViewTransformer.swift in Sources */, + F9C694361E40C583007084B6 /* TransformerExampleViewController.swift in Sources */, + F9C694331E40C583007084B6 /* BasicExampleViewController.swift in Sources */, + F9C694201E40C543007084B6 /* FSPagerViewCell.swift in Sources */, + F9C694211E40C543007084B6 /* FSPageViewLayout.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9C694531E40C720007084B6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9C6945A1E40C720007084B6 /* FSPagerViewExampleUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + F9C6945D1E40C720007084B6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F97C96761E1FDE25002D9E7E /* FSPagerViewExample */; + targetProxy = F9C6945C1E40C720007084B6 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + F9C694261E40C583007084B6 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + F9C694271E40C583007084B6 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + F9C694281E40C583007084B6 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + F9C694291E40C583007084B6 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + F97C969D1E1FDE25002D9E7E /* 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + F97C969E1E1FDE25002D9E7E /* 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + F97C96A01E1FDE25002D9E7E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "$(SRCROOT)/FSPagerViewExample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + F97C96A11E1FDE25002D9E7E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "$(SRCROOT)/FSPagerViewExample/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + F9C6945F1E40C720007084B6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = FSPagerViewExampleUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = FSPagerViewExample; + }; + name = Debug; + }; + F9C694601E40C720007084B6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = FSPagerViewExampleUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.wenchaod.FSPagerViewExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = FSPagerViewExample; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F97C96721E1FDE25002D9E7E /* Build configuration list for PBXProject "FSPagerViewExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F97C969D1E1FDE25002D9E7E /* Debug */, + F97C969E1E1FDE25002D9E7E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F97C969F1E1FDE25002D9E7E /* Build configuration list for PBXNativeTarget "FSPagerViewExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F97C96A01E1FDE25002D9E7E /* Debug */, + F97C96A11E1FDE25002D9E7E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F9C6945E1E40C720007084B6 /* Build configuration list for PBXNativeTarget "FSPagerViewExampleUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9C6945F1E40C720007084B6 /* Debug */, + F9C694601E40C720007084B6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F97C966F1E1FDE25002D9E7E /* Project object */; +} diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e66d68b --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..82e0952 Binary files /dev/null and b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample.xcscheme b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample.xcscheme new file mode 100644 index 0000000..b35e32e --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d9328b0 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,37 @@ + + + + + SchemeUserState + + FSPagerViewExample.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + F97C96761E1FDE25002D9E7E + + primary + + + F97C968A1E1FDE25002D9E7E + + primary + + + F97C96951E1FDE25002D9E7E + + primary + + + F9C694561E40C720007084B6 + + primary + + + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/AppDelegate.swift b/FSPageSliderExample-Swift/FSPagerViewExample/AppDelegate.swift new file mode 100644 index 0000000..c0b3fb2 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// FSPagerViewExample +// +// Created by Wenchao Ding on 06/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + 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 invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // 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) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1d060ed --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/Contents.json b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/Contents.json b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/Contents.json new file mode 100644 index 0000000..564e1e0 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_cat@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png new file mode 100644 index 0000000..f2faaf8 Binary files /dev/null and b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png differ diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/Contents.json b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/Contents.json new file mode 100644 index 0000000..ef1d231 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_footprint@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png new file mode 100644 index 0000000..c337f1d Binary files /dev/null and b/FSPageSliderExample-Swift/FSPagerViewExample/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png differ diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/LaunchScreen.storyboard b/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/Main.storyboard b/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..dd6604a --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Base.lproj/Main.storyboard @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/BasicExampleViewController.swift b/FSPageSliderExample-Swift/FSPagerViewExample/BasicExampleViewController.swift new file mode 100644 index 0000000..7ec6154 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/BasicExampleViewController.swift @@ -0,0 +1,162 @@ +// +// ViewController.swift +// FSPagerViewExample +// +// Created by Wenchao Ding on 17/12/2016. +// Copyright © 2016 Wenchao Ding. All rights reserved. +// + +import UIKit + +class BasicExampleViewController: UIViewController,UITableViewDataSource,UITableViewDelegate,FSPagerViewDataSource,FSPagerViewDelegate { + + fileprivate let sectionTitles = ["Configurations", "Item Size", "Interitem Spacing"] + fileprivate let configurationTitles = ["Automatic sliding","Infinite"] + fileprivate let imageNames = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg"] + + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var pagerView: FSPagerView! { + didSet { + self.pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell") + self.pagerView.itemSize = .zero + } + } + + @IBOutlet weak var pageControl: FSPageControl! { + didSet { + self.pageControl.numberOfPages = self.imageNames.count + self.pageControl.contentHorizontalAlignment = .right + self.pageControl.contentInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) + } + } + + @IBAction func sliderValueChanged(_ sender: UISlider) { + switch sender.tag { + case 1: + let newScale = 0.5+CGFloat(sender.value)*0.5 // [0.5 - 1.0] + self.pagerView.itemSize = self.pagerView.frame.size.applying(CGAffineTransform(scaleX: newScale, y: newScale)) + case 2: + self.pagerView.interitemSpacing = CGFloat(sender.value) * 20 // [0 - 20] + default: + break + } + } + + // MARK:- UITableViewDataSource + + func numberOfSections(in tableView: UITableView) -> Int { + return self.sectionTitles.count + } + + @available(iOS 2.0, *) + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + switch section { + case 0: + return self.configurationTitles.count + case 1,2: + return 1 + default: + break + } + return 0 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + switch indexPath.section { + case 0: + // Configurations + let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! + cell.textLabel?.text = self.configurationTitles[indexPath.row] + if indexPath.row == 0 { + // Automatic Sliding + cell.accessoryType = self.pagerView.automaticSlidingInterval > 0 ? .checkmark : .none + } else if indexPath.row == 1 { + // IsInfinite + cell.accessoryType = self.pagerView.isInfinite ? .checkmark : .none + } + return cell + case 1: + // Item Spacing + let cell = tableView.dequeueReusableCell(withIdentifier: "slider_cell")! + let slider = cell.contentView.subviews.first as! UISlider + slider.tag = indexPath.section + slider.value = { + let scale: CGFloat = self.pagerView.itemSize.width/self.pagerView.frame.width + let value: CGFloat = (0.5-scale)*2 + return Float(value) + }() + return cell + case 2: + // Interitem Spacing + let cell = tableView.dequeueReusableCell(withIdentifier: "slider_cell")! + let slider = cell.contentView.subviews.first as! UISlider + slider.tag = indexPath.section + slider.value = Float(self.pagerView.interitemSpacing.divided(by: 20.0)) + return cell + default: + break + } + return tableView.dequeueReusableCell(withIdentifier: "cell")! + } + + // MARK:- UITableViewDelegate + + func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { + return indexPath.section == 0 + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + switch indexPath.section { + case 0: + if indexPath.row == 0 { // Automatic Sliding + self.pagerView.automaticSlidingInterval = 3.0 - self.pagerView.automaticSlidingInterval + } else if indexPath.row == 1 { // IsInfinite + self.pagerView.isInfinite = !self.pagerView.isInfinite + } + tableView.reloadSections([indexPath.section], with: .automatic) + default: + break + } + } + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + let collectionView: UICollectionView! + return self.sectionTitles[section] + } + + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + return section == 0 ? 40 : 20 + } + + // MARK:- FSPagerView DataSource + + public func numberOfItems(in pagerView: FSPagerView) -> Int { + return self.imageNames.count + } + + public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) + cell.imageView?.image = UIImage(named: self.imageNames[index]) + cell.textLabel?.text = index.description+index.description + return cell + } + + // MARK:- FSPagerView Delegate + + func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) { + pagerView.deselectItem(at: index, animated: true) + pagerView.scrollToItem(at: index, animated: true) + self.pageControl.currentPage = index + } + + func pagerViewDidScroll(_ pagerView: FSPagerView) { + guard self.pageControl.currentPage != pagerView.currentIndex else { + return + } + self.pageControl.currentPage = pagerView.currentIndex // Or Use KVO with property "currentIndex" + } + +} + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/Info.plist b/FSPageSliderExample-Swift/FSPagerViewExample/Info.plist new file mode 100644 index 0000000..d052473 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/PageControlExampleViewController.swift b/FSPageSliderExample-Swift/FSPagerViewExample/PageControlExampleViewController.swift new file mode 100644 index 0000000..f35b787 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/PageControlExampleViewController.swift @@ -0,0 +1,255 @@ +// +// PageControlExampleViewController.swift +// FSPagerViewExample +// +// Created by Wenchao Ding on 17/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import UIKit + +class PageControlExampleViewController: UIViewController,UITableViewDataSource,UITableViewDelegate,FSPagerViewDataSource,FSPagerViewDelegate { + + fileprivate let imageNames = ["1_1.jpg","1_2.jpg","1_3.jpg","1_4.jpg","1_5.jpg","1_6.jpg","1_7.jpg"] + fileprivate let pageControlStyles = ["Default", "Ring", "UIImage", "UIBezierPath - Star", "UIBezierPath - Heart"] + fileprivate let pageControlAlignments = ["Right", "Center", "Left"] + fileprivate let sectionTitles = ["Style", "Item Spacing", "Interitem Spacing", "Horizontal Alignment"] + + fileprivate var styleIndex = 0 { + didSet { + // Clean up + self.pageControl.setStrokeColor(nil, for: .normal) + self.pageControl.setStrokeColor(nil, for: .selected) + self.pageControl.setFillColor(nil, for: .normal) + self.pageControl.setFillColor(nil, for: .selected) + self.pageControl.setImage(nil, for: .normal) + self.pageControl.setImage(nil, for: .selected) + self.pageControl.setPath(nil, for: .normal) + self.pageControl.setPath(nil, for: .selected) + switch self.styleIndex { + case 0: + // Default + break + case 1: + // Ring + self.pageControl.setStrokeColor(.green, for: .normal) + self.pageControl.setStrokeColor(.green, for: .selected) + self.pageControl.setFillColor(.green, for: .selected) + case 2: + // Image + self.pageControl.setImage(UIImage(named:"icon_footprint"), for: .normal) + self.pageControl.setImage(UIImage(named:"icon_cat"), for: .selected) + case 3: + // UIBezierPath - Star + self.pageControl.setStrokeColor(.yellow, for: .normal) + self.pageControl.setStrokeColor(.yellow, for: .selected) + self.pageControl.setFillColor(.yellow, for: .selected) + self.pageControl.setPath(self.starPath, for: .normal) + self.pageControl.setPath(self.starPath, for: .selected) + case 4: + // UIBezierPath - Heart + let color = UIColor(red: 255/255.0, green: 102/255.0, blue: 255/255.0, alpha: 1.0) + self.pageControl.setStrokeColor(color, for: .normal) + self.pageControl.setStrokeColor(color, for: .selected) + self.pageControl.setFillColor(color, for: .selected) + self.pageControl.setPath(self.heartPath, for: .normal) + self.pageControl.setPath(self.heartPath, for: .selected) + default: + break + } + } + } + fileprivate var alignmentIndex = 0 { + didSet { + self.pageControl.contentHorizontalAlignment = [.right,.center,.left][self.alignmentIndex] + } + } + + // ⭐️ + fileprivate var starPath: UIBezierPath { + let width = self.pageControl.itemSpacing + let height = self.pageControl.itemSpacing + let starPath = UIBezierPath() + starPath.move(to: CGPoint(x: width*0.5, y: 0)) + starPath.addLine(to: CGPoint(x: width*0.677, y: height*0.257)) + starPath.addLine(to: CGPoint(x: width*0.975, y: height*0.345)) + starPath.addLine(to: CGPoint(x: width*0.785, y: height*0.593)) + starPath.addLine(to: CGPoint(x: width*0.794, y: height*0.905)) + starPath.addLine(to: CGPoint(x: width*0.5, y: height*0.8)) + starPath.addLine(to: CGPoint(x: width*0.206, y: height*0.905)) + starPath.addLine(to: CGPoint(x: width*0.215, y: height*0.593)) + starPath.addLine(to: CGPoint(x: width*0.025, y: height*0.345)) + starPath.addLine(to: CGPoint(x: width*0.323, y: height*0.257)) + starPath.close() + return starPath + } + + // ❤️ + fileprivate var heartPath: UIBezierPath { + let width = self.pageControl.itemSpacing + let height = self.pageControl.itemSpacing + let heartPath = UIBezierPath() + heartPath.move(to: CGPoint(x: width*0.5, y: height)) + heartPath.addCurve( + to: CGPoint(x: 0, y: height*0.25), + controlPoint1: CGPoint(x: width*0.5, y: height*0.75) , + controlPoint2: CGPoint(x: 0, y: height*0.5) + ) + heartPath.addArc( + withCenter: CGPoint(x: width*0.25,y: height*0.25), + radius: width * 0.25, + startAngle: CGFloat(M_PI), + endAngle: 0, + clockwise: true + ) + heartPath.addArc( + withCenter: CGPoint(x: width*0.75, y: height*0.25), + radius: width * 0.25, + startAngle: CGFloat(M_PI), + endAngle: 0, + clockwise: true + ) + heartPath.addCurve( + to: CGPoint(x: width*0.5, y: height), + controlPoint1: CGPoint(x: width, y: height*0.5), + controlPoint2: CGPoint(x: width*0.5, y: height*0.75) + ) + heartPath.close() + return heartPath + } + + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var pagerView: FSPagerView! { + didSet { + self.pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell") + } + } + + @IBOutlet weak var pageControl: FSPageControl! { + didSet { + self.pageControl.numberOfPages = self.imageNames.count + self.pageControl.contentHorizontalAlignment = .right + self.pageControl.contentInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) + } + } + + // MARK:- UITableViewDataSource + + func numberOfSections(in tableView: UITableView) -> Int { + return self.sectionTitles.count + } + + @available(iOS 2.0, *) + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + switch section { + case 0: + return self.pageControlStyles.count + case 1,2: + return 1 + case 3: + return self.pageControlAlignments.count + default: + break + } + return 0 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + switch indexPath.section { + case 0: + let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! + cell.textLabel?.text = self.pageControlStyles[indexPath.row] + cell.accessoryType = self.styleIndex==indexPath.row ? .checkmark : .none + return cell + case 1: + let cell = tableView.dequeueReusableCell(withIdentifier: "slider_cell")! + let slider = cell.contentView.subviews.first as! UISlider + slider.tag = indexPath.section + slider.value = Float((self.pageControl.itemSpacing-6.0).divided(by: 10.0)) + return cell + case 2: + let cell = tableView.dequeueReusableCell(withIdentifier: "slider_cell")! + let slider = cell.contentView.subviews.first as! UISlider + slider.tag = indexPath.section + slider.value = Float((self.pageControl.interitemSpacing-6.0).divided(by: 10.0)) + return cell + case 3: + let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! + cell.textLabel?.text = self.pageControlAlignments[indexPath.row] + cell.accessoryType = self.alignmentIndex==indexPath.row ? .checkmark : .none + return cell + default: + break + } + return tableView.dequeueReusableCell(withIdentifier: "cell")! + } + + // MARK:- UITableViewDelegate + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return self.sectionTitles[section] + } + + func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool { + return [0,3].contains(indexPath.section) // 0 or 3 + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + switch indexPath.section { + case 0: + self.styleIndex = indexPath.row + tableView.reloadSections([indexPath.section], with: .automatic) + case 3: + self.alignmentIndex = indexPath.row + tableView.reloadSections([indexPath.section], with: .automatic) + default: + break + } + } + + // MARK:- FSPagerViewDataSource + + func numberOfItems(in pagerView: FSPagerView) -> Int { + return self.imageNames.count + } + + public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) + cell.imageView?.image = UIImage(named: self.imageNames[index]) + return cell + } + + func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) { + pagerView.deselectItem(at: index, animated: true) + } + + // MARK:- FSPagerViewDelegate + + func pagerViewDidScroll(_ pagerView: FSPagerView) { + guard self.pageControl.currentPage != pagerView.currentIndex else { + return + } + self.pageControl.currentPage = pagerView.currentIndex // Or Use KVO with property "currentIndex" + } + + // MARK:- Target Actions + + @IBAction func sliderValueChanged(_ sender: UISlider) { + switch sender.tag { + case 1: + self.pageControl.itemSpacing = 6.0 + CGFloat(sender.value*10.0) // [6 - 16] + // Redraw UIBezierPath + if [3,4].contains(self.styleIndex) { + let index = self.styleIndex + self.styleIndex = index + } + case 2: + self.pageControl.interitemSpacing = 6.0 + CGFloat(sender.value*10.0) // [6 - 16] + default: + break + } + } + +} + diff --git a/FSPageSliderExample-Swift/FSPagerViewExample/TransformerExampleViewController.swift b/FSPageSliderExample-Swift/FSPagerViewExample/TransformerExampleViewController.swift new file mode 100644 index 0000000..5c05624 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExample/TransformerExampleViewController.swift @@ -0,0 +1,109 @@ +// +// TransformerExampleViewController.swift +// FSPagerViewExample +// +// Created by Wenchao Ding on 09/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import UIKit + +class TransformerExampleViewController: UIViewController,FSPagerViewDataSource,FSPagerViewDelegate, UITableViewDataSource,UITableViewDelegate { + + fileprivate let imageNames = ["1_1.jpg","1_2.jpg","1_3.jpg","1_4.jpg","1_5.jpg","1_6.jpg","1_7.jpg"] + fileprivate let transformerNames = ["cross fading", "zoom out", "depth", "linear", "overlap", "ferris wheel", "inverted ferris wheel", "coverflow"] + fileprivate let transformerTypes: [FSPagerViewTransformerType] = [.crossFading, + .zoomOut, + .depth, + .linear, + .overlap, + .ferrisWheel, + .invertedFerrisWheel, + .coverFlow] + fileprivate var typeIndex = 0 { + didSet { + let type = self.transformerTypes[typeIndex] + self.pagerView.transformer = FSPagerViewTransformer(type:type) + switch type { + case .none, .crossFading, .zoomOut, .depth: + self.pagerView.itemSize = .zero // 'Zero' means fill the size of parent + case .linear, .overlap: + let transform = CGAffineTransform(scaleX: 0.6, y: 0.75) + self.pagerView.itemSize = self.pagerView.frame.size.applying(transform) + case .ferrisWheel, .invertedFerrisWheel: + self.pagerView.itemSize = CGSize(width: 180, height: 140) + case .coverFlow: + self.pagerView.itemSize = CGSize(width: 220, height: 170) + } + + } + } + + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var pagerView: FSPagerView! { + didSet { + self.pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell") + self.typeIndex = 0 + } + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + let index = self.typeIndex + self.typeIndex = index // Manually trigger didSet + } + + // MARK:- UITableViewDataSource + + func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + @available(iOS 2.0, *) + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return self.transformerNames.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! + cell.textLabel?.text = self.transformerNames[indexPath.row] + cell.accessoryType = indexPath.row == self.typeIndex ? .checkmark : .none + return cell + } + + // MARK:- UITableViewDelegate + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + self.typeIndex = indexPath.row + if let visibleRows = tableView.indexPathsForVisibleRows { + tableView.reloadRows(at: visibleRows, with: .automatic) + } + } + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return "Transformers" + } + + // MARK:- FSPagerViewDataSource + + public func numberOfItems(in pagerView: FSPagerView) -> Int { + return imageNames.count + } + + public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) + cell.imageView?.image = UIImage(named: self.imageNames[index]) + cell.imageView?.contentMode = .scaleAspectFill + cell.imageView?.clipsToBounds = true + return cell + } + + func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) { + pagerView.deselectItem(at: index, animated: true) + pagerView.scrollToItem(at: index, animated: true) + } + +} + + diff --git a/FSPageSliderExample-Swift/FSPagerViewExampleUITests/FSPagerViewExampleUITests.swift b/FSPageSliderExample-Swift/FSPagerViewExampleUITests/FSPagerViewExampleUITests.swift new file mode 100644 index 0000000..49e6a32 --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExampleUITests/FSPagerViewExampleUITests.swift @@ -0,0 +1,36 @@ +// +// FSPagerViewExampleUITests.swift +// FSPagerViewExampleUITests +// +// Created by Wenchao Ding on 31/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import XCTest + +class FSPagerViewExampleUITests: XCTestCase { + + override func setUp() { + super.setUp() + + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. + XCUIApplication().launch() + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +} diff --git a/FSPageSliderExample-Swift/FSPagerViewExampleUITests/Info.plist b/FSPageSliderExample-Swift/FSPagerViewExampleUITests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/FSPageSliderExample-Swift/FSPagerViewExampleUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/FSPagerView.podspec b/FSPagerView.podspec new file mode 100644 index 0000000..dae9434 --- /dev/null +++ b/FSPagerView.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |s| + + s.name = "FSPagerView" + s.version = "0.1.0" + s.summary = "FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banner、Product Show、Welcome Pages、Screen/ViewController Sliders." + + s.homepage = "https://github.com/WenchaoD/FSPagerView" + s.license = 'MIT' + s.author = { "Wenchao Ding" => "f33chobits@gmail.com" } + s.source = { :git => "https://github.com/WenchaoD/FSPagerView.git", :tag => s.version.to_s } + + s.platform = :ios + s.ios.deployment_target = '8.0' + s.requires_arc = true + s.framework = 'UIKit' + s.source_files = 'FSPagerView/*.{h,m}' + +end diff --git a/FSPagerView/FSPageControl.swift b/FSPagerView/FSPageControl.swift new file mode 100644 index 0000000..495b832 --- /dev/null +++ b/FSPagerView/FSPageControl.swift @@ -0,0 +1,287 @@ +// +// FSPageControl.swift +// FSPagerView +// +// Created by Wenchao Ding on 17/12/2016. +// Copyright © 2016 Wenchao Ding. All rights reserved. +// + +import UIKit + +@IBDesignable +open class FSPageControl: UIControl { + + /// The number of page indicators of the page control. Default is 0. + @IBInspectable + open var numberOfPages: Int = 0 { + didSet { + self.setNeedsCreateIndicators() + } + } + + /// The current page, highlighted by the page control. Default is 0. + @IBInspectable + open var currentPage: Int = 0 { + didSet { + self.setNeedsUpdateIndicators() + } + } + + /// The spacing to use of page indicators in the page control. + @IBInspectable + open var itemSpacing: CGFloat = 6 { + didSet { + self.setNeedsUpdateIndicators() + } + } + + /// The spacing to use between page indicators in the page control. + @IBInspectable + open var interitemSpacing: CGFloat = 6 { + didSet { + self.setNeedsLayout() + } + } + + /// The distance that the page indicators is inset from the enclosing page control. + @IBInspectable + open var contentInsets: UIEdgeInsets = .zero { + didSet { + self.setNeedsLayout() + } + } + + open override var contentHorizontalAlignment: UIControlContentHorizontalAlignment { + didSet { + self.setNeedsLayout() + } + } + + internal var strokeColors: [UIControlState: UIColor] = [:] + internal var fillColors: [UIControlState: UIColor] = [:] + internal var paths: [UIControlState: UIBezierPath] = [:] + internal var images: [UIControlState: UIImage] = [:] + internal var alphas: [UIControlState: CGFloat] = [:] + internal var transforms: [UIControlState: CGAffineTransform] = [:] + + fileprivate weak var contentView: UIView! + + fileprivate var needsUpdateIndicators = false + fileprivate var needsCreateIndicators = false + fileprivate var indicatorLayers = [CAShapeLayer]() + + fileprivate var runLoopObserver: CFRunLoopObserver? + fileprivate var runLoopCallback: CFRunLoopObserverCallBack = { + (observer: CFRunLoopObserver?, activity: CFRunLoopActivity, info: UnsafeMutableRawPointer?) -> Void in + guard let info = info else { + return + } + let pageControl = Unmanaged.fromOpaque(info).takeUnretainedValue() + if pageControl.needsCreateIndicators { + pageControl.createIndicatorsIfNecessary() + } + if pageControl.needsUpdateIndicators { + pageControl.updateIndicatorsIfNecessary() + } + } + + public override init(frame: CGRect) { + super.init(frame: frame) + commonInit() + } + + public required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + commonInit() + } + + deinit { + CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), self.runLoopObserver, .commonModes); + } + + open override func layoutSubviews() { + super.layoutSubviews() + self.contentView.frame = { + let x = self.contentInsets.left + let y = self.contentInsets.top + let width = self.frame.width - self.contentInsets.left - self.contentInsets.right + let height = self.frame.height - self.contentInsets.top - self.contentInsets.bottom + let frame = CGRect(x: x, y: y, width: width, height: height) + return frame + }() + } + + open override func layoutSublayers(of layer: CALayer) { + super.layoutSublayers(of: layer) + + let diameter = self.itemSpacing + let spacing = self.interitemSpacing + var x: CGFloat = { + switch self.contentHorizontalAlignment { + case .left: + return 0 + case .center, .fill: + let midX = self.contentView.bounds.midX + let amplitude = CGFloat(self.numberOfPages/2) * diameter + spacing*CGFloat((self.numberOfPages-1)/2) + return midX - amplitude + case .right: + let contentWidth = diameter*CGFloat(self.numberOfPages) + CGFloat(self.numberOfPages-1)*spacing + return contentView.frame.width - contentWidth + } + }() + for (index,value) in self.indicatorLayers.enumerated() { + let state: UIControlState = (index == self.currentPage) ? .selected : .normal + let image = self.images[state] + let size = image?.size ?? CGSize(width: diameter, height: diameter) + let origin = CGPoint(x: x - (size.width-diameter)*0.5, y: self.contentView.bounds.midY-size.height*0.5) + value.frame = CGRect(origin: origin, size: size) + x = x + spacing + diameter + } + + } + + /// Sets the stroke color for page indicators to use for the specified state. (selected/normal). + @objc(setStrokeColor:forState:) + open func setStrokeColor(_ strokeColor: UIColor?, for state: UIControlState) { + guard self.strokeColors[state] != strokeColor else { + return + } + self.strokeColors[state] = strokeColor + self.setNeedsUpdateIndicators() + } + + /// Sets the fill color for page indicators to use for the specified state. (selected/normal). + @objc(setFillColor:forState:) + open func setFillColor(_ fillColor: UIColor?, for state: UIControlState) { + guard self.fillColors[state] != fillColor else { + return + } + self.fillColors[state] = fillColor + self.setNeedsUpdateIndicators() + } + + /// Sets the image for page indicators to use for the specified state. (selected/normal). + @objc(setImage:forState:) + open func setImage(_ image: UIImage?, for state: UIControlState) { + guard self.images[state] != image else { + return + } + self.images[state] = image + self.setNeedsUpdateIndicators() + } + + /// Sets the alpha value for page indicators to use for the specified state. (selected/normal). + @objc(setAlpha:forState:) + open func setAlpha(_ alpha: CGFloat, for state: UIControlState) { + guard self.alphas[state] != alpha else { + return + } + self.alphas[state] = alpha + self.setNeedsUpdateIndicators() + } + + /// Sets the path for page indicators to use for the specified state. (selected/normal). + @objc(setPath:forState:) + open func setPath(_ path: UIBezierPath?, for state: UIControlState) { + guard self.paths[state] != path else { + return + } + self.paths[state] = path + self.setNeedsUpdateIndicators() + } + + // MARK: - Private functions + + fileprivate func commonInit() { + + // Content View + let view = UIView(frame: .zero) + view.backgroundColor = UIColor.clear + self.addSubview(view) + self.contentView = view + + // RunLoop + let runLoop = CFRunLoopGetCurrent() + let activities: CFRunLoopActivity = [.entry,.afterWaiting] + var context = CFRunLoopObserverContext(version: 0, info: Unmanaged.passUnretained(self).toOpaque(), retain: nil, release: nil, copyDescription: nil) + self.runLoopObserver = CFRunLoopObserverCreate(nil, activities.rawValue, true, Int.max, self.runLoopCallback, &context) + CFRunLoopAddObserver(runLoop, self.runLoopObserver, .commonModes) + + } + + fileprivate func setNeedsUpdateIndicators() { + self.needsUpdateIndicators = true + self.setNeedsLayout() + } + + fileprivate func updateIndicatorsIfNecessary() { + guard self.needsUpdateIndicators else { + return + } + guard self.indicatorLayers.count > 0 else { + return + } + self.needsUpdateIndicators = false + self.indicatorLayers.forEach { (layer) in + self.updateIndicatorAttributes(for: layer) + } + } + + fileprivate func updateIndicatorAttributes(for layer: CAShapeLayer) { + let index = self.indicatorLayers.index(of: layer) + let state: UIControlState = index == self.currentPage ? .selected : .normal + if let image = self.images[state] { + layer.strokeColor = nil + layer.fillColor = nil + layer.path = nil + layer.contents = image.cgImage + } else { + layer.contents = nil + let strokeColor = self.strokeColors[state] + let fillColor = self.fillColors[state] + if strokeColor == nil && fillColor == nil { + layer.fillColor = (state == .selected ? UIColor.white : UIColor.gray).cgColor + layer.strokeColor = nil + } else { + layer.strokeColor = strokeColor?.cgColor + layer.fillColor = fillColor?.cgColor + } + layer.path = self.paths[state]?.cgPath ?? UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: self.itemSpacing, height: self.itemSpacing)).cgPath + } + if let transform = self.transforms[state] { + layer.transform = CATransform3DMakeAffineTransform(transform) + } + layer.opacity = Float(self.alphas[state] ?? 1.0) + } + + fileprivate func setNeedsCreateIndicators() { + self.needsCreateIndicators = true + } + + fileprivate func createIndicatorsIfNecessary() { + guard self.needsCreateIndicators else { + return + } + self.needsCreateIndicators = false + self.indicatorLayers.forEach { (layer) in + layer.removeFromSuperlayer() + } + self.indicatorLayers.removeAll() + for _ in 0.. 0 && self.numberOfSections > 0 else { + return + } + + self.actualItemSize = { + var size = pagerView.itemSize + if size == .zero { + size = collectionView.frame.size + } + return size + }() + + self.actualInteritemSpacing = { + if let transformer = pagerView.transformer { + return transformer.proposedInteritemSpacing() + } + return pagerView.interitemSpacing + }() + self.leadingSpacing = (collectionView.frame.width-self.actualItemSize.width)*0.5 + self.itemSpan = self.actualItemSize.width+self.actualInteritemSpacing + + // Calculate and cache contentSize, rather than calculating each time + self.contentSize = { + let numberOfItems = self.numberOfItems*self.numberOfSections + var contentSizeWidth: CGFloat = self.leadingSpacing*2 // Leading & trailing spacing + contentSizeWidth += CGFloat(numberOfItems-1)*self.actualInteritemSpacing // Interitem spacing + contentSizeWidth += CGFloat(numberOfItems)*self.actualItemSize.width // Item sizes + let contentSize = CGSize(width: contentSizeWidth, height: collectionView.frame.height) + return contentSize + }() + self.adjustCollectionViewBounds() + } + + override open var collectionViewContentSize: CGSize { + return self.contentSize + } + + override open func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool { + return true + } + + override open func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + var layoutAttributes = [UICollectionViewLayoutAttributes]() + guard self.itemSpan > 0, !rect.isEmpty else { + return layoutAttributes + } + let rect = rect.intersection(CGRect(origin: .zero, size: self.contentSize)) + guard !rect.isEmpty else { + return layoutAttributes + } + // Calculate start position and index of certain rects + let numberOfItemsBefore = max(Int((rect.minX-self.leadingSpacing)/self.itemSpan),0) + let startPosition = self.leadingSpacing + CGFloat(numberOfItemsBefore)*self.itemSpan + let startIndex = numberOfItemsBefore + // Create layout attributes + var itemIndex = startIndex + var x = startPosition + let maxPosition = min(rect.maxX,self.contentSize.width-self.actualItemSize.width) + while x <= maxPosition { + let indexPath = IndexPath(item: itemIndex%self.numberOfItems, section: itemIndex/self.numberOfItems) + let attributes = self.layoutAttributesForItem(at: indexPath)! + self.applyTransform(to: attributes) + layoutAttributes.append(attributes) + itemIndex += 1 + x += self.itemSpan + } + return layoutAttributes + } + + override open func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { + guard let collectionView = self.collectionView else { + return UICollectionViewLayoutAttributes(forCellWith: indexPath) + } + if let attributes = self.layoutAttributes[indexPath] { + return attributes + } + let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath) + let x = self.frame(for: indexPath).minX + let center = CGPoint(x: x+self.actualItemSize.width*0.5, y: collectionView.frame.height*0.5) + attributes.center = center + attributes.size = self.actualItemSize + self.layoutAttributes[indexPath] = attributes + return attributes + } + + override open func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint { + guard let collectionView = self.collectionView else { + return proposedContentOffset + } + let proposedContentOffsetX: CGFloat = { + var offset: CGFloat = round(proposedContentOffset.x/self.itemSpan)*self.itemSpan + let translation = collectionView.panGestureRecognizer.translation(in: collectionView).x + let minFlippingDistance = min(0.5 * self.itemSpan,150) + if abs(translation) <= minFlippingDistance { + if abs(velocity.x) >= 0.3 { + offset += self.itemSpan * (velocity.x)/abs(velocity.x) + } + } + return offset + }() + let proposedContentOffset = CGPoint(x: proposedContentOffsetX, y: proposedContentOffset.y) + return proposedContentOffset + } + + // MARK:- Internal functions + + internal func forceInvalidate() { + self.needsReprepare = true + self.invalidateLayout() + } + + internal func contentOffset(for indexPath: IndexPath) -> CGPoint { + let origin = self.frame(for: indexPath).origin + guard let collectionView = self.collectionView else { + return origin + } + let contentOffset = CGPoint(x: origin.x - (collectionView.frame.width*0.5-self.actualItemSize.width*0.5), y: collectionView.contentOffset.y) + return contentOffset + } + + internal func frame(for indexPath: IndexPath) -> CGRect { + let numberOfItems = self.numberOfItems*indexPath.section + indexPath.item + let originX = self.leadingSpacing + CGFloat(numberOfItems)*self.itemSpan + let originY = (self.collectionView!.frame.height-self.actualItemSize.height) + let origin = CGPoint(x: originX, y: originY) + let frame = CGRect(origin: origin, size: self.actualItemSize) + return frame + } + + internal func nextIndexPath(for indexPath: IndexPath) -> IndexPath { + let section = indexPath.section + let item = indexPath.item + 1 + if item >= self.numberOfItems { + return IndexPath(item: 0, section: min(section+1,self.numberOfSections-1)) + } + return IndexPath(item: item, section: section) + } + + internal func previousIndexPath(for indexPath: IndexPath) -> IndexPath { + let section = indexPath.section + let item = indexPath.item - 1 + if item < 0 { + return IndexPath(item: self.numberOfItems-1, section: max(section-1,0)) + } + return IndexPath(item: item, section: section) + } + + // MARK:- Private functions + + fileprivate func commonInit() { + NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNotification(notification:)), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil) + } + + @objc + fileprivate func didReceiveNotification(notification: Notification) { + if self.pagerView?.itemSize == .zero { + self.adjustCollectionViewBounds() + } + } + + fileprivate func adjustCollectionViewBounds() { + guard let collectionView = self.collectionView, let pagerView = self.pagerView else { + return + } + let currentIndex = pagerView.currentIndex + let newIndexPath = IndexPath(item: currentIndex, section: self.isInfinite ? self.numberOfSections/2 : 0) + let contentOffsetX = self.contentOffset(for: newIndexPath).x + let contentOffset = CGPoint(x: contentOffsetX, y: 0) + let newBounds = CGRect(origin: contentOffset, size: collectionView.frame.size) + collectionView.bounds = newBounds + } + + fileprivate func applyTransform(to attributes: UICollectionViewLayoutAttributes) { + guard let collectionView = self.collectionView else { + return + } + guard let transformer = self.pagerView?.transformer else { + return + } + let ruler = collectionView.bounds.midX + let position = (attributes.center.x-ruler)/self.itemSpan + transformer.applyTransform(to: attributes, for: position) + } + +} + + diff --git a/FSPagerView/FSPageViewTransformer.swift b/FSPagerView/FSPageViewTransformer.swift new file mode 100644 index 0000000..e52df69 --- /dev/null +++ b/FSPagerView/FSPageViewTransformer.swift @@ -0,0 +1,202 @@ +// +// FSPagerViewTransformer.swift +// FSPagerView +// +// Created by Wenchao Ding on 05/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import UIKit + +@objc +public enum FSPagerViewTransformerType: Int { + case none + case crossFading + case zoomOut + case depth + case overlap + case linear + case coverFlow + case ferrisWheel + case invertedFerrisWheel +} + +open class FSPagerViewTransformer: NSObject { + + open internal(set) weak var pagerView: FSPagerView? + open internal(set) var type: FSPagerViewTransformerType = .none + + open var minimumScale: CGFloat = 0.65 + open var minimumAlpha: CGFloat = 0.6 + + public init(type: FSPagerViewTransformerType) { + super.init() + self.type = type + switch type { + case .zoomOut: + self.minimumScale = 0.85 + case .depth: + self.minimumScale = 0.5 + default: + break + } + } + + public override init () { + super.init() + } + + // Apply transform to attributes - zIndex: Int, frame: CGRect, alpha: CGFloat, transform: CGAffineTransform or transform3D: CATransform3D. + open func applyTransform(to attributes: UICollectionViewLayoutAttributes, for position: CGFloat) { + guard let pagerView = self.pagerView else { + return + } + let itemSpan = pagerView.collectionViewLayout.itemSpan + switch self.type { + case .none: + break + case .crossFading: + var zIndex = 0 + var alpha: CGFloat = 0 + let transform = CGAffineTransform(translationX: -itemSpan * position, y: 0) + if (abs(position) < 1) { // [-1,1] + // Use the default slide transition when moving to the left page + alpha = 1 - abs(position) + zIndex = 1 + } else { // (1,+Infinity] + // This page is way off-screen to the right. + alpha = 0 + zIndex = Int.min + } + attributes.alpha = alpha + attributes.transform = transform + attributes.zIndex = zIndex + case .zoomOut: + var alpha: CGFloat = 0 + var transform = CGAffineTransform.identity + switch position { + case -CGFloat.greatestFiniteMagnitude ..< -1 : // [-Infinity,-1) + // This page is way off-screen to the left. + alpha = 0 + case -1 ... 1 : // [-1,1] + // Modify the default slide transition to shrink the page as well + let scaleFactor = max(self.minimumScale, 1 - abs(position)) + let vertMargin = attributes.bounds.height * (1 - scaleFactor) / 2; + let horzMargin = itemSpan * (1 - scaleFactor) / 2; + transform.a = scaleFactor + transform.d = scaleFactor + transform.tx = position < 0 ? (horzMargin - vertMargin*2) : (-horzMargin + vertMargin*2) + // Fade the page relative to its size. + alpha = self.minimumAlpha + (scaleFactor-self.minimumScale)/(1-self.minimumScale)*(1-self.minimumAlpha) + case 1 ... CGFloat.greatestFiniteMagnitude : // (1,+Infinity] + // This page is way off-screen to the right. + alpha = 0 + default: + break + } + attributes.alpha = alpha + attributes.transform = transform + case .depth: + var transform = CGAffineTransform.identity + var zIndex = 0 + var alpha: CGFloat = 0.0 + switch position { + case -CGFloat.greatestFiniteMagnitude ..< -1: // [-Infinity,-1) + // This page is way off-screen to the left. + alpha = 0 + zIndex = 0 + case -1 ... 0: // [-1,0] + // Use the default slide transition when moving to the left page + alpha = 1 + transform.tx = 0 + transform.a = 1 + transform.d = 1 + zIndex = 1 + case 0 ..< 1: // (0,1] + // Fade the page out. + alpha = CGFloat(1.0) - position + // Counteract the default slide transition + transform.tx = itemSpan * -position; + // Scale the page down (between minimumScale and 1) + let scaleFactor = self.minimumScale + + (1.0 - self.minimumScale) * (1.0 - abs(position)); + transform.a = scaleFactor + transform.d = scaleFactor + zIndex = 0 + case 1 ... CGFloat.greatestFiniteMagnitude: // (1,+Infinity] + // This page is way off-screen to the right. + alpha = 0 + zIndex = 0 + default: + break + } + attributes.alpha = alpha + attributes.transform = transform + attributes.zIndex = zIndex + case .overlap,.linear: + let scale = max(1 - (1-self.minimumScale) * abs(position), self.minimumScale) + let transform = CGAffineTransform(scaleX: scale, y: scale) + attributes.transform = transform + let alpha = (self.minimumAlpha + (1-abs(position))*(1-self.minimumAlpha)) + attributes.alpha = alpha + let zIndex = (1-abs(position)) * 10 + attributes.zIndex = Int(zIndex) + case .coverFlow: + let position = min(max(-position,-1) ,1) + let rotation = sin(position*CGFloat(M_PI_2)) * CGFloat(M_PI_4)*1.5 + let translationZ = -itemSpan * 0.5*abs(position) + var transform3D = CATransform3DIdentity + transform3D.m34 = -0.002 + transform3D = CATransform3DRotate(transform3D,rotation, 0, 1, 0) + transform3D = CATransform3DTranslate(transform3D,0, 0, translationZ) + attributes.zIndex = 100 - Int(abs(position)) + attributes.transform3D = transform3D + case .ferrisWheel, .invertedFerrisWheel: + var zIndex = 0 + var transform = CGAffineTransform.identity + switch position { + case -5 ... 5: + let itemSpacing = attributes.bounds.width+self.proposedInteritemSpacing() + let count: CGFloat = 14 + let circle: CGFloat = CGFloat(M_PI) * 2.0 + let radius = itemSpacing * count / circle + let ty = radius * (self.type == .ferrisWheel ? 1 : -1) + let theta = circle / count + let rotation = position * theta * (self.type == .ferrisWheel ? 1 : -1) + transform = transform.translatedBy(x: -position*itemSpacing, y: ty) + transform = transform.rotated(by: rotation) + transform = transform.translatedBy(x: 0, y: -ty) + zIndex = Int((4.0-abs(position)*10)) + break + default: + break + } + attributes.alpha = abs(position) < 0.5 ? 1 : self.minimumAlpha + attributes.transform = transform + attributes.zIndex = zIndex + break + } + } + + // An interitem spacing proposed by transformer class. This will override the default interitemSpacing provided by page slider. + open func proposedInteritemSpacing() -> CGFloat { + guard let pagerView = self.pagerView else { + return 0 + } + switch self.type { + case .overlap: + return pagerView.itemSize.width * -self.minimumScale * 0.6 + case .linear: + return pagerView.itemSize.width * -self.minimumScale * 0.2 + case .coverFlow: + return -pagerView.itemSize.width * sin(CGFloat(M_PI_4)/4.0*3.0) + case .ferrisWheel,.invertedFerrisWheel: + return -pagerView.itemSize.width * 0.15 + default: + break + } + return pagerView.interitemSpacing + } + +} + diff --git a/FSPagerView/FSPagerCollectionView.swift b/FSPagerView/FSPagerCollectionView.swift new file mode 100644 index 0000000..bbe975b --- /dev/null +++ b/FSPagerView/FSPagerCollectionView.swift @@ -0,0 +1,60 @@ +// +// FSPagerViewCollectionView.swift +// FSPagerView +// +// Created by Wenchao Ding on 24/12/2016. +// Copyright © 2016 Wenchao Ding. All rights reserved. +// +// 1. Reject -[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary] +// 2. Group initialized features + +import UIKit + +class FSPagerViewCollectionView: UICollectionView { + + fileprivate weak var pagerView: FSPagerView? { + return self.superview?.superview as? FSPagerView + } + + override var scrollsToTop: Bool { + set { + super.scrollsToTop = false + } + get { + return false + } + } + + override var contentInset: UIEdgeInsets { + set { + super.contentInset = .zero + if (newValue.top > 0) { + let contentOffset = CGPoint(x:self.contentOffset.x, y:self.contentOffset.y+newValue.top); + self.contentOffset = contentOffset + } + } + get { + return super.contentInset + } + } + + override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) { + super.init(frame: frame, collectionViewLayout: layout) + self.commonInit() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.commonInit() + } + + fileprivate func commonInit() { + self.contentInset = .zero + self.scrollsToTop = false + self.isPagingEnabled = false + self.decelerationRate = UIScrollViewDecelerationRateFast + self.showsVerticalScrollIndicator = false + self.showsHorizontalScrollIndicator = false + } + +} diff --git a/FSPagerView/FSPagerView.swift b/FSPagerView/FSPagerView.swift new file mode 100644 index 0000000..eac3b7f --- /dev/null +++ b/FSPagerView/FSPagerView.swift @@ -0,0 +1,468 @@ +// +// FSPagerView.swift +// FSPagerView +// +// Created by Wenchao Ding on 17/12/2016. +// Copyright © 2016 Wenchao Ding. All rights reserved. +// + +import UIKit + +@objc +public protocol FSPagerViewDataSource: NSObjectProtocol { + + /// Asks your data source object for the number of items in the pager view. + @objc(numberOfItemsInpagerView:) + func numberOfItems(in pagerView: FSPagerView) -> Int + + /// Asks your data source object for the cell that corresponds to the specified item in the pager view. + @objc(pagerView:cellForItemAtIndex:) + func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell + +} + +@objc +public protocol FSPagerViewDelegate: NSObjectProtocol { + + /// Asks the delegate if the item should be highlighted during tracking. + @objc(pagerView:shouldHighlightItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, shouldHighlightItemAt index: Int) -> Bool + + /// Tells the delegate that the item at the specified index was highlighted. + @objc(pagerView:didHighlightItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, didHighlightItemAt index: Int) + + /// Asks the delegate if the specified item should be selected. + @objc(pagerView:shouldSelectItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, shouldSelectItemAt index: Int) -> Bool + + /// Tells the delegate that the item at the specified index was selected. + @objc(pagerView:didSelectItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) + + /// Tells the delegate that the specified cell is about to be displayed in the pager view. + @objc(pagerView:willDisplayCell:forItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, willDisplay cell: FSPagerViewCell, forItemAt index: Int) + + /// Tells the delegate that the specified cell was removed from the pager view. + @objc(pagerView:didEndDisplayingCell:forItemAtIndex:) + optional func pagerView(_ pagerView: FSPagerView, didEndDisplaying cell: FSPagerViewCell, forItemAt index: Int) + + /// Tells the delegate when the pager view is about to start scrolling the content. + @objc(pagerViewWillBeginDragging:) + optional func pagerViewWillBeginDragging(_ pagerView: FSPagerView) + + /// Tells the delegate when the user finishes scrolling the content. + @objc(pagerViewWillEndDragging:targetIndex:) + optional func pagerViewWillEndDragging(_ pagerView: FSPagerView, targetIndex: Int) + + /// Tells the delegate when the user scrolls the content view within the receiver. + @objc(pagerViewDidScroll:) + optional func pagerViewDidScroll(_ pagerView: FSPagerView) + + /// Tells the delegate when a scrolling animation in the pager view concludes. + @objc(pagerViewDidEndScrollAnimation:) + optional func pagerViewDidEndScrollAnimation(_ pagerView: FSPagerView) + + /// Tells the delegate that the pager view has ended decelerating the scrolling movement. + @objc(pagerViewDidEndDecelerating:) + optional func pagerViewDidEndDecelerating(_ pagerView: FSPagerView) + +} + +@IBDesignable +open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelegate { + + // MARK: - Public properties + + #if TARGET_INTERFACE_BUILDER + // Yes you need to lie to the Interface Builder, otherwise "@IBOutlet" cannot be connected. + @IBOutlet open weak var dataSource: AnyObject? + @IBOutlet open weak var delegate: AnyObject? + #else + open weak var dataSource: FSPagerViewDataSource? + open weak var delegate: FSPagerViewDelegate? + #endif + + /// The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0. + @IBInspectable + open var automaticSlidingInterval: CGFloat = 0.0 { + didSet { + self.cancelTimer() + if self.automaticSlidingInterval > 0 { + self.startTimer() + } + } + } + + /// The spacing to use between items in the pager view. Default is 0. + @IBInspectable + open var interitemSpacing: CGFloat = 0 { + didSet { + self.collectionViewLayout.forceInvalidate() + } + } + + /// The item size of the pager view. .zero means always fill the bounds of the pager view. Default is .zero. + @IBInspectable + open var itemSize: CGSize = .zero { + didSet { + self.collectionViewLayout.forceInvalidate() + } + } + + + /// A Boolean value indicates that whether the pager view has infinite items. Default is false. + @IBInspectable + open var isInfinite: Bool = false { + didSet { + self.collectionView.reloadData() + self.collectionViewLayout.forceInvalidate() + } + } + + + /// The background view of the pager view + @IBInspectable + open var backgroundView: UIView? { + didSet { + if let backgroundView = self.backgroundView { + if backgroundView.superview != nil { + backgroundView.removeFromSuperview() + } + self.insertSubview(backgroundView, at: 0) + self.setNeedsLayout() + } + } + } + + /// The transformer of the pager view + open var transformer: FSPagerViewTransformer? { + didSet { + self.transformer?.pagerView = self + self.collectionViewLayout.forceInvalidate() + } + } + + /// Returns whether the user has touched the content to initiate scrolling. + open var isTracking: Bool { + return self.collectionView.isTracking + } + + // MARK: - Public readonly-properties + + open fileprivate(set) dynamic var currentIndex: Int = 0 + + // MARK: - Private properties + + internal weak var collectionViewLayout: FSPagerViewLayout! + internal weak var collectionView: FSPagerViewCollectionView! + internal weak var contentView: UIView! + + internal var timer: Timer? + internal var numberOfItems: Int = 0 + internal var numberOfSections: Int = 0 + + fileprivate var dequeingSection = 0 + fileprivate var centermostIndexPath: IndexPath { + guard self.numberOfItems > 0, self.collectionView.contentSize.width > 0 else { + return IndexPath(item: 0, section: 0) + } + let sortedIndexPaths = self.collectionView.indexPathsForVisibleItems.sorted { (l, r) -> Bool in + let leftCenter = self.collectionViewLayout.frame(for: l).midX + let rightCenter = self.collectionViewLayout.frame(for: r).midX + let ruler = self.collectionView.bounds.midX + return abs(ruler-leftCenter) < abs(ruler-rightCenter) + } + let indexPath = sortedIndexPaths.first + if let indexPath = indexPath { + return indexPath + } + return IndexPath(item: 0, section: 0) + } + + fileprivate var possibleTargetingIndexPath: IndexPath? + + + // MARK: - Overriden functions + + public override init(frame: CGRect) { + super.init(frame: frame) + self.commonInit() + } + + public required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + self.commonInit() + } + + open override func layoutSubviews() { + super.layoutSubviews() + self.backgroundView?.frame = self.bounds + self.contentView.frame = self.bounds + self.collectionView.frame = self.contentView.bounds + } + + open override func willMove(toWindow newWindow: UIWindow?) { + super.willMove(toWindow: newWindow) + if newWindow != nil { + self.startTimer() + } else { + self.cancelTimer() + } + } + + open override func prepareForInterfaceBuilder() { + super.prepareForInterfaceBuilder() + self.contentView.layer.borderWidth = 1 + self.contentView.layer.cornerRadius = 5 + self.contentView.layer.masksToBounds = true + let label = UILabel(frame: self.contentView.bounds) + label.textAlignment = .center + label.font = UIFont.boldSystemFont(ofSize: 25) + label.text = "FSPagerView" + self.contentView.addSubview(label) + } + + deinit { + self.collectionView.dataSource = nil + self.collectionView.delegate = nil + } + + // MARK: - UICollectionViewDataSource + + public func numberOfSections(in collectionView: UICollectionView) -> Int { + guard let dataSource = self.dataSource else { + return 1 + } + self.numberOfItems = dataSource.numberOfItems(in: self) + self.numberOfSections = self.isInfinite ? Int(Int16.max)/self.numberOfItems : 1 + return self.numberOfSections + } + + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return self.numberOfItems + } + + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let index = indexPath.item + self.dequeingSection = indexPath.section + let cell = self.dataSource!.pagerView(self, cellForItemAt: index) + return cell + } + + // MARK: - UICollectionViewDelegate + + public func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool { + guard let function = self.delegate?.pagerView(_:shouldHighlightItemAt:) else { + return true + } + let index = indexPath.item % self.numberOfItems + return function(self,index) + } + + public func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) { + guard let function = self.delegate?.pagerView(_:didHighlightItemAt:) else { + return + } + let index = indexPath.item % self.numberOfItems + function(self,index) + } + + public func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { + guard let function = self.delegate?.pagerView(_:shouldSelectItemAt:) else { + return true + } + let index = indexPath.item % self.numberOfItems + return function(self,index) + } + + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + guard let function = self.delegate?.pagerView(_:didSelectItemAt:) else { + return + } + self.possibleTargetingIndexPath = indexPath + defer { + self.possibleTargetingIndexPath = nil + } + let index = indexPath.item % self.numberOfItems + function(self,index) + } + + public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { + guard let function = self.delegate?.pagerView(_:willDisplay:forItemAt:) else { + return + } + let index = indexPath.item % self.numberOfItems + function(self,cell as! FSPagerViewCell,index) + } + + public func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { + guard let function = self.delegate?.pagerView(_:didEndDisplaying:forItemAt:) else { + return + } + let index = indexPath.item % self.numberOfItems + function(self,cell as! FSPagerViewCell,index) + } + + public func scrollViewDidScroll(_ scrollView: UIScrollView) { + if self.numberOfItems > 0 { + // In case someone is using KVO + let currentIndex = lround(Double(scrollView.contentOffset.x.divided(by: self.collectionViewLayout.itemSpan))) % self.numberOfItems + if (currentIndex != self.currentIndex) { + self.currentIndex = currentIndex + } + } + guard let function = self.delegate?.pagerViewDidScroll else { + return + } + function(self) + } + + public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { + if let function = self.delegate?.pagerViewWillBeginDragging(_:) { + function(self) + } + if self.automaticSlidingInterval > 0 { + self.cancelTimer() + } + } + + public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { + if let function = self.delegate?.pagerViewWillEndDragging(_:targetIndex:) { + let targetItem = lround(Double(targetContentOffset.pointee.x/self.collectionViewLayout.itemSpan)) + function(self, targetItem % self.numberOfItems) + } + if self.automaticSlidingInterval > 0 { + self.startTimer() + } + } + + public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { + if let function = self.delegate?.pagerViewDidEndDecelerating { + function(self) + } + } + + public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { + if let function = self.delegate?.pagerViewDidEndScrollAnimation { + function(self) + } + } + + // MARK: - Public functions + + @objc(registerClass:forCellWithReuseIdentifier:) + open func register(_ cellClass: Swift.AnyClass?, forCellWithReuseIdentifier identifier: String) { + guard let cellClass = cellClass, cellClass.isSubclass(of: FSPagerViewCell.self) else { + fatalError("Cell class must be subclass of FSPagerViewCell") + } + self.collectionView.register(cellClass, forCellWithReuseIdentifier: identifier) + } + + @objc(dequeueReusableCellWithReuseIdentifier:atIndex:) + open func dequeueReusableCell(withReuseIdentifier identifier: String, at index: Int) -> FSPagerViewCell { + let indexPath = IndexPath(item: index, section: self.dequeingSection) + let cell = self.collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! FSPagerViewCell + return cell + } + + @objc(reloadData) + open func reloadData() { + self.collectionView.reloadData() + } + + @objc(selectItemAtIndex:animated:) + open func selectItem(at index: Int, animated: Bool) { + let indexPath = self.nearbyIndexPath(for: index) + self.collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: .centeredHorizontally) + } + + @objc(deselectItemAtIndex:animated:) + open func deselectItem(at index: Int, animated: Bool) { + let indexPath = self.nearbyIndexPath(for: index) + self.collectionView.deselectItem(at: indexPath, animated: animated) + } + + @objc(scrollToItemAtIndex:animated:) + open func scrollToItem(at index: Int, animated: Bool) { + guard index < self.numberOfItems else { + fatalError("index \(index) is out of range [0...\(self.numberOfItems-1)]") + } + let indexPath = { () -> IndexPath in + if let indexPath = self.possibleTargetingIndexPath, indexPath.item == index { + defer { + self.possibleTargetingIndexPath = nil + } + return indexPath + } + return self.isInfinite ? self.nearbyIndexPath(for: index) : IndexPath(item: index, section: 0) + }() + let contentOffset = self.collectionViewLayout.contentOffset(for: indexPath) + self.collectionView.setContentOffset(contentOffset, animated: animated) + } + + // MARK: - Private functions + + fileprivate func commonInit() { + + // Content View + let contentView = UIView(frame:CGRect.zero) + contentView.backgroundColor = UIColor.clear + self.addSubview(contentView) + self.contentView = contentView + + // UICollectionView + let collectionViewLayout = FSPagerViewLayout() + let collectionView = FSPagerViewCollectionView(frame: CGRect.zero, collectionViewLayout: collectionViewLayout) + collectionView.dataSource = self + collectionView.delegate = self + collectionView.backgroundColor = UIColor.clear + self.contentView.addSubview(collectionView) + self.collectionView = collectionView + self.collectionViewLayout = collectionViewLayout + + } + + fileprivate func startTimer() { + guard self.automaticSlidingInterval > 0 && self.timer == nil else { + return + } + self.timer = Timer.scheduledTimer(timeInterval: TimeInterval(self.automaticSlidingInterval), target: self, selector: #selector(self.flipNext(sender:)), userInfo: nil, repeats: true) + } + + @objc + fileprivate func flipNext(sender: Timer?) { + guard let _ = self.superview, let _ = self.window else { + return + } + guard !self.collectionView.isTracking else { + return + } + self.scrollToItem(at: (self.currentIndex+1)%self.numberOfItems, animated: true) + } + + fileprivate func cancelTimer() { + guard self.timer != nil else { + return + } + self.timer!.invalidate() + self.timer = nil + } + + fileprivate func nearbyIndexPath(for index: Int) -> IndexPath { + // Is there a better algorithm? + let currentIndex = self.currentIndex + let currentSection = self.centermostIndexPath.section + if abs(currentIndex-index) <= self.numberOfItems/2 { + return IndexPath(item: index, section: currentSection) + } else if (index-currentIndex >= 0) { + return IndexPath(item: index, section: currentSection-1) + } else { + return IndexPath(item: index, section: currentSection+1) + } + } + +} + + diff --git a/FSPagerView/FSPagerViewCell.swift b/FSPagerView/FSPagerViewCell.swift new file mode 100644 index 0000000..ec0840a --- /dev/null +++ b/FSPagerView/FSPagerViewCell.swift @@ -0,0 +1,136 @@ +// +// FSPagerViewCell.swift +// FSPagerView +// +// Created by Wenchao Ding on 17/12/2016. +// Copyright © 2016 Wenchao Ding. All rights reserved. +// + +import UIKit + +open class FSPagerViewCell: UICollectionViewCell { + + fileprivate let kvoContext = UnsafeMutableRawPointer(bitPattern: 0) + fileprivate let selectionColor = UIColor(white: 0.2, alpha: 0.2) + + internal weak var _textLabel: UILabel? + open var textLabel: UILabel? { + if let _ = _textLabel { + return _textLabel + } + let view = UIView(frame: .zero) + view.isUserInteractionEnabled = false + view.backgroundColor = UIColor.black.withAlphaComponent(0.6) + + let textLabel = UILabel(frame: .zero) + textLabel.textColor = .white + textLabel.font = UIFont.preferredFont(forTextStyle: .body) + self.contentView.addSubview(view) + view.addSubview(textLabel) + + textLabel.addObserver(self, forKeyPath: "font", options: [.old,.new], context: kvoContext) + + _textLabel = textLabel + return textLabel + } + + internal weak var _imageView: UIImageView? + open var imageView: UIImageView? { + if let _ = _imageView { + return _imageView + } + let imageView = UIImageView(frame: .zero) + self.contentView.addSubview(imageView) + _imageView = imageView + return imageView + } + + fileprivate weak var _selectedForegroundView: UIView? + fileprivate var selectedForegroundView: UIView? { + if let _ = _selectedForegroundView { + return _selectedForegroundView + } + let view = UIView(frame: self.contentView.bounds) + self.contentView.addSubview(view) + _selectedForegroundView = view + return view + } + + open override var isHighlighted: Bool { + didSet { + if self.isHighlighted { + self.selectedForegroundView?.layer.backgroundColor = self.selectionColor.cgColor + } else if !self.isSelected { + self.selectedForegroundView?.layer.backgroundColor = UIColor.clear.cgColor + } + } + } + + open override var isSelected: Bool { + didSet { + self.selectedForegroundView?.layer.backgroundColor = self.isSelected ? self.selectionColor.cgColor : UIColor.clear.cgColor + } + } + + public override init(frame: CGRect) { + super.init(frame: frame) + commonInit() + } + + public required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + commonInit() + } + + fileprivate func commonInit() { + self.contentView.backgroundColor = UIColor.white + self.contentView.layer.shadowColor = UIColor.black.cgColor + self.contentView.layer.shadowRadius = 5 + self.contentView.layer.shadowOpacity = 0.75 + self.contentView.layer.shadowOffset = .zero + self.backgroundColor = UIColor.white + } + + deinit { + if let textLabel = _textLabel { + textLabel.removeObserver(self, forKeyPath: "font", context: kvoContext) + } + } + + override open func layoutSubviews() { + super.layoutSubviews() + if let imageView = _imageView { + imageView.frame = self.contentView.bounds + } + if let textLabel = _textLabel { + textLabel.superview!.frame = { + var rect = self.contentView.bounds + let height = textLabel.font.pointSize*1.5 + rect.size.height = height + rect.origin.y = self.contentView.frame.height-height + return rect + }() + textLabel.frame = { + var rect = textLabel.superview!.bounds + rect = rect.insetBy(dx: 8, dy: 0) + rect.size.height -= 1 + rect.origin.y += 1 + return rect + }() + } + if let selectedForegroundView = _selectedForegroundView { + selectedForegroundView.frame = self.contentView.bounds + } + } + + open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + if context == kvoContext { + if keyPath == "font" { + self.setNeedsLayout() + } + } else { + super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) + } + } + +} diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.pbxproj b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.pbxproj new file mode 100644 index 0000000..398fc7c --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.pbxproj @@ -0,0 +1,580 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + F908BC411E35AAE4002B2F51 /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC321E35AAE4002B2F51 /* 1.jpg */; }; + F908BC421E35AAE4002B2F51 /* 1_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC331E35AAE4002B2F51 /* 1_1.jpg */; }; + F908BC431E35AAE4002B2F51 /* 1_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC341E35AAE4002B2F51 /* 1_2.jpg */; }; + F908BC441E35AAE4002B2F51 /* 1_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC351E35AAE4002B2F51 /* 1_3.jpg */; }; + F908BC451E35AAE4002B2F51 /* 1_4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC361E35AAE4002B2F51 /* 1_4.jpg */; }; + F908BC461E35AAE4002B2F51 /* 1_5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC371E35AAE4002B2F51 /* 1_5.jpg */; }; + F908BC471E35AAE4002B2F51 /* 1_6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC381E35AAE4002B2F51 /* 1_6.jpg */; }; + F908BC481E35AAE4002B2F51 /* 1_7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC391E35AAE4002B2F51 /* 1_7.jpg */; }; + F908BC491E35AAE4002B2F51 /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3A1E35AAE4002B2F51 /* 2.jpg */; }; + F908BC4A1E35AAE4002B2F51 /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3B1E35AAE4002B2F51 /* 3.jpg */; }; + F908BC4B1E35AAE4002B2F51 /* 4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3C1E35AAE4002B2F51 /* 4.jpg */; }; + F908BC4C1E35AAE4002B2F51 /* 5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3D1E35AAE4002B2F51 /* 5.jpg */; }; + F908BC4D1E35AAE4002B2F51 /* 6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3E1E35AAE4002B2F51 /* 6.jpg */; }; + F908BC4E1E35AAE4002B2F51 /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC3F1E35AAE4002B2F51 /* 7.jpg */; }; + F908BC4F1E35AAE4002B2F51 /* background.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F908BC401E35AAE4002B2F51 /* background.jpg */; }; + F93F5E141E319AE8006B7082 /* PageControlExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F93F5E131E319AE8006B7082 /* PageControlExampleViewController.m */; }; + F9C6943F1E40C63E007084B6 /* FSPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C694391E40C63E007084B6 /* FSPageControl.swift */; }; + F9C694401E40C63E007084B6 /* FSPagerCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6943A1E40C63E007084B6 /* FSPagerCollectionView.swift */; }; + F9C694411E40C63E007084B6 /* FSPagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6943B1E40C63E007084B6 /* FSPagerView.swift */; }; + F9C694421E40C63E007084B6 /* FSPagerViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6943C1E40C63E007084B6 /* FSPagerViewCell.swift */; }; + F9C694431E40C63E007084B6 /* FSPageViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6943D1E40C63E007084B6 /* FSPageViewLayout.swift */; }; + F9C694441E40C63E007084B6 /* FSPageViewTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6943E1E40C63E007084B6 /* FSPageViewTransformer.swift */; }; + F9C6944C1E40C6C1007084B6 /* FSPagerViewExample_ObjcUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C6944B1E40C6C1007084B6 /* FSPagerViewExample_ObjcUITests.swift */; }; + F9EC371E1E304A830022B6D6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F9EC371D1E304A830022B6D6 /* main.m */; }; + F9EC37211E304A830022B6D6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F9EC37201E304A830022B6D6 /* AppDelegate.m */; }; + F9EC37241E304A830022B6D6 /* BasicExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F9EC37231E304A830022B6D6 /* BasicExampleViewController.m */; }; + F9EC37271E304A830022B6D6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9EC37251E304A830022B6D6 /* Main.storyboard */; }; + F9EC37291E304A830022B6D6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F9EC37281E304A830022B6D6 /* Assets.xcassets */; }; + F9EC372C1E304A830022B6D6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9EC372A1E304A830022B6D6 /* LaunchScreen.storyboard */; }; + F9F00A901E310FF600790735 /* TransformerExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F9F00A8F1E310FF600790735 /* TransformerExampleViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + F9C6944E1E40C6C1007084B6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F9EC37111E304A830022B6D6 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F9EC37181E304A830022B6D6; + remoteInfo = "FSPagerViewExample-Objc"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + F908BC321E35AAE4002B2F51 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = ""; }; + F908BC331E35AAE4002B2F51 /* 1_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_1.jpg; sourceTree = ""; }; + F908BC341E35AAE4002B2F51 /* 1_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_2.jpg; sourceTree = ""; }; + F908BC351E35AAE4002B2F51 /* 1_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_3.jpg; sourceTree = ""; }; + F908BC361E35AAE4002B2F51 /* 1_4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_4.jpg; sourceTree = ""; }; + F908BC371E35AAE4002B2F51 /* 1_5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_5.jpg; sourceTree = ""; }; + F908BC381E35AAE4002B2F51 /* 1_6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_6.jpg; sourceTree = ""; }; + F908BC391E35AAE4002B2F51 /* 1_7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1_7.jpg; sourceTree = ""; }; + F908BC3A1E35AAE4002B2F51 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = ""; }; + F908BC3B1E35AAE4002B2F51 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = ""; }; + F908BC3C1E35AAE4002B2F51 /* 4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 4.jpg; sourceTree = ""; }; + F908BC3D1E35AAE4002B2F51 /* 5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 5.jpg; sourceTree = ""; }; + F908BC3E1E35AAE4002B2F51 /* 6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 6.jpg; sourceTree = ""; }; + F908BC3F1E35AAE4002B2F51 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = ""; }; + F908BC401E35AAE4002B2F51 /* background.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = background.jpg; sourceTree = ""; }; + F93F5E121E319AE8006B7082 /* PageControlExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageControlExampleViewController.h; sourceTree = ""; }; + F93F5E131E319AE8006B7082 /* PageControlExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageControlExampleViewController.m; sourceTree = ""; }; + F9C694391E40C63E007084B6 /* FSPageControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageControl.swift; sourceTree = ""; }; + F9C6943A1E40C63E007084B6 /* FSPagerCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerCollectionView.swift; sourceTree = ""; }; + F9C6943B1E40C63E007084B6 /* FSPagerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerView.swift; sourceTree = ""; }; + F9C6943C1E40C63E007084B6 /* FSPagerViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPagerViewCell.swift; sourceTree = ""; }; + F9C6943D1E40C63E007084B6 /* FSPageViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageViewLayout.swift; sourceTree = ""; }; + F9C6943E1E40C63E007084B6 /* FSPageViewTransformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FSPageViewTransformer.swift; sourceTree = ""; }; + F9C694491E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FSPagerViewExample-ObjcUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + F9C6944B1E40C6C1007084B6 /* FSPagerViewExample_ObjcUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FSPagerViewExample_ObjcUITests.swift; sourceTree = ""; }; + F9C6944D1E40C6C1007084B6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F9EC37191E304A830022B6D6 /* FSPagerViewExample-Objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FSPagerViewExample-Objc.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + F9EC371D1E304A830022B6D6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + F9EC371F1E304A830022B6D6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + F9EC37201E304A830022B6D6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + F9EC37221E304A830022B6D6 /* BasicExampleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BasicExampleViewController.h; sourceTree = ""; }; + F9EC37231E304A830022B6D6 /* BasicExampleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BasicExampleViewController.m; sourceTree = ""; }; + F9EC37261E304A830022B6D6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + F9EC37281E304A830022B6D6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + F9EC372B1E304A830022B6D6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + F9EC372D1E304A830022B6D6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F9F00A8E1E310FF600790735 /* TransformerExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransformerExampleViewController.h; sourceTree = ""; }; + F9F00A8F1E310FF600790735 /* TransformerExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransformerExampleViewController.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F9C694461E40C6C1007084B6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9EC37161E304A830022B6D6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + F908BC311E35AAE4002B2F51 /* Resources */ = { + isa = PBXGroup; + children = ( + F908BC321E35AAE4002B2F51 /* 1.jpg */, + F908BC331E35AAE4002B2F51 /* 1_1.jpg */, + F908BC341E35AAE4002B2F51 /* 1_2.jpg */, + F908BC351E35AAE4002B2F51 /* 1_3.jpg */, + F908BC361E35AAE4002B2F51 /* 1_4.jpg */, + F908BC371E35AAE4002B2F51 /* 1_5.jpg */, + F908BC381E35AAE4002B2F51 /* 1_6.jpg */, + F908BC391E35AAE4002B2F51 /* 1_7.jpg */, + F908BC3A1E35AAE4002B2F51 /* 2.jpg */, + F908BC3B1E35AAE4002B2F51 /* 3.jpg */, + F908BC3C1E35AAE4002B2F51 /* 4.jpg */, + F908BC3D1E35AAE4002B2F51 /* 5.jpg */, + F908BC3E1E35AAE4002B2F51 /* 6.jpg */, + F908BC3F1E35AAE4002B2F51 /* 7.jpg */, + F908BC401E35AAE4002B2F51 /* background.jpg */, + ); + name = Resources; + path = ../../Resources; + sourceTree = ""; + }; + F9C694381E40C63E007084B6 /* FSPagerView */ = { + isa = PBXGroup; + children = ( + F9C694391E40C63E007084B6 /* FSPageControl.swift */, + F9C6943A1E40C63E007084B6 /* FSPagerCollectionView.swift */, + F9C6943B1E40C63E007084B6 /* FSPagerView.swift */, + F9C6943C1E40C63E007084B6 /* FSPagerViewCell.swift */, + F9C6943D1E40C63E007084B6 /* FSPageViewLayout.swift */, + F9C6943E1E40C63E007084B6 /* FSPageViewTransformer.swift */, + ); + name = FSPagerView; + path = ../FSPagerView; + sourceTree = ""; + }; + F9C6944A1E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests */ = { + isa = PBXGroup; + children = ( + F9C6944B1E40C6C1007084B6 /* FSPagerViewExample_ObjcUITests.swift */, + F9C6944D1E40C6C1007084B6 /* Info.plist */, + ); + path = "FSPagerViewExample-ObjcUITests"; + sourceTree = ""; + }; + F9C870F71E30FF8B005786E9 /* Basic Example */ = { + isa = PBXGroup; + children = ( + F9EC37221E304A830022B6D6 /* BasicExampleViewController.h */, + F9EC37231E304A830022B6D6 /* BasicExampleViewController.m */, + ); + name = "Basic Example"; + sourceTree = ""; + }; + F9C870F81E30FFA0005786E9 /* Transformer Example */ = { + isa = PBXGroup; + children = ( + F9F00A8E1E310FF600790735 /* TransformerExampleViewController.h */, + F9F00A8F1E310FF600790735 /* TransformerExampleViewController.m */, + ); + name = "Transformer Example"; + sourceTree = ""; + }; + F9C870F91E30FFAB005786E9 /* PageControl Example */ = { + isa = PBXGroup; + children = ( + F93F5E121E319AE8006B7082 /* PageControlExampleViewController.h */, + F93F5E131E319AE8006B7082 /* PageControlExampleViewController.m */, + ); + name = "PageControl Example"; + sourceTree = ""; + }; + F9EC37101E304A830022B6D6 = { + isa = PBXGroup; + children = ( + F9C694381E40C63E007084B6 /* FSPagerView */, + F9EC371B1E304A830022B6D6 /* FSPagerViewExample-Objc */, + F9C6944A1E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests */, + F9EC371A1E304A830022B6D6 /* Products */, + ); + sourceTree = ""; + }; + F9EC371A1E304A830022B6D6 /* Products */ = { + isa = PBXGroup; + children = ( + F9EC37191E304A830022B6D6 /* FSPagerViewExample-Objc.app */, + F9C694491E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + F9EC371B1E304A830022B6D6 /* FSPagerViewExample-Objc */ = { + isa = PBXGroup; + children = ( + F9EC371F1E304A830022B6D6 /* AppDelegate.h */, + F9EC37201E304A830022B6D6 /* AppDelegate.m */, + F9C870F71E30FF8B005786E9 /* Basic Example */, + F9C870F81E30FFA0005786E9 /* Transformer Example */, + F9C870F91E30FFAB005786E9 /* PageControl Example */, + F9EC37251E304A830022B6D6 /* Main.storyboard */, + F9EC37281E304A830022B6D6 /* Assets.xcassets */, + F9EC372A1E304A830022B6D6 /* LaunchScreen.storyboard */, + F9EC372D1E304A830022B6D6 /* Info.plist */, + F908BC311E35AAE4002B2F51 /* Resources */, + F9EC371C1E304A830022B6D6 /* Supporting Files */, + ); + path = "FSPagerViewExample-Objc"; + sourceTree = ""; + }; + F9EC371C1E304A830022B6D6 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + F9EC371D1E304A830022B6D6 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F9C694481E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = F9C694501E40C6C1007084B6 /* Build configuration list for PBXNativeTarget "FSPagerViewExample-ObjcUITests" */; + buildPhases = ( + F9C694451E40C6C1007084B6 /* Sources */, + F9C694461E40C6C1007084B6 /* Frameworks */, + F9C694471E40C6C1007084B6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + F9C6944F1E40C6C1007084B6 /* PBXTargetDependency */, + ); + name = "FSPagerViewExample-ObjcUITests"; + productName = "FSPagerViewExample-ObjcUITests"; + productReference = F9C694491E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; + F9EC37181E304A830022B6D6 /* FSPagerViewExample-Objc */ = { + isa = PBXNativeTarget; + buildConfigurationList = F9EC37301E304A830022B6D6 /* Build configuration list for PBXNativeTarget "FSPagerViewExample-Objc" */; + buildPhases = ( + F9EC37151E304A830022B6D6 /* Sources */, + F9EC37161E304A830022B6D6 /* Frameworks */, + F9EC37171E304A830022B6D6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "FSPagerViewExample-Objc"; + productName = "FSPageSliderExample-Objc"; + productReference = F9EC37191E304A830022B6D6 /* FSPagerViewExample-Objc.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F9EC37111E304A830022B6D6 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Wenchao Ding"; + TargetAttributes = { + F9C694481E40C6C1007084B6 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = HZF422TY46; + ProvisioningStyle = Automatic; + TestTargetID = F9EC37181E304A830022B6D6; + }; + F9EC37181E304A830022B6D6 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = HZF422TY46; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = F9EC37141E304A830022B6D6 /* Build configuration list for PBXProject "FSPagerViewExample-Objc" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = F9EC37101E304A830022B6D6; + productRefGroup = F9EC371A1E304A830022B6D6 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F9EC37181E304A830022B6D6 /* FSPagerViewExample-Objc */, + F9C694481E40C6C1007084B6 /* FSPagerViewExample-ObjcUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + F9C694471E40C6C1007084B6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9EC37171E304A830022B6D6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F908BC441E35AAE4002B2F51 /* 1_3.jpg in Resources */, + F908BC481E35AAE4002B2F51 /* 1_7.jpg in Resources */, + F908BC431E35AAE4002B2F51 /* 1_2.jpg in Resources */, + F908BC451E35AAE4002B2F51 /* 1_4.jpg in Resources */, + F908BC4A1E35AAE4002B2F51 /* 3.jpg in Resources */, + F908BC461E35AAE4002B2F51 /* 1_5.jpg in Resources */, + F908BC4C1E35AAE4002B2F51 /* 5.jpg in Resources */, + F9EC372C1E304A830022B6D6 /* LaunchScreen.storyboard in Resources */, + F908BC491E35AAE4002B2F51 /* 2.jpg in Resources */, + F908BC4F1E35AAE4002B2F51 /* background.jpg in Resources */, + F908BC4B1E35AAE4002B2F51 /* 4.jpg in Resources */, + F908BC4E1E35AAE4002B2F51 /* 7.jpg in Resources */, + F908BC4D1E35AAE4002B2F51 /* 6.jpg in Resources */, + F908BC421E35AAE4002B2F51 /* 1_1.jpg in Resources */, + F908BC471E35AAE4002B2F51 /* 1_6.jpg in Resources */, + F908BC411E35AAE4002B2F51 /* 1.jpg in Resources */, + F9EC37291E304A830022B6D6 /* Assets.xcassets in Resources */, + F9EC37271E304A830022B6D6 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + F9C694451E40C6C1007084B6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9C6944C1E40C6C1007084B6 /* FSPagerViewExample_ObjcUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9EC37151E304A830022B6D6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9C694431E40C63E007084B6 /* FSPageViewLayout.swift in Sources */, + F9C694401E40C63E007084B6 /* FSPagerCollectionView.swift in Sources */, + F9EC37241E304A830022B6D6 /* BasicExampleViewController.m in Sources */, + F9C694421E40C63E007084B6 /* FSPagerViewCell.swift in Sources */, + F9C6943F1E40C63E007084B6 /* FSPageControl.swift in Sources */, + F9EC37211E304A830022B6D6 /* AppDelegate.m in Sources */, + F9F00A901E310FF600790735 /* TransformerExampleViewController.m in Sources */, + F93F5E141E319AE8006B7082 /* PageControlExampleViewController.m in Sources */, + F9C694411E40C63E007084B6 /* FSPagerView.swift in Sources */, + F9EC371E1E304A830022B6D6 /* main.m in Sources */, + F9C694441E40C63E007084B6 /* FSPageViewTransformer.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + F9C6944F1E40C6C1007084B6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F9EC37181E304A830022B6D6 /* FSPagerViewExample-Objc */; + targetProxy = F9C6944E1E40C6C1007084B6 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + F9EC37251E304A830022B6D6 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + F9EC37261E304A830022B6D6 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + F9EC372A1E304A830022B6D6 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + F9EC372B1E304A830022B6D6 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + F9C694511E40C6C1007084B6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "FSPagerViewExample-ObjcUITests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerViewExample-ObjcUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = "FSPagerViewExample-Objc"; + }; + name = Debug; + }; + F9C694521E40C6C1007084B6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "FSPagerViewExample-ObjcUITests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerViewExample-ObjcUITests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; + TEST_TARGET_NAME = "FSPagerViewExample-Objc"; + }; + name = Release; + }; + F9EC372E1E304A830022B6D6 /* 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + F9EC372F1E304A830022B6D6 /* 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + F9EC37311E304A830022B6D6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "$(SRCROOT)/FSPagerViewExample-Objc/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerView-Objc"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + F9EC37321E304A830022B6D6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = HZF422TY46; + INFOPLIST_FILE = "$(SRCROOT)/FSPagerViewExample-Objc/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.wenchaod.FSPagerView-Objc"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F9C694501E40C6C1007084B6 /* Build configuration list for PBXNativeTarget "FSPagerViewExample-ObjcUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9C694511E40C6C1007084B6 /* Debug */, + F9C694521E40C6C1007084B6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + F9EC37141E304A830022B6D6 /* Build configuration list for PBXProject "FSPagerViewExample-Objc" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9EC372E1E304A830022B6D6 /* Debug */, + F9EC372F1E304A830022B6D6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F9EC37301E304A830022B6D6 /* Build configuration list for PBXNativeTarget "FSPagerViewExample-Objc" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9EC37311E304A830022B6D6 /* Debug */, + F9EC37321E304A830022B6D6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F9EC37111E304A830022B6D6 /* Project object */; +} diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ac9d968 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2d9e4a5 Binary files /dev/null and b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/project.xcworkspace/xcuserdata/wenchaoding.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample-Objc.xcscheme b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample-Objc.xcscheme new file mode 100644 index 0000000..4d1124e --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/FSPagerViewExample-Objc.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..44177a1 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc.xcodeproj/xcuserdata/wenchaoding.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,32 @@ + + + + + SchemeUserState + + FSPagerViewExample-Objc.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + F988117C1E31003D003B5E5E + + primary + + + F9C694481E40C6C1007084B6 + + primary + + + F9EC37181E304A830022B6D6 + + primary + + + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.h b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.h new file mode 100644 index 0000000..a1419d5 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.m b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.m new file mode 100644 index 0000000..c69f930 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/AppDelegate.m @@ -0,0 +1,51 @@ +// +// AppDelegate.m +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // 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 invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // 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. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/AppIcon.appiconset/Contents.json b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1d060ed --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/Contents.json b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/Contents.json b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/Contents.json new file mode 100644 index 0000000..564e1e0 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_cat@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png new file mode 100644 index 0000000..f2faaf8 Binary files /dev/null and b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_cat.imageset/icon_cat@2x.png differ diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/Contents.json b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/Contents.json new file mode 100644 index 0000000..ef1d231 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_footprint@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png new file mode 100644 index 0000000..c337f1d Binary files /dev/null and b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Assets.xcassets/icon_footprint.imageset/icon_footprint@2x.png differ diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/LaunchScreen.storyboard b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/Main.storyboard b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/Main.storyboard new file mode 100644 index 0000000..d077223 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Base.lproj/Main.storyboard @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.h b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.h new file mode 100644 index 0000000..e689cd5 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.h @@ -0,0 +1,15 @@ +// +// BasicExampleViewController.h +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import + +@interface BasicExampleViewController : UIViewController + + +@end + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.m b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.m new file mode 100644 index 0000000..4af723f --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/BasicExampleViewController.m @@ -0,0 +1,196 @@ +// +// BasicExampleViewController.m +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import "BasicExampleViewController.h" +#import "FSPagerViewExample_Objc-Swift.h" + + +@interface BasicExampleViewController () + +@property (strong, nonatomic) NSArray *sectionTitles; +@property (strong, nonatomic) NSArray *configurationTitles; +@property (strong, nonatomic) NSArray *imageNames; + +@property (weak , nonatomic) IBOutlet UITableView *tableView; +@property (weak , nonatomic) IBOutlet FSPagerView *pagerView; +@property (weak , nonatomic) IBOutlet FSPageControl *pageControl; + +- (IBAction)sliderValueChanged:(UISlider *)sender; + +@end + +@implementation BasicExampleViewController + +#pragma mark - Life cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.sectionTitles = @[@"Configurations", @"Item Size", @"Interitem Spacing"]; + self.configurationTitles = @[@"Automatic sliding", @"Infinite"]; + self.imageNames = @[@"1.jpg", @"2.jpg", @"3.jpg", @"4.jpg", @"5.jpg", @"6.jpg", @"7.jpg"]; + + [self.pagerView registerClass:[FSPagerViewCell class] forCellWithReuseIdentifier:@"cell"]; + self.pagerView.itemSize = self.pagerView.frame.size; + self.pageControl.numberOfPages = self.imageNames.count; + self.pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + self.pageControl.contentInsets = UIEdgeInsetsMake(0, 20, 0, 20); +} + +#pragma mark - UITableViewDataSource + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.sectionTitles.count; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + switch (section) { + case 0: + return self.configurationTitles.count; + case 1: + case 2: + return 1; + default: + break; + } + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.section) { + case 0: { + // Configurations + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + cell.textLabel.text = self.configurationTitles[indexPath.row]; + if (indexPath.row == 0) { + // Automatic Sliding + cell.accessoryType = self.pagerView.automaticSlidingInterval > 0 ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + } else if (indexPath.row == 1) { + // IsInfinite + cell.accessoryType = self.pagerView.isInfinite ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + } + return cell; + } + case 1: { + // Item Spacing + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"slider_cell"]; + UISlider *slider = cell.contentView.subviews.firstObject; + slider.tag = indexPath.section; + slider.value = ({ + CGFloat scale = self.pagerView.itemSize.width/self.pagerView.frame.size.width; + CGFloat value = (scale-0.5)*2; + value; + }); + return cell; + } + case 2: { + // Interitem Spacing + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"slider_cell"]; + UISlider *slider = cell.contentView.subviews.firstObject; + slider.tag = indexPath.section; + slider.value = self.pagerView.interitemSpacing / 20.0; + return cell; + } + default: + break; + } + return [tableView dequeueReusableCellWithIdentifier:@"cell"]; +} + +#pragma mark - UITableViewDelegate + +- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath +{ + return indexPath.section == 0; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + switch (indexPath.section) { + case 0: + if (indexPath.row == 0) { + // Automatic Sliding + self.pagerView.automaticSlidingInterval = 3.0 - self.pagerView.automaticSlidingInterval; + } else if (indexPath.row == 1) { + // IsInfinite + self.pagerView.isInfinite = !self.pagerView.isInfinite; + } + [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; + break; + default: + break; + } +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + return self.sectionTitles[section]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return section == 0 ? 40 : 20; +} + +#pragma mark - FSPagerViewDataSource + +- (NSInteger)numberOfItemsInpagerView:(FSPagerView *)pagerView +{ + return self.imageNames.count; +} + +- (FSPagerViewCell *)pagerView:(FSPagerView *)pagerView cellForItemAtIndex:(NSInteger)index +{ + FSPagerViewCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"cell" atIndex:index]; + cell.imageView.image = [UIImage imageNamed:self.imageNames[index]]; + cell.textLabel.text = [NSString stringWithFormat:@"%@%@",@(index),@(index)]; + return cell; +} + +#pragma mark - FSPagerView Delegate + +- (void)pagerView:(FSPagerView *)pagerView didSelectItemAtIndex:(NSInteger)index +{ + [pagerView deselectItemAtIndex:index animated:YES]; + [pagerView scrollToItemAtIndex:index animated:YES]; + self.pageControl.currentPage = index; +} + +- (void)pagerViewDidScroll:(FSPagerView *)pagerView +{ + if (self.pageControl.currentPage != pagerView.currentIndex) { + self.pageControl.currentPage = pagerView.currentIndex; + } +} + +#pragma mark - Target actions + +- (void)sliderValueChanged:(UISlider *)sender +{ + switch (sender.tag) { + case 1: { + CGFloat scale = 0.5 * (1 + sender.value); // [0.5 - 1.0] + self.pagerView.itemSize = CGSizeApplyAffineTransform(self.pagerView.frame.size, CGAffineTransformMakeScale(scale, scale)); + break; + } + case 2: { + self.pagerView.interitemSpacing = sender.value * 20; // [0 - 20] + break; + } + default: + break; + } +} + +@end + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Info.plist b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Info.plist new file mode 100644 index 0000000..d052473 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.h b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.h new file mode 100644 index 0000000..f8b84c9 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.h @@ -0,0 +1,13 @@ +// +// PageControlExampleViewController.h +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 20/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import + +@interface PageControlExampleViewController : UIViewController + +@end diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.m b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.m new file mode 100644 index 0000000..271b3a5 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/PageControlExampleViewController.m @@ -0,0 +1,316 @@ +// +// PageControlExampleViewController.m +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 20/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import "PageControlExampleViewController.h" +#import "FSPagerViewExample_Objc-Swift.h" + +@interface PageControlExampleViewController () + +@property (strong, nonatomic) NSArray *imageNames; +@property (strong, nonatomic) NSArray *pageControlStyles; +@property (strong, nonatomic) NSArray *pageControlAlignments; +@property (strong, nonatomic) NSArray *sectionTitles; + +@property (weak , nonatomic) IBOutlet UITableView *tableView; +@property (weak , nonatomic) IBOutlet FSPagerView *pagerView; +@property (weak , nonatomic) IBOutlet FSPageControl *pageControl; + +@property (assign, nonatomic) NSInteger styleIndex; +@property (assign, nonatomic) NSInteger alignmentIndex; + +// ⭐️ +@property (readonly, nonatomic) UIBezierPath *starPath; +// ❤️ +@property (readonly, nonatomic) UIBezierPath *heartPath; + +- (IBAction)sliderValueChanged:(UISlider *)sender; + +@end + +@implementation PageControlExampleViewController + +#pragma mark - Life cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + self.imageNames = @[@"1_1.jpg", @"1_2.jpg", @"1_3.jpg", @"1_4.jpg", @"1_5.jpg", @"1_6.jpg", @"1_7.jpg"]; + self.pageControlStyles = @[@"Default", @"Ring", @"UIImage", @"UIBezierPath - Star", @"UIBezierPath - Heart"]; + self.pageControlAlignments = @[@"Right", @"Center", @"Left"]; + self.sectionTitles = @[@"Style", @"Item Spacing", @"Interitem Spacing", @"Horizontal Alignment"]; + + self.pageControl.numberOfPages = self.imageNames.count; + self.pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + self.pageControl.contentInsets = UIEdgeInsetsMake(0, 20, 0, 20); + + self.pagerView.itemSize = CGSizeZero; // Fill parent + [self.pagerView registerClass:[FSPagerViewCell class] forCellWithReuseIdentifier:@"cell"]; +} + +#pragma mark - UITableViewDataSource + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return self.sectionTitles.count; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + switch (section) { + case 0: + return self.pageControlStyles.count; + case 1: + case 2: + return 1; + case 3: + return self.pageControlAlignments.count; + default: + break; + } + return 0; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.section) { + case 0: { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + cell.textLabel.text = self.pageControlStyles[indexPath.row]; + cell.accessoryType = self.styleIndex==indexPath.row ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + return cell; + } + case 1: { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"slider_cell"]; + UISlider *slider = cell.contentView.subviews.firstObject; + slider.tag = indexPath.section; + slider.value = (self.pageControl.itemSpacing-6.0)/10.0; + return cell; + } + case 2: { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"slider_cell"]; + UISlider *slider = cell.contentView.subviews.firstObject; + slider.tag = indexPath.section; + slider.value = (self.pageControl.interitemSpacing-6.0)/10.0; + return cell; + } + case 3: { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + cell.textLabel.text = self.pageControlAlignments[indexPath.row]; + cell.accessoryType = self.alignmentIndex==indexPath.row ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + return cell; + } + default: + break; + } + return [tableView dequeueReusableCellWithIdentifier:@"cell"]; +} + +#pragma mark - UITableViewDelegate + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + return self.sectionTitles[section]; +} + +- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath +{ + return indexPath.section == 0 || indexPath.section == 3; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + switch (indexPath.section) { + case 0: { + self.styleIndex = indexPath.row; + [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; + break; + } + case 3: { + self.alignmentIndex = indexPath.row; + [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; + break; + } + + default: + break; + } +} + +#pragma mark - FSPagerViewDataSource + +- (NSInteger)numberOfItemsInpagerView:(FSPagerView *)pagerView +{ + return self.imageNames.count; +} + +- (FSPagerViewCell *)pagerView:(FSPagerView *)pagerView cellForItemAtIndex:(NSInteger)index +{ + FSPagerViewCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"cell" atIndex:index]; + cell.imageView.image = [UIImage imageNamed:self.imageNames[index]]; + return cell; +} + +#pragma mark - FSPagerViewDelegate + +- (void)pagerViewDidScroll:(FSPagerView *)pagerView +{ + if (self.pageControl.currentPage != pagerView.currentIndex) { + self.pageControl.currentPage = pagerView.currentIndex; + } +} + +#pragma mark - Target actions + +- (void)sliderValueChanged:(UISlider *)sender +{ + switch (sender.tag) { + case 1: { + self.pageControl.itemSpacing = 6.0 + sender.value*10.0; // [6 - 16] + // Redraw UIBezierPath + if (self.styleIndex == 3 || self.styleIndex == 4) { + self.styleIndex = self.styleIndex; + } + break; + } + case 3: { + self.pageControl.interitemSpacing = 6.0 + sender.value*10.0; // [6 - 16] + break; + } + default: + break; + } +} + +#pragma mark - Private properties + +- (void)setStyleIndex:(NSInteger)styleIndex +{ + _styleIndex = styleIndex; + // Clean up + [self.pageControl setStrokeColor:nil forState:UIControlStateNormal]; + [self.pageControl setStrokeColor:nil forState:UIControlStateSelected]; + [self.pageControl setFillColor:nil forState:UIControlStateNormal]; + [self.pageControl setFillColor:nil forState:UIControlStateSelected]; + [self.pageControl setImage:nil forState:UIControlStateNormal]; + [self.pageControl setImage:nil forState:UIControlStateSelected]; + [self.pageControl setPath:nil forState:UIControlStateNormal]; + [self.pageControl setPath:nil forState:UIControlStateSelected]; + switch (styleIndex) { + case 0: { + // Default + break; + } + case 1: { + // Ring + [self.pageControl setStrokeColor:[UIColor greenColor] forState:UIControlStateNormal]; + [self.pageControl setStrokeColor:[UIColor greenColor] forState:UIControlStateSelected]; + [self.pageControl setFillColor:[UIColor greenColor] forState:UIControlStateSelected]; + break; + } + case 2: { + // UIImage + [self.pageControl setImage:[UIImage imageNamed:@"icon_footprint"] forState:UIControlStateNormal]; + [self.pageControl setImage:[UIImage imageNamed:@"icon_cat"] forState:UIControlStateSelected]; + break; + } + case 3: { + // UIBezierPath - Star + [self.pageControl setStrokeColor:[UIColor yellowColor] forState:UIControlStateNormal]; + [self.pageControl setStrokeColor:[UIColor yellowColor] forState:UIControlStateSelected]; + [self.pageControl setFillColor:[UIColor yellowColor] forState:UIControlStateSelected]; + [self.pageControl setPath:self.starPath forState:UIControlStateNormal]; + [self.pageControl setPath:self.starPath forState:UIControlStateSelected]; + break; + } + case 4: { + // UIBezierPath - Heart + UIColor *color = [UIColor colorWithRed:255/255.0 green:102/255.0 blue:255/255.0 alpha:1.0]; + [self.pageControl setStrokeColor:color forState:UIControlStateNormal]; + [self.pageControl setStrokeColor:color forState:UIControlStateSelected]; + [self.pageControl setFillColor:color forState:UIControlStateSelected]; + [self.pageControl setPath:self.heartPath forState:UIControlStateNormal]; + [self.pageControl setPath:self.heartPath forState:UIControlStateSelected]; + break; + } + default: + break; + } + +} + +- (void)setAlignmentIndex:(NSInteger)alignmentIndex +{ + _alignmentIndex = alignmentIndex; + switch (alignmentIndex) { + case 0: { + self.pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + break; + } + case 1: { + self.pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; + break; + } + case 2: { + self.pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + break; + } + default: + break; + } +} + +// ⭐️ +- (UIBezierPath *)starPath +{ + CGFloat width = self.pageControl.itemSpacing; + CGFloat height = self.pageControl.itemSpacing; + UIBezierPath *starPath = [[UIBezierPath alloc] init]; + [starPath moveToPoint:CGPointMake(width*0.5, 0)]; + [starPath addLineToPoint:CGPointMake(width*0.677, height*0.257)]; + [starPath addLineToPoint:CGPointMake(width*0.975, height*0.345)]; + [starPath addLineToPoint:CGPointMake(width*0.785, height*0.593)]; + [starPath addLineToPoint:CGPointMake(width*0.794, height*0.905)]; + [starPath addLineToPoint:CGPointMake(width*0.5, height*0.8)]; + [starPath addLineToPoint:CGPointMake(width*0.206, height*0.905)]; + [starPath addLineToPoint:CGPointMake(width*0.215, height*0.593)]; + [starPath addLineToPoint:CGPointMake(width*0.025, height*0.345)]; + [starPath addLineToPoint:CGPointMake(width*0.323, height*0.257)]; + [starPath closePath]; + return starPath; +} + +// ❤️ +- (UIBezierPath *)heartPath +{ + CGFloat width = self.pageControl.itemSpacing; + CGFloat height = self.pageControl.itemSpacing; + UIBezierPath *heartPath = [[UIBezierPath alloc] init]; + [heartPath moveToPoint:CGPointMake(width*0.5, height)]; + [heartPath addCurveToPoint:CGPointMake(0, height*0.25) + controlPoint1:CGPointMake(width*0.5, height*0.75) + controlPoint2:CGPointMake(0, height*0.5)]; + [heartPath addArcWithCenter:CGPointMake(width*0.25, height*0.25) + radius:width*0.25 + startAngle:M_PI + endAngle:0 + clockwise:YES]; + [heartPath addArcWithCenter:CGPointMake(width*0.75, height*0.25) + radius:width*0.25 + startAngle:M_PI + endAngle:0 + clockwise:YES]; + [heartPath addCurveToPoint:CGPointMake(width*0.5, height) + controlPoint1:CGPointMake(width, height*0.5) + controlPoint2:CGPointMake(width*0.5, height*0.75)]; + [heartPath closePath]; + return heartPath; +} + + +@end diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.h b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.h new file mode 100644 index 0000000..ffe22a1 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.h @@ -0,0 +1,13 @@ +// +// ViewController.h +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import + +@interface TransformerExampleViewController : UIViewController + +@end diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.m b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.m new file mode 100644 index 0000000..a54dce3 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/TransformerExampleViewController.m @@ -0,0 +1,170 @@ +// +// TransformerExampleViewController.m +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import "TransformerExampleViewController.h" +#import "FSPagerViewExample_Objc-Swift.h" + +@interface TransformerExampleViewController () + +@property (strong, nonatomic) NSArray *imageNames; +@property (strong, nonatomic) NSArray *transformerNames; +@property (assign, nonatomic) NSInteger typeIndex; + +@property (weak , nonatomic) IBOutlet UITableView *tableView; +@property (weak , nonatomic) IBOutlet FSPagerView *pagerView; + +@end + +@implementation TransformerExampleViewController + +#pragma mark - Life cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + self.imageNames = @[@"1_1.jpg",@"1_2.jpg",@"1_3.jpg",@"1_4.jpg",@"1_5.jpg",@"1_6.jpg",@"1_7.jpg"]; + self.transformerNames = @[@"cross fading", @"zoom out", @"depth", @"linear", @"overlap", @"ferris wheel", @"inverted ferris wheel", @"coverflow"]; + [self.pagerView registerClass:[FSPagerViewCell class] forCellWithReuseIdentifier:@"cell"]; + self.typeIndex = 0; +} + +- (void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + self.typeIndex = self.typeIndex; +} + +#pragma mark - UITableViewDataSource + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.transformerNames.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + cell.textLabel.text = self.transformerNames[indexPath.row]; + cell.accessoryType = indexPath.row == self.typeIndex ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + self.typeIndex = indexPath.row; + [tableView reloadRowsAtIndexPaths:tableView.indexPathsForVisibleRows withRowAnimation:UITableViewRowAnimationAutomatic]; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + return @"Transformers"; +} + +#pragma mark - FSPagerViewDataSource + +- (NSInteger)numberOfItemsInpagerView:(FSPagerView *)pagerView +{ + return self.imageNames.count; +} + +- (FSPagerViewCell *)pagerView:(FSPagerView *)pagerView cellForItemAtIndex:(NSInteger)index +{ + FSPagerViewCell * cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"cell" atIndex:index]; + cell.imageView.image = [UIImage imageNamed:self.imageNames[index]]; + cell.imageView.contentMode = UIViewContentModeScaleAspectFill; + cell.imageView.clipsToBounds = YES; + return cell; +} + +#pragma mark - FSPagerViewDelegate + +- (void)pagerView:(FSPagerView *)pagerView didSelectItemAtIndex:(NSInteger)index +{ + [pagerView deselectItemAtIndex:index animated:YES]; + [pagerView scrollToItemAtIndex:index animated:YES]; +} + +#pragma mark - Private properties + +- (void)setTypeIndex:(NSInteger)typeIndex +{ + _typeIndex = typeIndex; + FSPagerViewTransformerType type; + switch (typeIndex) { + case 0: { + type = FSPagerViewTransformerTypeCrossFading; + break; + } + case 1: { + type = FSPagerViewTransformerTypeZoomOut; + break; + } + case 2: { + type = FSPagerViewTransformerTypeDepth; + break; + } + case 3: { + type = FSPagerViewTransformerTypeLinear; + break; + } + case 4: { + type = FSPagerViewTransformerTypeOverlap; + break; + } + case 5: { + type = FSPagerViewTransformerTypeFerrisWheel; + break; + } + case 6: { + type = FSPagerViewTransformerTypeInvertedFerrisWheel; + break; + } + case 7: { + type = FSPagerViewTransformerTypeCoverFlow; + break; + } + default: + break; + } + self.pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:type]; + switch (type) { + case FSPagerViewTransformerTypeCrossFading: + case FSPagerViewTransformerTypeZoomOut: + case FSPagerViewTransformerTypeDepth: { + self.pagerView.itemSize = CGSizeZero; // 'Zero' means fill the size of parent + break; + } + case FSPagerViewTransformerTypeLinear: + case FSPagerViewTransformerTypeOverlap: { + CGAffineTransform transform = CGAffineTransformMakeScale(0.6, 0.75); + self.pagerView.itemSize = CGSizeApplyAffineTransform(self.pagerView.frame.size, transform); + break; + } + case FSPagerViewTransformerTypeFerrisWheel: + case FSPagerViewTransformerTypeInvertedFerrisWheel: { + self.pagerView.itemSize = CGSizeMake(180, 140); + break; + } + case FSPagerViewTransformerTypeCoverFlow: { + self.pagerView.itemSize = CGSizeMake(220, 170); + break; + } + default: + break; + } +} + +@end + + diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-Objc/main.m b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/main.m new file mode 100644 index 0000000..6dd189d --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-Objc/main.m @@ -0,0 +1,16 @@ +// +// main.m +// FSPagerViewExample-Objc +// +// Created by Wenchao Ding on 19/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/FSPagerViewExample_ObjcUITests.swift b/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/FSPagerViewExample_ObjcUITests.swift new file mode 100644 index 0000000..3de1ef5 --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/FSPagerViewExample_ObjcUITests.swift @@ -0,0 +1,36 @@ +// +// FSPagerViewExample_ObjcUITests.swift +// FSPagerViewExample-ObjcUITests +// +// Created by Wenchao Ding on 31/01/2017. +// Copyright © 2017 Wenchao Ding. All rights reserved. +// + +import XCTest + +class FSPagerViewExample_ObjcUITests: XCTestCase { + + override func setUp() { + super.setUp() + + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. + XCUIApplication().launch() + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +} diff --git a/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/Info.plist b/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/Info.plist new file mode 100644 index 0000000..6c6c23c --- /dev/null +++ b/FSPagerViewExample-Objc/FSPagerViewExample-ObjcUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/README-OBJECTIVE-C.md b/README-OBJECTIVE-C.md new file mode 100644 index 0000000..7395b3f --- /dev/null +++ b/README-OBJECTIVE-C.md @@ -0,0 +1,374 @@ +# FSPagerView + +| [SWIFT](https://github.com/WenchaoD/FSPagerView/blob/master/README.md) | OBJECTIVE-C | +|---|---| + +**FSPagerView** is an elegant Screen Slide Library implemented primarily with ***UICollectionView***. It is extremely helpful for making Banner、Product Show、Welcome Pages、Screen/ViewController Sliders. + +## Features +* ***Infinite*** scrolling. +* ***Automatic*** Sliding. +* Fully customizable item, with predefined banner-style item. +* Fully customizable ***page control***. +* Rich build-in 3D transformers. +* ***Simple*** and ***Delightful*** api usage. +* Support **SWIFT** and **OBJECTIVE-C**. + +## Demo1 Banner + +| Banner | +|---| +|![9](https://cloud.githubusercontent.com/assets/5186464/22688057/9003d880-ed65-11e6-882e-4587c97c8878.gif) | + +### automaticSlidingInterval +The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0. + +**e.g.** + +```objc +pagerView.automaticSlidingInterval = 3.0; +``` + + +### isInfinite +A boolean value indicates whether the pager view has infinite number of items. Default is false. + +**e.g.** + +```objc +pagerView.isInfinite = YES; +``` + +### itemSize +The item size of the pager view. .zero means always fill the bounds of the pager view. Default is .zero. + + +**e.g.** + +```objc +pagerView.itemSize = CGSizeMake(200, 180); +``` + +### interitemSpacing +The spacing to use between items in the pager view. Default is 0. + +**e.g.** + +```objc +pagerView.interitemSpacing = 10; +``` + +## Demo2 - Transformers + +|Cross Fading| +|---| +| ![1](https://cloud.githubusercontent.com/assets/5186464/22686429/1983b97e-ed5f-11e6-9a32-44c1830df7ac.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeCrossFading]; +``` +--- + + + +|Zoom Out| +|---| +| ![2](https://cloud.githubusercontent.com/assets/5186464/22686426/19830862-ed5f-11e6-90be-8fb1319cd125.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeZoomOut]; +``` +--- + + +|Depth| +|---| +| ![3](https://cloud.githubusercontent.com/assets/5186464/22686430/19856c1a-ed5f-11e6-8187-9e4395b7597c.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeDepth]; +``` +--- + + +|Linear| +|---| +| ![4](https://cloud.githubusercontent.com/assets/5186464/22686428/198368c0-ed5f-11e6-95df-cfcfe9bc3f29.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeLinear]; +``` +--- + + +|Overlap| +|---| +| ![5](https://cloud.githubusercontent.com/assets/5186464/22686431/198905aa-ed5f-11e6-9312-ec371c8c4e44.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeOverlap]; +``` +--- + + +|Ferris Wheel| +|------| +| ![6](https://cloud.githubusercontent.com/assets/5186464/22686427/19831c08-ed5f-11e6-8bdb-30e762a85d4b.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeFerrisWheel]; +``` +--- + + +|Inverted Ferris Wheel| +|------| +| ![7](https://cloud.githubusercontent.com/assets/5186464/22686433/19b669a0-ed5f-11e6-8bf0-dc23edf8101f.gif) | + +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeInvertedFerrisWheel]; +``` +--- + + +|Cover Flow| +|------| +| ![8](https://cloud.githubusercontent.com/assets/5186464/22686432/19b567f8-ed5f-11e6-885d-bd660c98b507.gif) | +```objc +pagerView.transformer = [[FSPagerViewTransformer alloc] initWithType:FSPagerViewTransformerTypeCoverFlow]; +``` +--- + + +> Customize your own transformer by subclassing`FSPagerViewTransformer.` + + +## Demo3 Page Control +|Page Control| +|---| +|![10](https://cloud.githubusercontent.com/assets/5186464/22689720/2baabdb0-ed6d-11e6-8287-ef7a2c0f64bc.gif) +| + +### numberOfPages +The number of page indicators of the page control. Default is 0. + +**e.g.** + +```objc +pageControl.numberOfPages = 5; +``` + +### currentPage +The current page, highlighted by the page control. Default is 0. + +**e.g.** + +```objc +pageControl.currentPage = 1; +``` + +### setStrokeColor:forState: +Sets the stroke color for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```objc +[pageControl setStrokeColor:[UIColor greenColor] forState:UIControlStateNormal]; +[pageControl setStrokeColor:[UIColor yellowColor] forState:UIControlStateSelected]; +``` + + +### setFillColor:forState: +Sets the fill color for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```objc +[pageControl setFillColor:[UIColor grayColor] forState:UIControlStateNormal]; +[pageControl setFillColor:[UIColor whiteColor] forState:UIControlStateSelected]; +``` + +### setImage:forState: +Sets the image for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```objc +[pageControl setImage:[UIImage imageNamed:@"image1"] forState:UIControlStateNormal]; +[pageControl setImage:[UIImage imageNamed:@"image2"] forState:UIControlStateSelected]; +``` + +### setPath:forState: +Sets the path for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```objc +[pageControl setPath:[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 8, 8)] forState:UIControlStateNormal]; +[pageControl setPath: [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 8, 8)] forState:UIControlStateSelected]; +``` + +## Installation +* Manually +* Cocoapods + +### Manually +1. ***[Download](#)*** the source code. +2. Extract the zip file, simply drag folder ***FSPagerView*** into your project. +3. Make sure ***Copy items if needed*** is checked. + +### Cocoapods +```ruby +use_frameworks! +pod FSPagerView +``` + +## Tutorial +* [Get start](#get_start) +* [Implement FSPagerViewDataSource](#implement_fspagerviewdatasource) +* [Implement FSPagerViewDelegate](#implement_fspagerviewdelegate) + +### 1. Get start + +* Get start with code + +```objc +// Create a pager view +FSPagerView *pagerView = [[FSPagerView alloc] initWithFrame:frame1]; +pagerView.dataSource = self; +pagerView.delegate = self; +[pagerView registerClass:[FSPagerViewCell class] forCellWithReuseIdentifier:@"cell"]; +[self.view addSubview:pagerView]; +// Create a page control +FSPagerControl *pageControl = [[FSPagerControl alloc] initWithFrame:frame2]; +[self.view addSubview:pageControl]; +``` + +* Get start with Interface Builder
+1、Simply drag **UIView** instance into your View Controller, Change the `Custom Class` to `FSPagerView`. (Or `FSPageControl`)
+2、Link the `dataSource` and `delegate` property of **FSPagerView** to your View Controller.
+3、Register a cell class. + +```objc +- (void)viewDidLoad { + [self.pagerView registerClass:[FSPagerViewCell class] forCellWithReuseIdentifier:@"cell"]; +} +``` + + +### 2. Implement FSPagerViewDataSource +```objc +- (NSInteger)numberOfItemsInpagerView:(FSPagerView *)pagerView +{ + return numberOfItems; +} + +- (FSPagerViewCell *)pagerView:(FSPagerView *)pagerView cellForItemAtIndex:(NSInteger)index +{ + FSPagerViewCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"cell" atIndex:index]; + cell.imageView.image = ...; + cell.textLabel.text = ...; + return cell; +} +``` + +### 3. Implement FSPagerViewDelegate + +```objc +- (BOOL)pagerView:(FSPagerView *)pagerView shouldHighlightItemAtIndex:(NSInteger)index; +``` +> Asks the delegate if the item should be highlighted during tracking. + +--- + +```objc +- (void)pagerView:(FSPagerView *)pagerView didHighlightItemAtIndex:(NSInteger)index; +``` +> Tells the delegate that the item at the specified index was highlighted. + +--- + +```objc +- (BOOL)pagerView:(FSPagerView *)pagerView shouldSelectItemAtIndex:(NSInteger)index; +``` +> Asks the delegate if the specified item should be selected. + +--- + +```objc +- (void)pagerView:(FSPagerView *)pagerView didSelectItemAtIndex:(NSInteger)index; +``` +> Tells the delegate that the item at the specified index was selected. + +--- + +```objc +- (void)pagerView:(FSPagerView *)pagerView willDisplayCell:(FSPagerViewCell *)cell forItemAtIndex:(NSInteger)index; +``` +> Tells the delegate that the specified cell is about to be displayed in the pager view. + +--- + +```objc +- (void)pagerView:(FSPagerView *)pagerView didEndDisplayingCell:(FSPagerViewCell *)cell forItemAtIndex:(NSInteger)index; +``` +> Tells the delegate that the specified cell was removed from the pager view. + +--- + +```objc +- (void)pagerViewWillBeginDragging:(FSPagerView *)pagerView; +``` +> Tells the delegate when the pager view is about to start scrolling the content. + +--- + +```objc +- (void)pagerViewWillEndDragging:(FSPagerView *) pagerView targetIndex:(NSInteger)index: +``` +> Tells the delegate when the user finishes scrolling the content. + +--- + +```objc +- (void)pagerViewDidScroll:(FSPagerView *)pagerView; +``` +> Tells the delegate when the user scrolls the content view within the receiver. + +--- + +```objc +- (void)pagerViewDidEndScrollAnimation:(FSPagerView *)pagerView; +``` +> Tells the delegate when a scrolling animation in the pager view concludes. + +--- + +```objc +- (void)pagerViewDidEndDecelerating:(FSPagerView *)pagerView; +``` +> Tells the delegate that the pager view has ended decelerating the scrolling movement. + +--- + +## Support this repo +* ***Star*** this repo star +
+ +* Buy me a ***Coffee***. ☕️ + +   |   +   |   + + +--- + + +## Author +* ***微博:[@WenchaoD](http://weibo.com/WenchaoD)*** +* ***Twitter: [@WenchaoD](https://twitter.com/WenchaoD)*** +* Other repos: + * +***[FSCalendar](https://github.com/WenchaoD/FSCalendar)*** + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9f801a --- /dev/null +++ b/README.md @@ -0,0 +1,380 @@ +# FSPagerView + +| SWIFT | [OBJECTIVE-C](https://github.com/WenchaoD/FSPagerView/blob/master/README-OBJECTIVE-C.md) | +|---|---| + +**FSPagerView** is an elegant Screen Slide Library implemented primarily with ***UICollectionView***. It is extremely helpful for making Banner、Product Show、Welcome Pages、Screen/ViewController Sliders. + +## Features +* ***Infinite*** scrolling. +* ***Automatic*** Sliding. +* Fully customizable item, with predefined banner-style item. +* Fully customizable ***page control***. +* Rich build-in 3D transformers. +* ***Simple*** and ***Delightful*** api usage. +* Support **SWIFT** and **OBJECTIVE-C**. + +## Demos +* [Demo1 - Banner](#banner) +* [Demo2 - Transformer](#transformer) +* [Demo3 - Page Control](#page_control) + +### Demo1 - Banner + +| Banner | +|---| +|![9](https://cloud.githubusercontent.com/assets/5186464/22688057/9003d880-ed65-11e6-882e-4587c97c8878.gif) | + +### automaticSlidingInterval +The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0. + +**e.g.** + +```swift +pagerView.automaticSlidingInterval = 3.0 +``` + + +### isInfinite +A boolean value indicates whether the pager view has infinite number of items. Default is false. + +**e.g.** + +```swift +pagerView.isInfinite = true +``` + +### itemSize +The item size of the pager view. .zero means always fill the bounds of the pager view. Default is .zero. + + +**e.g.** + +```swift +pagerView.itemSize = CGSize(width: 200, height: 180) +``` + +### interitemSpacing +The spacing to use between items in the pager view. Default is 0. + +**e.g.** + +```swift +pagerView.interitemSpacing = 10 +``` + +## Demo2 - Transformers + +|Cross Fading| +|---| +| ![1](https://cloud.githubusercontent.com/assets/5186464/22686429/1983b97e-ed5f-11e6-9a32-44c1830df7ac.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .crossfading) +``` +--- + + + +|Zoom Out| +|---| +| ![2](https://cloud.githubusercontent.com/assets/5186464/22686426/19830862-ed5f-11e6-90be-8fb1319cd125.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .zoomout) +``` +--- + + +|Depth| +|---| +| ![3](https://cloud.githubusercontent.com/assets/5186464/22686430/19856c1a-ed5f-11e6-8187-9e4395b7597c.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .depth) +``` +--- + + +|Linear| +|---| +| ![4](https://cloud.githubusercontent.com/assets/5186464/22686428/198368c0-ed5f-11e6-95df-cfcfe9bc3f29.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .linear) +``` +--- + + +|Overlap| +|---| +| ![5](https://cloud.githubusercontent.com/assets/5186464/22686431/198905aa-ed5f-11e6-9312-ec371c8c4e44.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .overlap) +``` +--- + + +|Ferris Wheel| +|------| +| ![6](https://cloud.githubusercontent.com/assets/5186464/22686427/19831c08-ed5f-11e6-8bdb-30e762a85d4b.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .ferrisWheel) +``` +--- + + +|Inverted Ferris Wheel| +|------| +| ![7](https://cloud.githubusercontent.com/assets/5186464/22686433/19b669a0-ed5f-11e6-8bf0-dc23edf8101f.gif) | + +```swift +pagerView.transformer = FSPagerViewTransformer(type: .invertedFerrisWheel) +``` +--- + + +|Cover Flow| +|------| +| ![8](https://cloud.githubusercontent.com/assets/5186464/22686432/19b567f8-ed5f-11e6-885d-bd660c98b507.gif) | +```swift +pagerView.transformer = FSPagerViewTransformer(type: .coverFlow) +``` +--- + + +> Customize your own transformer by subclassing`FSPagerViewTransformer.` + + +## Demo3 Page Control +|Page Control| +|---| +|![10](https://cloud.githubusercontent.com/assets/5186464/22689720/2baabdb0-ed6d-11e6-8287-ef7a2c0f64bc.gif) +| + +### numberOfPages +The number of page indicators of the page control. Default is 0. + +**e.g.** + +```swift +pageControl.numberOfPages = 5 +``` + +### currentPage +The current page, highlighted by the page control. Default is 0. + +**e.g.** + +```swift +pageControl.currentPage = 1 +``` + +### setStrokeColor:forState: +Sets the stroke color for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```swift +pageControl.setStrokeColor(.green, for: .normal) +pageControl.setStrokeColor(.yellow, for: .selected) +``` + + +### setFillColor:forState: +Sets the fill color for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```swift +pageControl.setFillColor(.gray, for: .normal) +pageControl.setFillColor(.white, for: .selected) +``` + +### setImage:forState: +Sets the image for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```swift +pageControl.setImage(UIImage(named:"image1"), for: .normal) +pageControl.setImage(UIImage(named:"image2"), for: .selected) +``` + +### setPath:forState: +Sets the path for page indicators to use for the specified state. (selected/normal). + +**e.g.** + +```swift +pageControl.setPath(UIBezierPath(rect: CGRect(x: 0, y: 0, width: 8, height: 8)), for: .normal) +pageControl.setPath(UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 8, height: 8)), for: .normal) +``` + +## Installation +* Manually +* Cocoapods + +### Manually +1. ***[Download](#)*** the source code. +2. Extract the zip file, simply drag folder ***FSPagerView*** into your project. +3. Make sure ***Copy items if needed*** is checked. + +### Cocoapods +```ruby +use_frameworks! +pod FSPagerView +``` + +## Tutorial +* [Get start](#get_start) +* [Implement FSPagerViewDataSource](#implement_fspagerviewdatasource) +* [Implement FSPagerViewDelegate](#implement_fspagerviewdelegate) + +### 1. Get start + +* Get start with code + +```swift +// Create a pager view +let pagerView = FSPagerView(frame: frame1) +pagerView.dataSource = self +pagerView.delegate = self +pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell") +self.view.addSubview(pagerView) +// Create a page control +let pageControl = FSPagerControl(frame: frame2) +self.view.addSubview(pageControl) +``` + +* Get start with Interface Builder
+1、Simply drag **UIView** instance into your View Controller, Change the `Custom Class` to `FSPagerView`. (Or `FSPageControl`)
+2、Link the `dataSource` and `delegate` property of **FSPagerView** to your View Controller.
+3、Register a cell class. + +```swift +@IBOutlet weak var pagerView: FSPagerView! { + didSet { + self.pagerView.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell") + } +} +``` + + +### 2. Implement FSPagerViewDataSource +```swift +public func numberOfItems(in pagerView: FSPagerView) -> Int { + return numberOfItems +} + +public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) + cell.imageView?.image = ... + cell.textLabel?.text = ... + return cell +} +``` + +### 3. Implement FSPagerViewDelegate + +```swift +func pagerView(_ pagerView: FSPagerView, shouldHighlightItemAt index: Int) -> Bool +``` +> Asks the delegate if the item should be highlighted during tracking. + +--- + +```swift +func pagerView(_ pagerView: FSPagerView, didHighlightItemAt index: Int) +``` +> Tells the delegate that the item at the specified index was highlighted. + +--- + +```swift +func pagerView(_ pagerView: FSPagerView, shouldSelectItemAt index: Int) -> Bool +``` +> Asks the delegate if the specified item should be selected. + +--- + +```swift +func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) +``` +> Tells the delegate that the item at the specified index was selected. + +--- + +```swift +func pagerView(_ pagerView: FSPagerView, willDisplay cell: FSPagerViewCell, forItemAt index: Int) +``` +> Tells the delegate that the specified cell is about to be displayed in the pager view. + +--- + +```swift +func pagerView(_ pagerView: FSPagerView, didEndDisplaying cell: FSPagerViewCell, forItemAt index: Int) +``` +> Tells the delegate that the specified cell was removed from the pager view. + +--- + +```swift +func pagerViewWillBeginDragging(_ pagerView: FSPagerView) +``` +> Tells the delegate when the pager view is about to start scrolling the content. + +--- + +```swift +func pagerViewWillEndDragging(_ pagerView: FSPagerView, targetIndex: Int) +``` +> Tells the delegate when the user finishes scrolling the content. + +--- + +```swift +func pagerViewDidScroll(_ pagerView: FSPagerView) +``` +> Tells the delegate when the user scrolls the content view within the receiver. + +--- + +```swift +func pagerViewDidEndScrollAnimation(_ pagerView: FSPagerView) +``` +> Tells the delegate when a scrolling animation in the pager view concludes. + +--- + +```swift +func pagerViewDidEndDecelerating(_ pagerView: FSPagerView) +``` +> Tells the delegate that the pager view has ended decelerating the scrolling movement. + +--- + +## Support this repo +* ***Star*** this repo star +
+ +* Buy me a Coffee. ☕️ + +   |   +   |   + + +--- + + +## Author +* ***微博:[@WenchaoD](http://weibo.com/WenchaoD)*** +* ***Twitter: [@WenchaoD](https://twitter.com/WenchaoD)*** +* Other repos: + * +***[FSCalendar](https://github.com/WenchaoD/FSCalendar)*** + + + diff --git a/Resources/1.jpg b/Resources/1.jpg new file mode 100644 index 0000000..1c4c56c Binary files /dev/null and b/Resources/1.jpg differ diff --git a/Resources/1_1.jpg b/Resources/1_1.jpg new file mode 100644 index 0000000..0fd3ef6 Binary files /dev/null and b/Resources/1_1.jpg differ diff --git a/Resources/1_2.jpg b/Resources/1_2.jpg new file mode 100644 index 0000000..9c2e3a7 Binary files /dev/null and b/Resources/1_2.jpg differ diff --git a/Resources/1_3.jpg b/Resources/1_3.jpg new file mode 100644 index 0000000..63de204 Binary files /dev/null and b/Resources/1_3.jpg differ diff --git a/Resources/1_4.jpg b/Resources/1_4.jpg new file mode 100644 index 0000000..49ef488 Binary files /dev/null and b/Resources/1_4.jpg differ diff --git a/Resources/1_5.jpg b/Resources/1_5.jpg new file mode 100644 index 0000000..02e0d94 Binary files /dev/null and b/Resources/1_5.jpg differ diff --git a/Resources/1_6.jpg b/Resources/1_6.jpg new file mode 100644 index 0000000..84df575 Binary files /dev/null and b/Resources/1_6.jpg differ diff --git a/Resources/1_7.jpg b/Resources/1_7.jpg new file mode 100644 index 0000000..48bcaff Binary files /dev/null and b/Resources/1_7.jpg differ diff --git a/Resources/2.jpg b/Resources/2.jpg new file mode 100644 index 0000000..3b2d52c Binary files /dev/null and b/Resources/2.jpg differ diff --git a/Resources/3.jpg b/Resources/3.jpg new file mode 100644 index 0000000..50fca81 Binary files /dev/null and b/Resources/3.jpg differ diff --git a/Resources/4.jpg b/Resources/4.jpg new file mode 100644 index 0000000..3df0d4c Binary files /dev/null and b/Resources/4.jpg differ diff --git a/Resources/5.jpg b/Resources/5.jpg new file mode 100644 index 0000000..e4b3c2d Binary files /dev/null and b/Resources/5.jpg differ diff --git a/Resources/6.jpg b/Resources/6.jpg new file mode 100644 index 0000000..beabfee Binary files /dev/null and b/Resources/6.jpg differ diff --git a/Resources/7.jpg b/Resources/7.jpg new file mode 100644 index 0000000..d6daa09 Binary files /dev/null and b/Resources/7.jpg differ diff --git a/Resources/background.jpg b/Resources/background.jpg new file mode 100644 index 0000000..740f0b3 Binary files /dev/null and b/Resources/background.jpg differ