├── .gitignore ├── .travis.yml ├── Example ├── GYPageViewController.swift ├── GYPageViewController.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── GYPageViewController-Example.xcscheme ├── GYPageViewController.xcworkspace │ └── contents.xcworkspacedata ├── GYPageViewController │ ├── AppDelegate.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Info.plist │ ├── LaunchScreen.storyboard │ ├── Main.storyboard │ ├── TestChildViewController.swift │ ├── TestUIPageViewController.swift │ └── ViewController.swift ├── GYTabPageViewController-ScreenShot.png ├── GYTabPageViewController.swift ├── NSArray+RemoveConstraints.swift ├── NSLayoutConstraint+RemoveConstraints.swift ├── Podfile ├── Podfile.lock ├── Pods │ ├── HMSegmentedControl │ │ ├── HMSegmentedControl │ │ │ ├── HMSegmentedControl.h │ │ │ └── HMSegmentedControl.m │ │ ├── LICENSE.md │ │ └── README.md │ ├── Headers │ │ └── Private │ │ │ └── HMSegmentedControl │ │ │ └── HMSegmentedControl.h │ ├── Local Podspecs │ │ └── GYPageViewController.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── GYPageViewController.xcscheme │ └── Target Support Files │ │ ├── HMSegmentedControl │ │ ├── HMSegmentedControl-dummy.m │ │ ├── HMSegmentedControl-prefix.pch │ │ ├── HMSegmentedControl-umbrella.h │ │ ├── HMSegmentedControl.modulemap │ │ ├── HMSegmentedControl.xcconfig │ │ └── Info.plist │ │ └── Pods-GYPageViewController_Example │ │ ├── Info.plist │ │ ├── Pods-GYPageViewController_Example-acknowledgements.markdown │ │ ├── Pods-GYPageViewController_Example-acknowledgements.plist │ │ ├── Pods-GYPageViewController_Example-dummy.m │ │ ├── Pods-GYPageViewController_Example-frameworks.sh │ │ ├── Pods-GYPageViewController_Example-resources.sh │ │ ├── Pods-GYPageViewController_Example-umbrella.h │ │ ├── Pods-GYPageViewController_Example.debug.xcconfig │ │ ├── Pods-GYPageViewController_Example.modulemap │ │ └── Pods-GYPageViewController_Example.release.xcconfig ├── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ │ └── InfoPlist.strings ├── UIView+GYPauseAnimation.swift ├── UIView+RemoveConstraints.swift └── UIViewController+ChildController.swift ├── GYPageViewController.podspec ├── GYPageViewController ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── GYPageViewController.swift │ ├── GYTabPageViewController.swift │ ├── NSArray+RemoveConstraints.swift │ ├── NSLayoutConstraint+RemoveConstraints.swift │ ├── UIView+GYPauseAnimation.swift │ ├── UIView+RemoveConstraints.swift │ └── UIViewController+ChildController.swift ├── LICENSE ├── README.md └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | # Pods/ 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -workspace Example/GYPageViewController.xcworkspace -scheme GYPageViewController-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/GYPageViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 11 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 12 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 13 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 14 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 15 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 16 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 17 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 18 | 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 19 | 73BCC9591D1809CB00F8DFCA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9561D1809CB00F8DFCA /* ViewController.swift */; }; 20 | 73BCC95A1D1809CB00F8DFCA /* TestChildViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9571D1809CB00F8DFCA /* TestChildViewController.swift */; }; 21 | 73BCC95B1D1809CB00F8DFCA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9581D1809CB00F8DFCA /* AppDelegate.swift */; }; 22 | 73BCC95D1D180A5700F8DFCA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73BCC95C1D180A5700F8DFCA /* Main.storyboard */; }; 23 | 73BCC9671D18164F00F8DFCA /* GYPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9601D18164F00F8DFCA /* GYPageViewController.swift */; }; 24 | 73BCC9681D18164F00F8DFCA /* GYTabPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9611D18164F00F8DFCA /* GYTabPageViewController.swift */; }; 25 | 73BCC9691D18164F00F8DFCA /* UIView+GYPauseAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9621D18164F00F8DFCA /* UIView+GYPauseAnimation.swift */; }; 26 | 73BCC96A1D18164F00F8DFCA /* UIView+RemoveConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9631D18164F00F8DFCA /* UIView+RemoveConstraints.swift */; }; 27 | 73BCC96B1D18164F00F8DFCA /* NSLayoutConstraint+RemoveConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9641D18164F00F8DFCA /* NSLayoutConstraint+RemoveConstraints.swift */; }; 28 | 73BCC96C1D18164F00F8DFCA /* NSArray+RemoveConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9651D18164F00F8DFCA /* NSArray+RemoveConstraints.swift */; }; 29 | 73BCC96D1D18164F00F8DFCA /* UIViewController+ChildController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BCC9661D18164F00F8DFCA /* UIViewController+ChildController.swift */; }; 30 | 73BCC9711D1817A800F8DFCA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73BCC96F1D1817A800F8DFCA /* LaunchScreen.storyboard */; }; 31 | 73BCC9721D1817A800F8DFCA /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 73BCC9701D1817A800F8DFCA /* Info.plist */; }; 32 | 73BF4D9C1D2E360900891F72 /* TestUIPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BF4D9B1D2E360900891F72 /* TestUIPageViewController.swift */; }; 33 | 73C589A11D20C1E800395AA0 /* GYTabPageViewController-ScreenShot.png in Resources */ = {isa = PBXBuildFile; fileRef = 73C589A01D20C1E800395AA0 /* GYTabPageViewController-ScreenShot.png */; }; 34 | DABEFF1BD4D19F08ED9BFFA6 /* Pods_GYPageViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F58BEF09F998562843169A45 /* Pods_GYPageViewController_Example.framework */; }; 35 | /* End PBXBuildFile section */ 36 | 37 | /* Begin PBXContainerItemProxy section */ 38 | 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = 6003F582195388D10070C39A /* Project object */; 41 | proxyType = 1; 42 | remoteGlobalIDString = 6003F589195388D20070C39A; 43 | remoteInfo = GYPageViewController; 44 | }; 45 | /* End PBXContainerItemProxy section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | 0A019E31992714A3D0BA2AF7 /* Pods-GYPageViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GYPageViewController_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.release.xcconfig"; sourceTree = ""; }; 49 | 3B42835A9951DB4C27FE47A9 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 50 | 6003F58A195388D20070C39A /* GYPageViewController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GYPageViewController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 52 | 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 53 | 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 54 | 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 55 | 6003F5AE195388D20070C39A /* GYPageViewController_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GYPageViewController_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 57 | 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 58 | 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 59 | 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 60 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; 61 | 63816B7BDB9D262BF89CFC29 /* Pods-GYPageViewController_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GYPageViewController_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.debug.xcconfig"; sourceTree = ""; }; 62 | 73BCC9561D1809CB00F8DFCA /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 63 | 73BCC9571D1809CB00F8DFCA /* TestChildViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestChildViewController.swift; sourceTree = ""; }; 64 | 73BCC9581D1809CB00F8DFCA /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 65 | 73BCC95C1D180A5700F8DFCA /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = GYPageViewController/Main.storyboard; sourceTree = ""; }; 66 | 73BCC9601D18164F00F8DFCA /* GYPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GYPageViewController.swift; sourceTree = ""; }; 67 | 73BCC9611D18164F00F8DFCA /* GYTabPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GYTabPageViewController.swift; sourceTree = ""; }; 68 | 73BCC9621D18164F00F8DFCA /* UIView+GYPauseAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+GYPauseAnimation.swift"; sourceTree = ""; }; 69 | 73BCC9631D18164F00F8DFCA /* UIView+RemoveConstraints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+RemoveConstraints.swift"; sourceTree = ""; }; 70 | 73BCC9641D18164F00F8DFCA /* NSLayoutConstraint+RemoveConstraints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraint+RemoveConstraints.swift"; sourceTree = ""; }; 71 | 73BCC9651D18164F00F8DFCA /* NSArray+RemoveConstraints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSArray+RemoveConstraints.swift"; sourceTree = ""; }; 72 | 73BCC9661D18164F00F8DFCA /* UIViewController+ChildController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+ChildController.swift"; sourceTree = ""; }; 73 | 73BCC96F1D1817A800F8DFCA /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 74 | 73BCC9701D1817A800F8DFCA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 75 | 73BF4D9B1D2E360900891F72 /* TestUIPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestUIPageViewController.swift; sourceTree = ""; }; 76 | 73C589A01D20C1E800395AA0 /* GYTabPageViewController-ScreenShot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "GYTabPageViewController-ScreenShot.png"; sourceTree = ""; }; 77 | B0EE2A99C99DC3F41B5C4F67 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 78 | E67BEEE8A37DE3966F311912 /* GYPageViewController.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = GYPageViewController.podspec; path = ../../GYPageViewController.podspec; sourceTree = ""; }; 79 | F58BEF09F998562843169A45 /* Pods_GYPageViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GYPageViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | /* End PBXFileReference section */ 81 | 82 | /* Begin PBXFrameworksBuildPhase section */ 83 | 6003F587195388D20070C39A /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 88 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 89 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, 90 | DABEFF1BD4D19F08ED9BFFA6 /* Pods_GYPageViewController_Example.framework in Frameworks */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | 6003F5AB195388D20070C39A /* Frameworks */ = { 95 | isa = PBXFrameworksBuildPhase; 96 | buildActionMask = 2147483647; 97 | files = ( 98 | 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 99 | 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 100 | 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | 202E1818D1C05E3739CAB204 /* Pods */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 63816B7BDB9D262BF89CFC29 /* Pods-GYPageViewController_Example.debug.xcconfig */, 111 | 0A019E31992714A3D0BA2AF7 /* Pods-GYPageViewController_Example.release.xcconfig */, 112 | ); 113 | name = Pods; 114 | sourceTree = ""; 115 | }; 116 | 6003F581195388D10070C39A = { 117 | isa = PBXGroup; 118 | children = ( 119 | 73C5899F1D20C1D700395AA0 /* ScreenShot */, 120 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, 121 | 6003F593195388D20070C39A /* Example for GYPageViewController */, 122 | 6003F5B5195388D20070C39A /* Tests */, 123 | 73BCC95C1D180A5700F8DFCA /* Main.storyboard */, 124 | 6003F58C195388D20070C39A /* Frameworks */, 125 | 6003F58B195388D20070C39A /* Products */, 126 | 202E1818D1C05E3739CAB204 /* Pods */, 127 | ); 128 | sourceTree = ""; 129 | }; 130 | 6003F58B195388D20070C39A /* Products */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 6003F58A195388D20070C39A /* GYPageViewController_Example.app */, 134 | 6003F5AE195388D20070C39A /* GYPageViewController_Tests.xctest */, 135 | ); 136 | name = Products; 137 | sourceTree = ""; 138 | }; 139 | 6003F58C195388D20070C39A /* Frameworks */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 6003F58D195388D20070C39A /* Foundation.framework */, 143 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, 144 | 6003F591195388D20070C39A /* UIKit.framework */, 145 | 6003F5AF195388D20070C39A /* XCTest.framework */, 146 | F58BEF09F998562843169A45 /* Pods_GYPageViewController_Example.framework */, 147 | ); 148 | name = Frameworks; 149 | sourceTree = ""; 150 | }; 151 | 6003F593195388D20070C39A /* Example for GYPageViewController */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | E67BEEE8A37DE3966F311912 /* GYPageViewController.podspec */, 155 | 73BCC96F1D1817A800F8DFCA /* LaunchScreen.storyboard */, 156 | 73BCC9701D1817A800F8DFCA /* Info.plist */, 157 | 73BCC9561D1809CB00F8DFCA /* ViewController.swift */, 158 | 73BCC9571D1809CB00F8DFCA /* TestChildViewController.swift */, 159 | 73BF4D9B1D2E360900891F72 /* TestUIPageViewController.swift */, 160 | 73BCC9581D1809CB00F8DFCA /* AppDelegate.swift */, 161 | 6003F5A8195388D20070C39A /* Images.xcassets */, 162 | ); 163 | name = "Example for GYPageViewController"; 164 | path = GYPageViewController; 165 | sourceTree = ""; 166 | }; 167 | 6003F5B5195388D20070C39A /* Tests */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 6003F5BB195388D20070C39A /* Tests.m */, 171 | 6003F5B6195388D20070C39A /* Supporting Files */, 172 | ); 173 | path = Tests; 174 | sourceTree = ""; 175 | }; 176 | 6003F5B6195388D20070C39A /* Supporting Files */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 6003F5B7195388D20070C39A /* Tests-Info.plist */, 180 | 6003F5B8195388D20070C39A /* InfoPlist.strings */, 181 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, 182 | ); 183 | name = "Supporting Files"; 184 | sourceTree = ""; 185 | }; 186 | 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | 73BCC96E1D18165600F8DFCA /* Classes */, 190 | 3B42835A9951DB4C27FE47A9 /* README.md */, 191 | B0EE2A99C99DC3F41B5C4F67 /* LICENSE */, 192 | ); 193 | name = "Podspec Metadata"; 194 | sourceTree = ""; 195 | }; 196 | 73BCC96E1D18165600F8DFCA /* Classes */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | 73BCC9601D18164F00F8DFCA /* GYPageViewController.swift */, 200 | 73BCC9611D18164F00F8DFCA /* GYTabPageViewController.swift */, 201 | 73BCC9621D18164F00F8DFCA /* UIView+GYPauseAnimation.swift */, 202 | 73BCC9631D18164F00F8DFCA /* UIView+RemoveConstraints.swift */, 203 | 73BCC9641D18164F00F8DFCA /* NSLayoutConstraint+RemoveConstraints.swift */, 204 | 73BCC9651D18164F00F8DFCA /* NSArray+RemoveConstraints.swift */, 205 | 73BCC9661D18164F00F8DFCA /* UIViewController+ChildController.swift */, 206 | ); 207 | name = Classes; 208 | sourceTree = ""; 209 | }; 210 | 73C5899F1D20C1D700395AA0 /* ScreenShot */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | 73C589A01D20C1E800395AA0 /* GYTabPageViewController-ScreenShot.png */, 214 | ); 215 | name = ScreenShot; 216 | sourceTree = ""; 217 | }; 218 | /* End PBXGroup section */ 219 | 220 | /* Begin PBXNativeTarget section */ 221 | 6003F589195388D20070C39A /* GYPageViewController_Example */ = { 222 | isa = PBXNativeTarget; 223 | buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "GYPageViewController_Example" */; 224 | buildPhases = ( 225 | 2ED6AB875F61572338882A97 /* Check Pods Manifest.lock */, 226 | 6003F586195388D20070C39A /* Sources */, 227 | 6003F587195388D20070C39A /* Frameworks */, 228 | 6003F588195388D20070C39A /* Resources */, 229 | 6F7058DD32018146CE5D1779 /* Embed Pods Frameworks */, 230 | 5A53C1F1DEBC9B14FDA83B88 /* Copy Pods Resources */, 231 | ); 232 | buildRules = ( 233 | ); 234 | dependencies = ( 235 | ); 236 | name = GYPageViewController_Example; 237 | productName = GYPageViewController; 238 | productReference = 6003F58A195388D20070C39A /* GYPageViewController_Example.app */; 239 | productType = "com.apple.product-type.application"; 240 | }; 241 | 6003F5AD195388D20070C39A /* GYPageViewController_Tests */ = { 242 | isa = PBXNativeTarget; 243 | buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "GYPageViewController_Tests" */; 244 | buildPhases = ( 245 | 6003F5AA195388D20070C39A /* Sources */, 246 | 6003F5AB195388D20070C39A /* Frameworks */, 247 | 6003F5AC195388D20070C39A /* Resources */, 248 | ); 249 | buildRules = ( 250 | ); 251 | dependencies = ( 252 | 6003F5B4195388D20070C39A /* PBXTargetDependency */, 253 | ); 254 | name = GYPageViewController_Tests; 255 | productName = GYPageViewControllerTests; 256 | productReference = 6003F5AE195388D20070C39A /* GYPageViewController_Tests.xctest */; 257 | productType = "com.apple.product-type.bundle.unit-test"; 258 | }; 259 | /* End PBXNativeTarget section */ 260 | 261 | /* Begin PBXProject section */ 262 | 6003F582195388D10070C39A /* Project object */ = { 263 | isa = PBXProject; 264 | attributes = { 265 | CLASSPREFIX = Example; 266 | LastSwiftUpdateCheck = 0730; 267 | LastUpgradeCheck = 0720; 268 | ORGANIZATIONNAME = GaoYu; 269 | TargetAttributes = { 270 | 6003F589195388D20070C39A = { 271 | DevelopmentTeam = 35B2KE884X; 272 | LastSwiftMigration = 0800; 273 | }; 274 | 6003F5AD195388D20070C39A = { 275 | TestTargetID = 6003F589195388D20070C39A; 276 | }; 277 | }; 278 | }; 279 | buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "GYPageViewController" */; 280 | compatibilityVersion = "Xcode 3.2"; 281 | developmentRegion = English; 282 | hasScannedForEncodings = 0; 283 | knownRegions = ( 284 | en, 285 | Base, 286 | ); 287 | mainGroup = 6003F581195388D10070C39A; 288 | productRefGroup = 6003F58B195388D20070C39A /* Products */; 289 | projectDirPath = ""; 290 | projectRoot = ""; 291 | targets = ( 292 | 6003F589195388D20070C39A /* GYPageViewController_Example */, 293 | 6003F5AD195388D20070C39A /* GYPageViewController_Tests */, 294 | ); 295 | }; 296 | /* End PBXProject section */ 297 | 298 | /* Begin PBXResourcesBuildPhase section */ 299 | 6003F588195388D20070C39A /* Resources */ = { 300 | isa = PBXResourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 73BCC9721D1817A800F8DFCA /* Info.plist in Resources */, 304 | 73BCC9711D1817A800F8DFCA /* LaunchScreen.storyboard in Resources */, 305 | 73BCC95D1D180A5700F8DFCA /* Main.storyboard in Resources */, 306 | 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 307 | 73C589A11D20C1E800395AA0 /* GYTabPageViewController-ScreenShot.png in Resources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 6003F5AC195388D20070C39A /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | /* End PBXResourcesBuildPhase section */ 320 | 321 | /* Begin PBXShellScriptBuildPhase section */ 322 | 2ED6AB875F61572338882A97 /* Check Pods Manifest.lock */ = { 323 | isa = PBXShellScriptBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | inputPaths = ( 328 | ); 329 | name = "Check Pods Manifest.lock"; 330 | outputPaths = ( 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | shellPath = /bin/sh; 334 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 335 | showEnvVarsInLog = 0; 336 | }; 337 | 5A53C1F1DEBC9B14FDA83B88 /* Copy Pods Resources */ = { 338 | isa = PBXShellScriptBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | ); 342 | inputPaths = ( 343 | ); 344 | name = "Copy Pods Resources"; 345 | outputPaths = ( 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | shellPath = /bin/sh; 349 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-resources.sh\"\n"; 350 | showEnvVarsInLog = 0; 351 | }; 352 | 6F7058DD32018146CE5D1779 /* Embed Pods Frameworks */ = { 353 | isa = PBXShellScriptBuildPhase; 354 | buildActionMask = 2147483647; 355 | files = ( 356 | ); 357 | inputPaths = ( 358 | ); 359 | name = "Embed Pods Frameworks"; 360 | outputPaths = ( 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | shellPath = /bin/sh; 364 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-frameworks.sh\"\n"; 365 | showEnvVarsInLog = 0; 366 | }; 367 | /* End PBXShellScriptBuildPhase section */ 368 | 369 | /* Begin PBXSourcesBuildPhase section */ 370 | 6003F586195388D20070C39A /* Sources */ = { 371 | isa = PBXSourcesBuildPhase; 372 | buildActionMask = 2147483647; 373 | files = ( 374 | 73BCC95B1D1809CB00F8DFCA /* AppDelegate.swift in Sources */, 375 | 73BCC9671D18164F00F8DFCA /* GYPageViewController.swift in Sources */, 376 | 73BF4D9C1D2E360900891F72 /* TestUIPageViewController.swift in Sources */, 377 | 73BCC96D1D18164F00F8DFCA /* UIViewController+ChildController.swift in Sources */, 378 | 73BCC95A1D1809CB00F8DFCA /* TestChildViewController.swift in Sources */, 379 | 73BCC96C1D18164F00F8DFCA /* NSArray+RemoveConstraints.swift in Sources */, 380 | 73BCC96A1D18164F00F8DFCA /* UIView+RemoveConstraints.swift in Sources */, 381 | 73BCC9691D18164F00F8DFCA /* UIView+GYPauseAnimation.swift in Sources */, 382 | 73BCC9681D18164F00F8DFCA /* GYTabPageViewController.swift in Sources */, 383 | 73BCC9591D1809CB00F8DFCA /* ViewController.swift in Sources */, 384 | 73BCC96B1D18164F00F8DFCA /* NSLayoutConstraint+RemoveConstraints.swift in Sources */, 385 | ); 386 | runOnlyForDeploymentPostprocessing = 0; 387 | }; 388 | 6003F5AA195388D20070C39A /* Sources */ = { 389 | isa = PBXSourcesBuildPhase; 390 | buildActionMask = 2147483647; 391 | files = ( 392 | 6003F5BC195388D20070C39A /* Tests.m in Sources */, 393 | ); 394 | runOnlyForDeploymentPostprocessing = 0; 395 | }; 396 | /* End PBXSourcesBuildPhase section */ 397 | 398 | /* Begin PBXTargetDependency section */ 399 | 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { 400 | isa = PBXTargetDependency; 401 | target = 6003F589195388D20070C39A /* GYPageViewController_Example */; 402 | targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; 403 | }; 404 | /* End PBXTargetDependency section */ 405 | 406 | /* Begin PBXVariantGroup section */ 407 | 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { 408 | isa = PBXVariantGroup; 409 | children = ( 410 | 6003F5B9195388D20070C39A /* en */, 411 | ); 412 | name = InfoPlist.strings; 413 | sourceTree = ""; 414 | }; 415 | /* End PBXVariantGroup section */ 416 | 417 | /* Begin XCBuildConfiguration section */ 418 | 6003F5BD195388D20070C39A /* Debug */ = { 419 | isa = XCBuildConfiguration; 420 | buildSettings = { 421 | ALWAYS_SEARCH_USER_PATHS = NO; 422 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 423 | CLANG_CXX_LIBRARY = "libc++"; 424 | CLANG_ENABLE_MODULES = YES; 425 | CLANG_ENABLE_OBJC_ARC = YES; 426 | CLANG_WARN_BOOL_CONVERSION = YES; 427 | CLANG_WARN_CONSTANT_CONVERSION = YES; 428 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 429 | CLANG_WARN_EMPTY_BODY = YES; 430 | CLANG_WARN_ENUM_CONVERSION = YES; 431 | CLANG_WARN_INT_CONVERSION = YES; 432 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 433 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 434 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 435 | COPY_PHASE_STRIP = NO; 436 | ENABLE_TESTABILITY = YES; 437 | GCC_C_LANGUAGE_STANDARD = gnu99; 438 | GCC_DYNAMIC_NO_PIC = NO; 439 | GCC_OPTIMIZATION_LEVEL = 0; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 452 | ONLY_ACTIVE_ARCH = YES; 453 | SDKROOT = iphoneos; 454 | TARGETED_DEVICE_FAMILY = "1,2"; 455 | }; 456 | name = Debug; 457 | }; 458 | 6003F5BE195388D20070C39A /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ALWAYS_SEARCH_USER_PATHS = NO; 462 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 463 | CLANG_CXX_LIBRARY = "libc++"; 464 | CLANG_ENABLE_MODULES = YES; 465 | CLANG_ENABLE_OBJC_ARC = YES; 466 | CLANG_WARN_BOOL_CONVERSION = YES; 467 | CLANG_WARN_CONSTANT_CONVERSION = YES; 468 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 469 | CLANG_WARN_EMPTY_BODY = YES; 470 | CLANG_WARN_ENUM_CONVERSION = YES; 471 | CLANG_WARN_INT_CONVERSION = YES; 472 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 473 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 474 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 475 | COPY_PHASE_STRIP = YES; 476 | ENABLE_NS_ASSERTIONS = NO; 477 | GCC_C_LANGUAGE_STANDARD = gnu99; 478 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 479 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 480 | GCC_WARN_UNDECLARED_SELECTOR = YES; 481 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 482 | GCC_WARN_UNUSED_FUNCTION = YES; 483 | GCC_WARN_UNUSED_VARIABLE = YES; 484 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 485 | SDKROOT = iphoneos; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | VALIDATE_PRODUCT = YES; 488 | }; 489 | name = Release; 490 | }; 491 | 6003F5C0195388D20070C39A /* Debug */ = { 492 | isa = XCBuildConfiguration; 493 | baseConfigurationReference = 63816B7BDB9D262BF89CFC29 /* Pods-GYPageViewController_Example.debug.xcconfig */; 494 | buildSettings = { 495 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 496 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 497 | CLANG_ENABLE_MODULES = YES; 498 | CODE_SIGN_IDENTITY = "iPhone Developer"; 499 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 500 | GCC_PREFIX_HEADER = "GYPageViewController/GYPageViewController-Prefix.pch"; 501 | INFOPLIST_FILE = GYPageViewController/Info.plist; 502 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 503 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 504 | MODULE_NAME = ExampleApp; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.netease.gold; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SWIFT_OBJC_BRIDGING_HEADER = ""; 508 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 509 | SWIFT_VERSION = 3.0; 510 | WRAPPER_EXTENSION = app; 511 | }; 512 | name = Debug; 513 | }; 514 | 6003F5C1195388D20070C39A /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | baseConfigurationReference = 0A019E31992714A3D0BA2AF7 /* Pods-GYPageViewController_Example.release.xcconfig */; 517 | buildSettings = { 518 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 519 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 520 | CLANG_ENABLE_MODULES = YES; 521 | CODE_SIGN_IDENTITY = "iPhone Developer"; 522 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 523 | GCC_PREFIX_HEADER = "GYPageViewController/GYPageViewController-Prefix.pch"; 524 | INFOPLIST_FILE = GYPageViewController/Info.plist; 525 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 527 | MODULE_NAME = ExampleApp; 528 | PRODUCT_BUNDLE_IDENTIFIER = com.netease.gold; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | SWIFT_OBJC_BRIDGING_HEADER = ""; 531 | SWIFT_VERSION = 3.0; 532 | WRAPPER_EXTENSION = app; 533 | }; 534 | name = Release; 535 | }; 536 | 6003F5C3195388D20070C39A /* Debug */ = { 537 | isa = XCBuildConfiguration; 538 | buildSettings = { 539 | BUNDLE_LOADER = "$(TEST_HOST)"; 540 | FRAMEWORK_SEARCH_PATHS = ( 541 | "$(SDKROOT)/Developer/Library/Frameworks", 542 | "$(inherited)", 543 | "$(DEVELOPER_FRAMEWORKS_DIR)", 544 | ); 545 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 546 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 547 | GCC_PREPROCESSOR_DEFINITIONS = ( 548 | "DEBUG=1", 549 | "$(inherited)", 550 | ); 551 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 552 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 553 | PRODUCT_NAME = "$(TARGET_NAME)"; 554 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GYPageViewController_Example.app/GYPageViewController_Example"; 555 | WRAPPER_EXTENSION = xctest; 556 | }; 557 | name = Debug; 558 | }; 559 | 6003F5C4195388D20070C39A /* Release */ = { 560 | isa = XCBuildConfiguration; 561 | buildSettings = { 562 | BUNDLE_LOADER = "$(TEST_HOST)"; 563 | FRAMEWORK_SEARCH_PATHS = ( 564 | "$(SDKROOT)/Developer/Library/Frameworks", 565 | "$(inherited)", 566 | "$(DEVELOPER_FRAMEWORKS_DIR)", 567 | ); 568 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 569 | GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; 570 | INFOPLIST_FILE = "Tests/Tests-Info.plist"; 571 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; 572 | PRODUCT_NAME = "$(TARGET_NAME)"; 573 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GYPageViewController_Example.app/GYPageViewController_Example"; 574 | WRAPPER_EXTENSION = xctest; 575 | }; 576 | name = Release; 577 | }; 578 | /* End XCBuildConfiguration section */ 579 | 580 | /* Begin XCConfigurationList section */ 581 | 6003F585195388D10070C39A /* Build configuration list for PBXProject "GYPageViewController" */ = { 582 | isa = XCConfigurationList; 583 | buildConfigurations = ( 584 | 6003F5BD195388D20070C39A /* Debug */, 585 | 6003F5BE195388D20070C39A /* Release */, 586 | ); 587 | defaultConfigurationIsVisible = 0; 588 | defaultConfigurationName = Release; 589 | }; 590 | 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "GYPageViewController_Example" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | 6003F5C0195388D20070C39A /* Debug */, 594 | 6003F5C1195388D20070C39A /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "GYPageViewController_Tests" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 6003F5C3195388D20070C39A /* Debug */, 603 | 6003F5C4195388D20070C39A /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | /* End XCConfigurationList section */ 609 | }; 610 | rootObject = 6003F582195388D10070C39A /* Project object */; 611 | } 612 | -------------------------------------------------------------------------------- /Example/GYPageViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/GYPageViewController.xcodeproj/xcshareddata/xcschemes/GYPageViewController-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/GYPageViewController.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/GYPageViewController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/6/12. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/GYPageViewController/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /Example/GYPageViewController/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Example/GYPageViewController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/GYPageViewController/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/GYPageViewController/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Example/GYPageViewController/TestChildViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestChildViewController.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/6/12. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TestChildViewController: UIViewController { 12 | 13 | var pageIndex = 0 14 | 15 | //MARK: - Life cycles 16 | @objc override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | self.view.alpha = 0.5 20 | } 21 | 22 | @objc override func viewWillAppear(_ animated: Bool) { 23 | super.viewWillAppear(animated) 24 | 25 | print("Will Appear : \(pageIndex)") 26 | } 27 | 28 | @objc override func viewDidAppear(_ animated: Bool) { 29 | super.viewDidAppear(animated) 30 | print("Did Appear : \(pageIndex)") 31 | } 32 | 33 | @objc override func viewWillDisappear(_ animated: Bool) { 34 | super.viewWillDisappear(animated) 35 | print("Will Disappear : \(pageIndex)") 36 | } 37 | 38 | @objc override func viewDidDisappear(_ animated: Bool) { 39 | super.viewDidDisappear(animated) 40 | print("Did Disappear : \(pageIndex)") 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Example/GYPageViewController/TestUIPageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestUIPageViewController.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/7/3. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import HMSegmentedControl 11 | 12 | class TestPageViewController: UIViewController, UIPageViewControllerDelegate, UIPageViewControllerDataSource { 13 | var segmentedControl:HMSegmentedControl? 14 | var pageTitles:Array! 15 | var segmentHeight = 44.0 16 | var selectedIndex:Int = 0 17 | 18 | lazy var pageViewController:UIPageViewController = { 19 | let pvc = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil) 20 | pvc.delegate = self 21 | pvc.dataSource = self 22 | return pvc 23 | }() 24 | 25 | private(set) var pageControllers:Array! 26 | 27 | required init?(coder aDecoder: NSCoder) { 28 | fatalError("init(coder:) has not been implemented") 29 | } 30 | 31 | init(pageTitles:Array,pageControllers:Array) { 32 | super.init(nibName: nil, bundle: nil) 33 | 34 | self.pageControllers = pageControllers 35 | assert((pageTitles.count == pageControllers.count), "title count is not equal controllers count") 36 | 37 | self.pageTitles = pageTitles 38 | if self.pageTitles.count > 1 { 39 | self.segmentedControl = HMSegmentedControl(sectionTitles: self.pageTitles) 40 | self.setupSegmentedControl(segmentedControl: self.segmentedControl) 41 | } 42 | 43 | 44 | } 45 | 46 | override func viewDidLoad() { 47 | super.viewDidLoad() 48 | self.view.backgroundColor = UIColor.white 49 | 50 | self.layoutSegmentedControl(segmentedControl: self.segmentedControl) 51 | 52 | self.addChildViewController(self.pageViewController) 53 | var newFrame = self.view.frame 54 | newFrame.size.height -= 44 55 | newFrame.origin.y = 108 56 | self.pageViewController.view.frame = newFrame 57 | self.view.addSubview(self.pageViewController.view) 58 | self.pageViewController.didMove(toParentViewController: self) 59 | 60 | // var constraints = Array() 61 | // let constraintAttributes = Array(arrayLiteral: .Bottom,.Leading,.Trailing) 62 | // 63 | // let topConstraint = NSLayoutConstraint(item: self.pageViewController.view, 64 | // attribute: .Top, 65 | // relatedBy: .Equal, 66 | // toItem: self.segmentedControl, 67 | // attribute: .Bottom, 68 | // multiplier: 1, 69 | // constant: 500) 70 | // constraints.append(topConstraint) 71 | // 72 | // for attribute in constraintAttributes { 73 | // let constraint = NSLayoutConstraint(item: self.pageViewController.view, 74 | // attribute: attribute, 75 | // relatedBy: .Equal, 76 | // toItem: self.view, 77 | // attribute: attribute, 78 | // multiplier: 1.0, 79 | // constant: 0) 80 | // constraints.append(constraint) 81 | // } 82 | // self.view.addConstraints(constraints) 83 | } 84 | 85 | @objc private func layoutSegmentedControl(segmentedControl:HMSegmentedControl?) { 86 | if let segControl = segmentedControl { 87 | self.view.addSubview(segControl) 88 | 89 | var constraints = Array() 90 | let constraintAttributes = Array(arrayLiteral:.leading,.trailing) 91 | for attribute in constraintAttributes { 92 | let constraint = NSLayoutConstraint(item: segControl, 93 | attribute: attribute, 94 | relatedBy: .equal, 95 | toItem: self.view, 96 | attribute: attribute, 97 | multiplier: 1.0, 98 | constant: 0) 99 | constraints.append(constraint) 100 | } 101 | 102 | let topConstraint = NSLayoutConstraint(item: segControl, 103 | attribute: .top, 104 | relatedBy: .equal, 105 | toItem: self.topLayoutGuide, 106 | attribute: .bottom, 107 | multiplier: 1.0, 108 | constant: 0) 109 | constraints.append(topConstraint) 110 | 111 | let heightConstraint = NSLayoutConstraint(item: segControl, 112 | attribute: .height, 113 | relatedBy: .equal, 114 | toItem: nil, 115 | attribute: .notAnAttribute, 116 | multiplier: 0.0, 117 | constant: CGFloat(segmentHeight)) 118 | constraints.append(heightConstraint) 119 | self.view.addConstraints(constraints) 120 | } 121 | } 122 | 123 | @objc private func setupSegmentedControl(segmentedControl:HMSegmentedControl?) { 124 | if let segControl = segmentedControl { 125 | segControl.translatesAutoresizingMaskIntoConstraints = false 126 | segControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown 127 | segControl.selectionIndicatorColor = UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0) 128 | segControl.selectionIndicatorHeight = 3.0 129 | segControl.selectedTitleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFont(ofSize: 22)] 130 | segControl.titleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0x84/0xff, green: 0xb0/0xff, blue: 0xdf/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFont(ofSize: 18)] 131 | segControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe 132 | segControl.backgroundColor = UIColor.blue 133 | segControl.addTarget(self, action: #selector(TestPageViewController.segmentValueChanged), for: .valueChanged) 134 | } 135 | } 136 | 137 | @objc private func segmentValueChanged(sender:AnyObject) { 138 | if let segControl = self.segmentedControl { 139 | self.showPageAtIndex(index: segControl.selectedSegmentIndex, animated: true) 140 | } 141 | } 142 | 143 | @objc func showPageAtIndex(index:Int,animated:Bool) { 144 | var direction:UIPageViewControllerNavigationDirection = .reverse 145 | if let vcs = self.pageViewController.viewControllers { 146 | if let last = vcs.last { 147 | if let index = self.pageControllers.index(of: last) { 148 | direction = self.selectedIndex > index ? .forward : .reverse 149 | } 150 | } 151 | } 152 | 153 | self.pageViewController.setViewControllers([self.pageControllers[index]], direction: direction, animated: true) { (finished) in 154 | DispatchQueue.main.async { 155 | self.pageViewController.setViewControllers([self.pageControllers[index]], direction: direction, animated: false) { (finished) in 156 | 157 | } 158 | } 159 | } 160 | } 161 | 162 | func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { 163 | var index = self.pageControllers.index(of: viewController) 164 | if index == NSNotFound || index == 0 { 165 | return nil 166 | } 167 | 168 | index = index! - 1 169 | return self.pageControllers[index!] 170 | } 171 | 172 | func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { 173 | var index = self.pageControllers.index(of: viewController) 174 | if index! == NSNotFound { 175 | return nil 176 | } 177 | 178 | if index! + 1 >= self.pageControllers.count { 179 | return nil 180 | } 181 | 182 | index = index! + 1 183 | return self.pageControllers[index!] 184 | } 185 | 186 | func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { 187 | self.selectedIndex = self.pageControllers.index(of: (pageViewController.viewControllers?.last)!)! 188 | self.segmentedControl?.setSelectedSegmentIndex(UInt(self.selectedIndex), animated: true) 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /Example/GYPageViewController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/6/12. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UITableViewController ,GYPageViewControllerDataSource, GYPageViewControllerDelegate { 12 | 13 | @objc var pageControllers:Array! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | self.title = "Demo" 19 | 20 | self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "CustomCell") 21 | } 22 | 23 | //MARK: - UITableViewDelegate, UITableViewDataSource 24 | override func tableView(_ tableView: UITableView, 25 | heightForRowAt indexPath: IndexPath) -> CGFloat { 26 | return 50 27 | } 28 | 29 | override func tableView(_ tableView: UITableView, 30 | numberOfRowsInSection section: Int) -> Int { 31 | return 3 32 | } 33 | 34 | override func tableView(_ tableView: UITableView, 35 | cellForRowAt indexPath: IndexPath) -> UITableViewCell { 36 | let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell", for: indexPath as IndexPath) 37 | if indexPath.row == 0 { 38 | cell.textLabel?.text = "GYTapPageViewController" 39 | } else if indexPath.row == 1 { 40 | cell.textLabel?.text = "GYPageViewController" 41 | } else if indexPath.row == 2 { 42 | cell.textLabel?.text = "UIPageViewController" 43 | } 44 | 45 | cell.setSelected(false, animated: false) 46 | return cell 47 | } 48 | 49 | override func tableView(_ tableView: UITableView, 50 | didSelectRowAt indexPath: IndexPath) { 51 | if indexPath.row == 0 { 52 | var titlesArray:Array = Array() 53 | var pageControllers:Array = Array() 54 | let colorStep:CGFloat = 1/4 55 | for i in 0...20 { 56 | titlesArray.append("tab \(i)") 57 | let tabVc = TestChildViewController() 58 | tabVc.pageIndex = i 59 | tabVc.view.backgroundColor = UIColor(red: colorStep * CGFloat((i + 1) % 2), green: colorStep * CGFloat((i + 1) % 3), blue: colorStep * CGFloat((i + 1) % 5), alpha: 1) 60 | 61 | let label = UILabel(frame: CGRect(x:100,y:100,width:100,height:100)) 62 | label.backgroundColor = UIColor.gray 63 | label.text = "tab \(i)" 64 | label.textAlignment = .center 65 | tabVc.view.addSubview(label) 66 | 67 | pageControllers.append(tabVc) 68 | } 69 | self.pageControllers = pageControllers 70 | let vc = GYTabPageViewController(pageTitles: titlesArray) 71 | vc.delegate = self 72 | vc.dataSource = self 73 | vc.showPageAtIndex(2, animated: false) 74 | self.navigationController?.pushViewController(vc, animated: true) 75 | } else if indexPath.row == 1 { 76 | 77 | } else if indexPath.row == 2 { 78 | var titlesArray:Array = Array() 79 | var pageControllers:Array = Array() 80 | let colorStep:CGFloat = 1/4 81 | for i in 0...20 { 82 | titlesArray.append("tab \(i)") 83 | let tabVc = TestChildViewController() 84 | tabVc.pageIndex = i 85 | tabVc.view.backgroundColor = UIColor(red: colorStep * CGFloat((i + 1) % 2), green: colorStep * CGFloat((i + 1) % 3), blue: colorStep * CGFloat((i + 1) % 5), alpha: 1) 86 | 87 | let label = UILabel(frame: CGRect(x:100,y:100,width:100,height:100)) 88 | label.backgroundColor = UIColor.gray 89 | label.text = "tab \(i)" 90 | label.textAlignment = .center 91 | tabVc.view.addSubview(label) 92 | 93 | pageControllers.append(tabVc) 94 | } 95 | self.pageControllers = pageControllers 96 | let vc = TestPageViewController(pageTitles: titlesArray, pageControllers: pageControllers) 97 | vc.showPageAtIndex(index: 2, animated: false) 98 | self.navigationController?.pushViewController(vc, animated: true) 99 | } 100 | } 101 | 102 | //MARK: - GYPageViewControllerDataSource & GYPageViewControllerDelegate 103 | @objc func gy_pageViewController(_: GYPageViewController, controllerAtIndex index: Int) -> UIViewController! { 104 | return self.pageControllers[index] 105 | } 106 | 107 | @objc func numberOfControllers(_: GYPageViewController) -> Int { 108 | return self.pageControllers.count 109 | } 110 | 111 | } 112 | 113 | -------------------------------------------------------------------------------- /Example/GYTabPageViewController-ScreenShot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-gao/GYPageViewController/5b5d85abf033c6e3b56de369ab1f7613d13b72f7/Example/GYTabPageViewController-ScreenShot.png -------------------------------------------------------------------------------- /Example/GYTabPageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GYTabPageViewController.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/27. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import HMSegmentedControl 11 | 12 | @objc protocol GYTabPageViewControllerDelegate { 13 | @objc optional func pageViewDidSelectedIndex(_ index:Int) 14 | } 15 | 16 | class GYTabPageViewController: GYPageViewController { 17 | var segmentedControl:HMSegmentedControl? 18 | var pageTitles:Array! 19 | var segmentHeight = 44.0 20 | 21 | //MARK: - Init 22 | required init?(coder aDecoder: NSCoder) { 23 | fatalError("init(coder:) has not been implemented") 24 | } 25 | 26 | init(pageTitles:Array) { 27 | super.init(nibName: nil, bundle: nil) 28 | 29 | self.pageTitles = pageTitles 30 | if self.pageTitles.count > 1 { 31 | self.segmentedControl = HMSegmentedControl(sectionTitles: self.pageTitles) 32 | self.setupSegmentedControl(segmentedControl: self.segmentedControl) 33 | } 34 | } 35 | 36 | //MARK: - Lift Cycles 37 | override func viewDidLoad() { 38 | super.viewDidLoad() 39 | assert((pageTitles.count == self.pageCount), "title count is not equal controllers count") 40 | 41 | if self.pageTitles.count > 1 { 42 | self.layoutSegmentedControl(self.segmentedControl) 43 | } 44 | 45 | self.resetScrollViewLayoutConstraints(self.scrollView) 46 | } 47 | 48 | override func viewDidAppear(_ animated: Bool) { 49 | super.viewDidAppear(animated) 50 | } 51 | 52 | //MARK: - Target & Action 53 | @objc fileprivate func segmentValueChanged(_ sender:AnyObject) { 54 | if let segControl = self.segmentedControl { 55 | self.showPageAtIndex(segControl.selectedSegmentIndex, animated: true) 56 | } 57 | } 58 | 59 | //MARK: - Subviews Configuration 60 | @objc fileprivate func resetScrollViewLayoutConstraints(_ scrollView:UIScrollView) { 61 | scrollView.gy_removeConstraintsAffectingView() 62 | var constraints = Array() 63 | let constraintAttributes = Array(arrayLiteral: .bottom,.leading,.trailing) 64 | 65 | let topConstraint = NSLayoutConstraint(item: scrollView, 66 | attribute: .top, 67 | relatedBy: .equal, 68 | toItem: self.segmentedControl, 69 | attribute: .bottom, 70 | multiplier: 1, 71 | constant: 0) 72 | constraints.append(topConstraint) 73 | 74 | for attribute in constraintAttributes { 75 | let constraint = NSLayoutConstraint(item: scrollView, 76 | attribute: attribute, 77 | relatedBy: .equal, 78 | toItem: self.view, 79 | attribute: attribute, 80 | multiplier: 1.0, 81 | constant: 0) 82 | constraints.append(constraint) 83 | } 84 | self.view.addConstraints(constraints) 85 | } 86 | 87 | @objc private func setupSegmentedControl(segmentedControl:HMSegmentedControl?) { 88 | if let segControl = segmentedControl { 89 | segControl.translatesAutoresizingMaskIntoConstraints = false 90 | segControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown 91 | segControl.selectionIndicatorColor = UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0) 92 | segControl.selectionIndicatorHeight = 3.0 93 | segControl.selectedTitleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFont(ofSize: 22)] 94 | segControl.titleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0x84/0xff, green: 0xb0/0xff, blue: 0xdf/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFont(ofSize: 18)] 95 | segControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe 96 | segControl.backgroundColor = UIColor.blue 97 | segControl.addTarget(self, action: #selector(GYTabPageViewController.segmentValueChanged), for: .valueChanged) 98 | } 99 | } 100 | 101 | @objc fileprivate func layoutSegmentedControl(_ segmentedControl:HMSegmentedControl?) { 102 | if let segControl = segmentedControl { 103 | self.view.addSubview(segControl) 104 | 105 | var constraints = Array() 106 | let constraintAttributes = Array(arrayLiteral:.leading,.trailing) 107 | for attribute in constraintAttributes { 108 | let constraint = NSLayoutConstraint(item: segControl, 109 | attribute: attribute, 110 | relatedBy: .equal, 111 | toItem: self.view, 112 | attribute: attribute, 113 | multiplier: 1.0, 114 | constant: 0) 115 | constraints.append(constraint) 116 | } 117 | 118 | let topConstraint = NSLayoutConstraint(item: segControl, 119 | attribute: .top, 120 | relatedBy: .equal, 121 | toItem: self.topLayoutGuide, 122 | attribute: .bottom, 123 | multiplier: 1.0, 124 | constant: 0) 125 | constraints.append(topConstraint) 126 | 127 | let heightConstraint = NSLayoutConstraint(item: segControl, 128 | attribute: .height, 129 | relatedBy: .equal, 130 | toItem: nil, 131 | attribute: .notAnAttribute, 132 | multiplier: 0.0, 133 | constant: CGFloat(segmentHeight)) 134 | constraints.append(heightConstraint) 135 | self.view.addConstraints(constraints) 136 | } 137 | } 138 | 139 | //MARK: - Override super class methods 140 | 141 | // Sent when a gesture-initiated transition ends. 142 | @objc override func gy_pageViewControllerDidTransitonFrom(_ fromIndex:Int, toIndex:Int) 143 | { 144 | super.gy_pageViewControllerDidTransitonFrom(fromIndex, toIndex: toIndex) 145 | self.segmentedControl?.setSelectedSegmentIndex(UInt(toIndex), animated: true) 146 | } 147 | 148 | // Sent after method(func showPageAtIndex(index:Int,animated:Bool)) finished. 149 | @objc override func gy_pageViewControllerDidShow(_ fromIndex:Int, toIndex:Int, finished:Bool) 150 | { 151 | super.gy_pageViewControllerDidShow(fromIndex, toIndex:toIndex, finished:finished) 152 | self.segmentedControl?.setSelectedSegmentIndex(UInt(toIndex), animated: true ) 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /Example/NSArray+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSArray { 12 | 13 | func gy_autoRemoveConstraints() { 14 | if #available(iOS 8.0, *) { 15 | if NSLayoutConstraint.responds(to: #selector(NSLayoutConstraint.deactivate(_:))) { 16 | NSLayoutConstraint.deactivate(self as! [NSLayoutConstraint]) 17 | return 18 | } 19 | } 20 | 21 | for object in self { 22 | if (object as AnyObject).isKind(of: NSLayoutConstraint.self) { 23 | (object as! NSLayoutConstraint).gy_autoRemove() 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/NSLayoutConstraint+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSLayoutConstraint { 12 | func gy_autoRemove() { 13 | if #available(iOS 8.0, *) { 14 | self.isActive = false 15 | return 16 | } 17 | 18 | if self.secondItem != nil { 19 | var commonSuperview:UIView? 20 | commonSuperview = (self.firstItem as! UIView).gy_commonSuperviewWithView(self.secondItem as! UIView) 21 | while commonSuperview != nil { 22 | if commonSuperview?.constraints.contains(self) == true { 23 | commonSuperview?.removeConstraint(self) 24 | return 25 | } 26 | commonSuperview = commonSuperview?.superview 27 | } 28 | } 29 | else { 30 | self.firstItem.removeConstraint(self) 31 | return 32 | } 33 | assert(false, "Failed to remove constraint: \(self)") 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, "7.0" 2 | use_frameworks! 3 | 4 | target 'GYPageViewController_Example' do 5 | # pod 'GYPageViewController', :path => '../' 6 | 7 | pod 'HMSegmentedControl', '~>1.5.2' 8 | end 9 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HMSegmentedControl (1.5.2) 3 | 4 | DEPENDENCIES: 5 | - HMSegmentedControl (~> 1.5.2) 6 | 7 | SPEC CHECKSUMS: 8 | HMSegmentedControl: 83b9686022d2176fb6457d2bdb61e5d6393fed7d 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /Example/Pods/HMSegmentedControl/HMSegmentedControl/HMSegmentedControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // HMSegmentedControl.h 3 | // HMSegmentedControl 4 | // 5 | // Created by Hesham Abd-Elmegid on 23/12/12. 6 | // Copyright (c) 2012-2015 Hesham Abd-Elmegid. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HMSegmentedControl; 12 | 13 | typedef void (^IndexChangeBlock)(NSInteger index); 14 | typedef NSAttributedString *(^HMTitleFormatterBlock)(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected); 15 | 16 | typedef enum { 17 | HMSegmentedControlSelectionStyleTextWidthStripe, // Indicator width will only be as big as the text width 18 | HMSegmentedControlSelectionStyleFullWidthStripe, // Indicator width will fill the whole segment 19 | HMSegmentedControlSelectionStyleBox, // A rectangle that covers the whole segment 20 | HMSegmentedControlSelectionStyleArrow // An arrow in the middle of the segment pointing up or down depending on `HMSegmentedControlSelectionIndicatorLocation` 21 | } HMSegmentedControlSelectionStyle; 22 | 23 | typedef enum { 24 | HMSegmentedControlSelectionIndicatorLocationUp, 25 | HMSegmentedControlSelectionIndicatorLocationDown, 26 | HMSegmentedControlSelectionIndicatorLocationNone // No selection indicator 27 | } HMSegmentedControlSelectionIndicatorLocation; 28 | 29 | typedef enum { 30 | HMSegmentedControlSegmentWidthStyleFixed, // Segment width is fixed 31 | HMSegmentedControlSegmentWidthStyleDynamic, // Segment width will only be as big as the text width (including inset) 32 | } HMSegmentedControlSegmentWidthStyle; 33 | 34 | typedef NS_OPTIONS(NSInteger, HMSegmentedControlBorderType) { 35 | HMSegmentedControlBorderTypeNone = 0, 36 | HMSegmentedControlBorderTypeTop = (1 << 0), 37 | HMSegmentedControlBorderTypeLeft = (1 << 1), 38 | HMSegmentedControlBorderTypeBottom = (1 << 2), 39 | HMSegmentedControlBorderTypeRight = (1 << 3) 40 | }; 41 | 42 | enum { 43 | HMSegmentedControlNoSegment = -1 // Segment index for no selected segment 44 | }; 45 | 46 | typedef enum { 47 | HMSegmentedControlTypeText, 48 | HMSegmentedControlTypeImages, 49 | HMSegmentedControlTypeTextImages 50 | } HMSegmentedControlType; 51 | 52 | @interface HMSegmentedControl : UIControl 53 | 54 | @property (nonatomic, strong) NSArray *sectionTitles; 55 | @property (nonatomic, strong) NSArray *sectionImages; 56 | @property (nonatomic, strong) NSArray *sectionSelectedImages; 57 | 58 | /** 59 | Provide a block to be executed when selected index is changed. 60 | 61 | Alternativly, you could use `addTarget:action:forControlEvents:` 62 | */ 63 | @property (nonatomic, copy) IndexChangeBlock indexChangeBlock; 64 | 65 | /** 66 | Used to apply custom text styling to titles when set. 67 | 68 | When this block is set, no additional styling is applied to the `NSAttributedString` object returned from this block. 69 | */ 70 | @property (nonatomic, copy) HMTitleFormatterBlock titleFormatter; 71 | 72 | /** 73 | Text attributes to apply to item title text. 74 | */ 75 | @property (nonatomic, strong) NSDictionary *titleTextAttributes UI_APPEARANCE_SELECTOR; 76 | 77 | /* 78 | Text attributes to apply to selected item title text. 79 | 80 | Attributes not set in this dictionary are inherited from `titleTextAttributes`. 81 | */ 82 | @property (nonatomic, strong) NSDictionary *selectedTitleTextAttributes UI_APPEARANCE_SELECTOR; 83 | 84 | /** 85 | Segmented control background color. 86 | 87 | Default is `[UIColor whiteColor]` 88 | */ 89 | @property (nonatomic, strong) UIColor *backgroundColor UI_APPEARANCE_SELECTOR; 90 | 91 | /** 92 | Color for the selection indicator stripe/box 93 | 94 | Default is `R:52, G:181, B:229` 95 | */ 96 | @property (nonatomic, strong) UIColor *selectionIndicatorColor UI_APPEARANCE_SELECTOR; 97 | 98 | /** 99 | Color for the vertical divider between segments. 100 | 101 | Default is `[UIColor blackColor]` 102 | */ 103 | @property (nonatomic, strong) UIColor *verticalDividerColor UI_APPEARANCE_SELECTOR; 104 | 105 | /** 106 | Opacity for the seletion indicator box. 107 | 108 | Default is `0.2f` 109 | */ 110 | @property (nonatomic) CGFloat selectionIndicatorBoxOpacity; 111 | 112 | /** 113 | Width the vertical divider between segments that is added when `verticalDividerEnabled` is set to YES. 114 | 115 | Default is `1.0f` 116 | */ 117 | @property (nonatomic, assign) CGFloat verticalDividerWidth; 118 | 119 | /** 120 | Specifies the style of the control 121 | 122 | Default is `HMSegmentedControlTypeText` 123 | */ 124 | @property (nonatomic, assign) HMSegmentedControlType type; 125 | 126 | /** 127 | Specifies the style of the selection indicator. 128 | 129 | Default is `HMSegmentedControlSelectionStyleTextWidthStripe` 130 | */ 131 | @property (nonatomic, assign) HMSegmentedControlSelectionStyle selectionStyle; 132 | 133 | /** 134 | Specifies the style of the segment's width. 135 | 136 | Default is `HMSegmentedControlSegmentWidthStyleFixed` 137 | */ 138 | @property (nonatomic, assign) HMSegmentedControlSegmentWidthStyle segmentWidthStyle; 139 | 140 | /** 141 | Specifies the location of the selection indicator. 142 | 143 | Default is `HMSegmentedControlSelectionIndicatorLocationUp` 144 | */ 145 | @property (nonatomic, assign) HMSegmentedControlSelectionIndicatorLocation selectionIndicatorLocation; 146 | 147 | /* 148 | Specifies the border type. 149 | 150 | Default is `HMSegmentedControlBorderTypeNone` 151 | */ 152 | @property (nonatomic, assign) HMSegmentedControlBorderType borderType; 153 | 154 | /** 155 | Specifies the border color. 156 | 157 | Default is `[UIColor blackColor]` 158 | */ 159 | @property (nonatomic, strong) UIColor *borderColor; 160 | 161 | /** 162 | Specifies the border width. 163 | 164 | Default is `1.0f` 165 | */ 166 | @property (nonatomic, assign) CGFloat borderWidth; 167 | 168 | /** 169 | Default is YES. Set to NO to deny scrolling by dragging the scrollView by the user. 170 | */ 171 | @property(nonatomic, getter = isUserDraggable) BOOL userDraggable; 172 | 173 | /** 174 | Default is YES. Set to NO to deny any touch events by the user. 175 | */ 176 | @property(nonatomic, getter = isTouchEnabled) BOOL touchEnabled; 177 | 178 | /** 179 | Default is NO. Set to YES to show a vertical divider between the segments. 180 | */ 181 | @property(nonatomic, getter = isVerticalDividerEnabled) BOOL verticalDividerEnabled; 182 | 183 | /** 184 | Index of the currently selected segment. 185 | */ 186 | @property (nonatomic, assign) NSInteger selectedSegmentIndex; 187 | 188 | /** 189 | Height of the selection indicator. Only effective when `HMSegmentedControlSelectionStyle` is either `HMSegmentedControlSelectionStyleTextWidthStripe` or `HMSegmentedControlSelectionStyleFullWidthStripe`. 190 | 191 | Default is 5.0 192 | */ 193 | @property (nonatomic, readwrite) CGFloat selectionIndicatorHeight; 194 | 195 | /** 196 | Edge insets for the selection indicator. 197 | NOTE: This does not affect the bounding box of HMSegmentedControlSelectionStyleBox 198 | 199 | When HMSegmentedControlSelectionIndicatorLocationUp is selected, bottom edge insets are not used 200 | 201 | When HMSegmentedControlSelectionIndicatorLocationDown is selected, top edge insets are not used 202 | 203 | Defaults are top: 0.0f 204 | left: 0.0f 205 | bottom: 0.0f 206 | right: 0.0f 207 | */ 208 | @property (nonatomic, readwrite) UIEdgeInsets selectionIndicatorEdgeInsets; 209 | 210 | /** 211 | Inset left and right edges of segments. 212 | 213 | Default is UIEdgeInsetsMake(0, 5, 0, 5) 214 | */ 215 | @property (nonatomic, readwrite) UIEdgeInsets segmentEdgeInset; 216 | 217 | /** 218 | Default is YES. Set to NO to disable animation during user selection. 219 | */ 220 | @property (nonatomic) BOOL shouldAnimateUserSelection; 221 | 222 | - (id)initWithSectionTitles:(NSArray *)sectiontitles; 223 | - (id)initWithSectionImages:(NSArray *)sectionImages sectionSelectedImages:(NSArray *)sectionSelectedImages; 224 | - (instancetype)initWithSectionImages:(NSArray *)sectionImages sectionSelectedImages:(NSArray *)sectionSelectedImages titlesForSections:(NSArray *)sectiontitles; 225 | - (void)setSelectedSegmentIndex:(NSUInteger)index animated:(BOOL)animated; 226 | - (void)setIndexChangeBlock:(IndexChangeBlock)indexChangeBlock; 227 | - (void)setTitleFormatter:(HMTitleFormatterBlock)titleFormatter; 228 | 229 | @end 230 | -------------------------------------------------------------------------------- /Example/Pods/HMSegmentedControl/LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | ## MIT License 4 | 5 | Copyright (c) 2012 Hesham Abd-Elmegid (http://www.hesh.am) 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. -------------------------------------------------------------------------------- /Example/Pods/HMSegmentedControl/README.md: -------------------------------------------------------------------------------- 1 | HMSegmentedControl 2 | === 3 | 4 | [![Pod Version](http://img.shields.io/cocoapods/v/HMSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/HMSegmentedControl) 5 | [![Pod Platform](http://img.shields.io/cocoapods/p/HMSegmentedControl.svg?style=flat)](http://cocoadocs.org/docsets/HMSegmentedControl) 6 | [![Pod License](http://img.shields.io/cocoapods/l/HMSegmentedControl.svg?style=flat)](http://opensource.org/licenses/MIT) 7 | 8 | A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products. 9 | 10 | # Features 11 | - Supports both text and images 12 | - Support horizontal scrolling 13 | - Supports advanced title styling with text attributes for font, color, kerning, shadow, etc. 14 | - Supports selection indicator both on top and bottom 15 | - Supports blocks 16 | - Works with ARC and iOS >= 7 17 | 18 | # Installation 19 | 20 | ### CocoaPods 21 | The easiest way of installing HMSegmentedControl is via [CocoaPods](http://cocoapods.org/). 22 | 23 | ``` 24 | pod 'HMSegmentedControl' 25 | ``` 26 | 27 | ### Old-fashioned way 28 | 29 | - Add `HMSegmentedControl.h` and `HMSegmentedControl.m` to your project. 30 | - Add `QuartzCore.framework` to your linked frameworks. 31 | - `#import "HMSegmentedControl.h"` where you want to add the control. 32 | 33 | # Usage 34 | 35 | The code below will create a segmented control with the default looks: 36 | 37 | ``` objective-c 38 | HMSegmentedControl *segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"One", @"Two", @"Three"]]; 39 | segmentedControl.frame = CGRectMake(10, 10, 300, 60); 40 | [segmentedControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged]; 41 | [self.view addSubview:segmentedControl]; 42 | ``` 43 | 44 | Included is a demo project showing how to fully customise the control. 45 | 46 | ![HMSegmentedControl](https://raw.githubusercontent.com/HeshamMegid/HMSegmentedControl/master/Screenshot.png) 47 | 48 | # Apps using HMSegmentedControl 49 | 50 | If you are using HMSegmentedControl in your app or know of an app that uses it, please add it to [this list](https://github.com/HeshamMegid/HMSegmentedControl/wiki/Apps-using-HMSegmentedControl). 51 | 52 | 53 | # License 54 | 55 | HMSegmentedControl is licensed under the terms of the MIT License. Please see the [LICENSE](LICENSE.md) file for full details. 56 | 57 | If this code was helpful, I would love to hear from you. 58 | 59 | [@HeshamMegid](http://twitter.com/HeshamMegid) 60 | [http://hesh.am](http://hesh.am) 61 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/HMSegmentedControl/HMSegmentedControl.h: -------------------------------------------------------------------------------- 1 | ../../../HMSegmentedControl/HMSegmentedControl/HMSegmentedControl.h -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/GYPageViewController.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GYPageViewController", 3 | "version": "0.1.0", 4 | "summary": "Implementation a page view controller with scroll view. To solve 2 Problems of UIPageViewController and take the place of UIPageViewController.", 5 | "description": "TODO: Add long description of the pod here.", 6 | "homepage": "https://github.com//GYPageViewController", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "GaoYu": "fightrain@126.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com//GYPageViewController.git", 16 | "tag": "0.1.0" 17 | }, 18 | "platforms": { 19 | "ios": "7.0" 20 | }, 21 | "source_files": "GYPageViewController/Classes/**/*", 22 | "dependencies": { 23 | "HMSegmentedControl": [ 24 | "~> 1.5.1" 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HMSegmentedControl (1.5.2) 3 | 4 | DEPENDENCIES: 5 | - HMSegmentedControl (~> 1.5.2) 6 | 7 | SPEC CHECKSUMS: 8 | HMSegmentedControl: 83b9686022d2176fb6457d2bdb61e5d6393fed7d 9 | 10 | COCOAPODS: 0.39.0 11 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | archiveVersion 6 | 1 7 | classes 8 | 9 | objectVersion 10 | 46 11 | objects 12 | 13 | 052A17875CB827423D627183396CEB60 14 | 15 | buildSettings 16 | 17 | ALWAYS_SEARCH_USER_PATHS 18 | NO 19 | CLANG_CXX_LANGUAGE_STANDARD 20 | gnu++0x 21 | CLANG_CXX_LIBRARY 22 | libc++ 23 | CLANG_ENABLE_MODULES 24 | YES 25 | CLANG_ENABLE_OBJC_ARC 26 | YES 27 | CLANG_WARN_BOOL_CONVERSION 28 | YES 29 | CLANG_WARN_CONSTANT_CONVERSION 30 | YES 31 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE 32 | YES 33 | CLANG_WARN_EMPTY_BODY 34 | YES 35 | CLANG_WARN_ENUM_CONVERSION 36 | YES 37 | CLANG_WARN_INT_CONVERSION 38 | YES 39 | CLANG_WARN_OBJC_ROOT_CLASS 40 | YES 41 | CLANG_WARN_UNREACHABLE_CODE 42 | YES 43 | CLANG_WARN__DUPLICATE_METHOD_MATCH 44 | YES 45 | COPY_PHASE_STRIP 46 | YES 47 | ENABLE_NS_ASSERTIONS 48 | NO 49 | GCC_C_LANGUAGE_STANDARD 50 | gnu99 51 | GCC_PREPROCESSOR_DEFINITIONS 52 | 53 | RELEASE=1 54 | 55 | GCC_WARN_64_TO_32_BIT_CONVERSION 56 | YES 57 | GCC_WARN_ABOUT_RETURN_TYPE 58 | YES 59 | GCC_WARN_UNDECLARED_SELECTOR 60 | YES 61 | GCC_WARN_UNINITIALIZED_AUTOS 62 | YES 63 | GCC_WARN_UNUSED_FUNCTION 64 | YES 65 | GCC_WARN_UNUSED_VARIABLE 66 | YES 67 | IPHONEOS_DEPLOYMENT_TARGET 68 | 7.0 69 | STRIP_INSTALLED_PRODUCT 70 | NO 71 | SYMROOT 72 | ${SRCROOT}/../build 73 | VALIDATE_PRODUCT 74 | YES 75 | 76 | isa 77 | XCBuildConfiguration 78 | name 79 | Release 80 | 81 | 060827A21CB1E5E56ABB15198472714A 82 | 83 | fileRef 84 | 258B0C8029B3982F03A30ED9FB271283 85 | isa 86 | PBXBuildFile 87 | 88 | 065AA8D5905013510AF2B2D77D72E8DF 89 | 90 | buildConfigurations 91 | 92 | 54ECB4ADDCC15F0A80354D93D6D7B084 93 | 78209F736E1035735643FE21096AE895 94 | 95 | defaultConfigurationIsVisible 96 | 0 97 | defaultConfigurationName 98 | Release 99 | isa 100 | XCConfigurationList 101 | 102 | 0BF31BBEE412889163F67E607546B649 103 | 104 | includeInIndex 105 | 1 106 | isa 107 | PBXFileReference 108 | lastKnownFileType 109 | text 110 | path 111 | Pods-GYPageViewController_Example-acknowledgements.markdown 112 | sourceTree 113 | <group> 114 | 115 | 0D267D44B46D8EF79C2C8E6AF4F0E81D 116 | 117 | children 118 | 119 | AA1C24BA61F025A4A2FD5F0D4836F001 120 | 1B4B39F8305D481CE056ACB85113A089 121 | 5A60B762A017035F2E553810DE176E93 122 | F05541B20E779A463D53892816622D06 123 | C7AD363978D053D998F33619B64AD5BC 124 | 9C5076C79A4ABEE5B49A2E741E85EF9F 125 | 126 | isa 127 | PBXGroup 128 | name 129 | Support Files 130 | path 131 | ../Target Support Files/HMSegmentedControl 132 | sourceTree 133 | <group> 134 | 135 | 0DA1539DF2A64AEE5C3D7B7FA5A883AB 136 | 137 | fileRef 138 | B18F24645AA4D651DFC7B69A3A0833DB 139 | isa 140 | PBXBuildFile 141 | 142 | 0EBCF0F2D3A78155C8C5667FE71164F1 143 | 144 | includeInIndex 145 | 1 146 | isa 147 | PBXFileReference 148 | lastKnownFileType 149 | text.script.sh 150 | path 151 | Pods-GYPageViewController_Example-frameworks.sh 152 | sourceTree 153 | <group> 154 | 155 | 13C6F5B4DA7340502DBA0506DDB956FB 156 | 157 | includeInIndex 158 | 1 159 | isa 160 | PBXFileReference 161 | lastKnownFileType 162 | text.xcconfig 163 | path 164 | Pods-GYPageViewController_Example.release.xcconfig 165 | sourceTree 166 | <group> 167 | 168 | 1B4B39F8305D481CE056ACB85113A089 169 | 170 | includeInIndex 171 | 1 172 | isa 173 | PBXFileReference 174 | lastKnownFileType 175 | text.xcconfig 176 | path 177 | HMSegmentedControl.xcconfig 178 | sourceTree 179 | <group> 180 | 181 | 223694660E2721CC985294E4182BDA36 182 | 183 | containerPortal 184 | D41D8CD98F00B204E9800998ECF8427E 185 | isa 186 | PBXContainerItemProxy 187 | proxyType 188 | 1 189 | remoteGlobalIDString 190 | 71C1DF39EE1271EA1147F993CA1439A0 191 | remoteInfo 192 | HMSegmentedControl 193 | 194 | 258B0C8029B3982F03A30ED9FB271283 195 | 196 | isa 197 | PBXFileReference 198 | lastKnownFileType 199 | wrapper.framework 200 | name 201 | Foundation.framework 202 | path 203 | Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework 204 | sourceTree 205 | DEVELOPER_DIR 206 | 207 | 280B94A5AB5C466A4247CD871C7A70E3 208 | 209 | includeInIndex 210 | 1 211 | isa 212 | PBXFileReference 213 | lastKnownFileType 214 | sourcecode.c.h 215 | path 216 | Pods-GYPageViewController_Example-umbrella.h 217 | sourceTree 218 | <group> 219 | 220 | 296E453AD165A3259916C9DD032EC38A 221 | 222 | fileRef 223 | 258B0C8029B3982F03A30ED9FB271283 224 | isa 225 | PBXBuildFile 226 | 227 | 2D8E8EC45A3A1A1D94AE762CB5028504 228 | 229 | buildConfigurations 230 | 231 | B37F0F91F85060E28F1DAAB522DC7EC1 232 | 052A17875CB827423D627183396CEB60 233 | 234 | defaultConfigurationIsVisible 235 | 0 236 | defaultConfigurationName 237 | Release 238 | isa 239 | XCConfigurationList 240 | 241 | 2E30580CCB294AF085DB7E6440586FF6 242 | 243 | baseConfigurationReference 244 | 13C6F5B4DA7340502DBA0506DDB956FB 245 | buildSettings 246 | 247 | CODE_SIGN_IDENTITY[sdk=iphoneos*] 248 | iPhone Developer 249 | CURRENT_PROJECT_VERSION 250 | 1 251 | DEFINES_MODULE 252 | YES 253 | DYLIB_COMPATIBILITY_VERSION 254 | 1 255 | DYLIB_CURRENT_VERSION 256 | 1 257 | DYLIB_INSTALL_NAME_BASE 258 | @rpath 259 | ENABLE_STRICT_OBJC_MSGSEND 260 | YES 261 | INFOPLIST_FILE 262 | Target Support Files/Pods-GYPageViewController_Example/Info.plist 263 | INSTALL_PATH 264 | $(LOCAL_LIBRARY_DIR)/Frameworks 265 | IPHONEOS_DEPLOYMENT_TARGET 266 | 7.0 267 | LD_RUNPATH_SEARCH_PATHS 268 | 269 | $(inherited) 270 | @executable_path/Frameworks 271 | @loader_path/Frameworks 272 | 273 | MACH_O_TYPE 274 | staticlib 275 | MODULEMAP_FILE 276 | Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.modulemap 277 | MTL_ENABLE_DEBUG_INFO 278 | NO 279 | OTHER_LDFLAGS 280 | 281 | OTHER_LIBTOOLFLAGS 282 | 283 | PODS_ROOT 284 | $(SRCROOT) 285 | PRODUCT_NAME 286 | Pods_GYPageViewController_Example 287 | SDKROOT 288 | iphoneos 289 | SKIP_INSTALL 290 | YES 291 | TARGETED_DEVICE_FAMILY 292 | 1,2 293 | VERSIONING_SYSTEM 294 | apple-generic 295 | VERSION_INFO_PREFIX 296 | 297 | 298 | isa 299 | XCBuildConfiguration 300 | name 301 | Release 302 | 303 | 38819E54439A6559568A5EB474E29D40 304 | 305 | children 306 | 307 | 7B6AB2EAF126D26192A24E97BB2CA6C1 308 | 309 | isa 310 | PBXGroup 311 | name 312 | Pods 313 | sourceTree 314 | <group> 315 | 316 | 3926C638AD0708942C88C2BC89261735 317 | 318 | children 319 | 320 | 258B0C8029B3982F03A30ED9FB271283 321 | B18F24645AA4D651DFC7B69A3A0833DB 322 | 323 | isa 324 | PBXGroup 325 | name 326 | iOS 327 | sourceTree 328 | <group> 329 | 330 | 3A3B01BCC68FC8960E130FA5890CE1CD 331 | 332 | children 333 | 334 | E6D80CD0DC3E14F5F9CDBCE92986CDC5 335 | B6ED7600D78934086D6B3F05A24D58C5 336 | 0BF31BBEE412889163F67E607546B649 337 | C6F4E5A720E5708C4069C210ED52FD2B 338 | C75D9A388AC597502EA7D166CDA66D3D 339 | 0EBCF0F2D3A78155C8C5667FE71164F1 340 | C8F7C797D3F0C6D0E55828EB5A4C2A2D 341 | 280B94A5AB5C466A4247CD871C7A70E3 342 | B06F02BCE4A6DEDD66E0F9D664A465B0 343 | 13C6F5B4DA7340502DBA0506DDB956FB 344 | 345 | isa 346 | PBXGroup 347 | name 348 | Pods-GYPageViewController_Example 349 | path 350 | Target Support Files/Pods-GYPageViewController_Example 351 | sourceTree 352 | <group> 353 | 354 | 422BDC9C6123942761D5E0D896917488 355 | 356 | includeInIndex 357 | 1 358 | isa 359 | PBXFileReference 360 | lastKnownFileType 361 | sourcecode.c.h 362 | name 363 | HMSegmentedControl.h 364 | path 365 | HMSegmentedControl/HMSegmentedControl.h 366 | sourceTree 367 | <group> 368 | 369 | 433CD3331B6C3787F473C941B61FC68F 370 | 371 | children 372 | 373 | 3926C638AD0708942C88C2BC89261735 374 | 375 | isa 376 | PBXGroup 377 | name 378 | Frameworks 379 | sourceTree 380 | <group> 381 | 382 | 48ECC7F1E9A41C6A27B54B366EC5019A 383 | 384 | buildActionMask 385 | 2147483647 386 | files 387 | 388 | BC56D9D67D700EDB23CAF47DD6EBC0EA 389 | B84836F7FC874648BD77A9F291E8E149 390 | 391 | isa 392 | PBXHeadersBuildPhase 393 | runOnlyForDeploymentPostprocessing 394 | 0 395 | 396 | 54ECB4ADDCC15F0A80354D93D6D7B084 397 | 398 | baseConfigurationReference 399 | 1B4B39F8305D481CE056ACB85113A089 400 | buildSettings 401 | 402 | CODE_SIGN_IDENTITY[sdk=iphoneos*] 403 | iPhone Developer 404 | CURRENT_PROJECT_VERSION 405 | 1 406 | DEFINES_MODULE 407 | YES 408 | DYLIB_COMPATIBILITY_VERSION 409 | 1 410 | DYLIB_CURRENT_VERSION 411 | 1 412 | DYLIB_INSTALL_NAME_BASE 413 | @rpath 414 | ENABLE_STRICT_OBJC_MSGSEND 415 | YES 416 | GCC_PREFIX_HEADER 417 | Target Support Files/HMSegmentedControl/HMSegmentedControl-prefix.pch 418 | INFOPLIST_FILE 419 | Target Support Files/HMSegmentedControl/Info.plist 420 | INSTALL_PATH 421 | $(LOCAL_LIBRARY_DIR)/Frameworks 422 | IPHONEOS_DEPLOYMENT_TARGET 423 | 7.0 424 | LD_RUNPATH_SEARCH_PATHS 425 | 426 | $(inherited) 427 | @executable_path/Frameworks 428 | @loader_path/Frameworks 429 | 430 | MODULEMAP_FILE 431 | Target Support Files/HMSegmentedControl/HMSegmentedControl.modulemap 432 | MTL_ENABLE_DEBUG_INFO 433 | YES 434 | PRODUCT_NAME 435 | HMSegmentedControl 436 | SDKROOT 437 | iphoneos 438 | SKIP_INSTALL 439 | YES 440 | TARGETED_DEVICE_FAMILY 441 | 1,2 442 | VERSIONING_SYSTEM 443 | apple-generic 444 | VERSION_INFO_PREFIX 445 | 446 | 447 | isa 448 | XCBuildConfiguration 449 | name 450 | Debug 451 | 452 | 5A60B762A017035F2E553810DE176E93 453 | 454 | includeInIndex 455 | 1 456 | isa 457 | PBXFileReference 458 | lastKnownFileType 459 | sourcecode.c.objc 460 | path 461 | HMSegmentedControl-dummy.m 462 | sourceTree 463 | <group> 464 | 465 | 5BCFC5EFDA7D1F36A32EEF0F1BDD6A75 466 | 467 | buildActionMask 468 | 2147483647 469 | files 470 | 471 | A6E67DEB921E16A09704BFDC8574B179 472 | 7A0A98778C517AECE63DBB7D599958A3 473 | 474 | isa 475 | PBXSourcesBuildPhase 476 | runOnlyForDeploymentPostprocessing 477 | 0 478 | 479 | 68BD7F91C7DADACED690F034DF220CA2 480 | 481 | buildConfigurationList 482 | A1915AF63D7466CAD869ECFA47897809 483 | buildPhases 484 | 485 | 9B43677C39AA306AAAAFB2B63A0ACC91 486 | 99DB9B7B8BFDFF9C8DDCD90079297DF2 487 | CEE3AEC544C38C57AD246522203EE2F3 488 | 489 | buildRules 490 | 491 | dependencies 492 | 493 | C28CFF643C308BFE7B498C70AF1B0BB2 494 | 495 | isa 496 | PBXNativeTarget 497 | name 498 | Pods-GYPageViewController_Example 499 | productName 500 | Pods-GYPageViewController_Example 501 | productReference 502 | 914C1CED89F4A611B944B9B36C2A43E5 503 | productType 504 | com.apple.product-type.framework 505 | 506 | 68BF5E99A99585C62E5EEBA13B2B3CB8 507 | 508 | baseConfigurationReference 509 | B06F02BCE4A6DEDD66E0F9D664A465B0 510 | buildSettings 511 | 512 | CODE_SIGN_IDENTITY[sdk=iphoneos*] 513 | iPhone Developer 514 | CURRENT_PROJECT_VERSION 515 | 1 516 | DEFINES_MODULE 517 | YES 518 | DYLIB_COMPATIBILITY_VERSION 519 | 1 520 | DYLIB_CURRENT_VERSION 521 | 1 522 | DYLIB_INSTALL_NAME_BASE 523 | @rpath 524 | ENABLE_STRICT_OBJC_MSGSEND 525 | YES 526 | INFOPLIST_FILE 527 | Target Support Files/Pods-GYPageViewController_Example/Info.plist 528 | INSTALL_PATH 529 | $(LOCAL_LIBRARY_DIR)/Frameworks 530 | IPHONEOS_DEPLOYMENT_TARGET 531 | 7.0 532 | LD_RUNPATH_SEARCH_PATHS 533 | 534 | $(inherited) 535 | @executable_path/Frameworks 536 | @loader_path/Frameworks 537 | 538 | MACH_O_TYPE 539 | staticlib 540 | MODULEMAP_FILE 541 | Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.modulemap 542 | MTL_ENABLE_DEBUG_INFO 543 | YES 544 | OTHER_LDFLAGS 545 | 546 | OTHER_LIBTOOLFLAGS 547 | 548 | PODS_ROOT 549 | $(SRCROOT) 550 | PRODUCT_NAME 551 | Pods_GYPageViewController_Example 552 | SDKROOT 553 | iphoneos 554 | SKIP_INSTALL 555 | YES 556 | TARGETED_DEVICE_FAMILY 557 | 1,2 558 | VERSIONING_SYSTEM 559 | apple-generic 560 | VERSION_INFO_PREFIX 561 | 562 | 563 | isa 564 | XCBuildConfiguration 565 | name 566 | Debug 567 | 568 | 71C1DF39EE1271EA1147F993CA1439A0 569 | 570 | buildConfigurationList 571 | 065AA8D5905013510AF2B2D77D72E8DF 572 | buildPhases 573 | 574 | 5BCFC5EFDA7D1F36A32EEF0F1BDD6A75 575 | F1B5E2E3E557858248F706F58B80B23F 576 | 48ECC7F1E9A41C6A27B54B366EC5019A 577 | 578 | buildRules 579 | 580 | dependencies 581 | 582 | isa 583 | PBXNativeTarget 584 | name 585 | HMSegmentedControl 586 | productName 587 | HMSegmentedControl 588 | productReference 589 | F809D2ACDC6B773E7CCDA3CEDBA6FFB5 590 | productType 591 | com.apple.product-type.framework 592 | 593 | 78209F736E1035735643FE21096AE895 594 | 595 | baseConfigurationReference 596 | 1B4B39F8305D481CE056ACB85113A089 597 | buildSettings 598 | 599 | CODE_SIGN_IDENTITY[sdk=iphoneos*] 600 | iPhone Developer 601 | CURRENT_PROJECT_VERSION 602 | 1 603 | DEFINES_MODULE 604 | YES 605 | DYLIB_COMPATIBILITY_VERSION 606 | 1 607 | DYLIB_CURRENT_VERSION 608 | 1 609 | DYLIB_INSTALL_NAME_BASE 610 | @rpath 611 | ENABLE_STRICT_OBJC_MSGSEND 612 | YES 613 | GCC_PREFIX_HEADER 614 | Target Support Files/HMSegmentedControl/HMSegmentedControl-prefix.pch 615 | INFOPLIST_FILE 616 | Target Support Files/HMSegmentedControl/Info.plist 617 | INSTALL_PATH 618 | $(LOCAL_LIBRARY_DIR)/Frameworks 619 | IPHONEOS_DEPLOYMENT_TARGET 620 | 7.0 621 | LD_RUNPATH_SEARCH_PATHS 622 | 623 | $(inherited) 624 | @executable_path/Frameworks 625 | @loader_path/Frameworks 626 | 627 | MODULEMAP_FILE 628 | Target Support Files/HMSegmentedControl/HMSegmentedControl.modulemap 629 | MTL_ENABLE_DEBUG_INFO 630 | NO 631 | PRODUCT_NAME 632 | HMSegmentedControl 633 | SDKROOT 634 | iphoneos 635 | SKIP_INSTALL 636 | YES 637 | TARGETED_DEVICE_FAMILY 638 | 1,2 639 | VERSIONING_SYSTEM 640 | apple-generic 641 | VERSION_INFO_PREFIX 642 | 643 | 644 | isa 645 | XCBuildConfiguration 646 | name 647 | Release 648 | 649 | 7A0A98778C517AECE63DBB7D599958A3 650 | 651 | fileRef 652 | FC171FEF35266CA040CF7D5D7740E472 653 | isa 654 | PBXBuildFile 655 | 656 | 7B6AB2EAF126D26192A24E97BB2CA6C1 657 | 658 | children 659 | 660 | 422BDC9C6123942761D5E0D896917488 661 | FC171FEF35266CA040CF7D5D7740E472 662 | 0D267D44B46D8EF79C2C8E6AF4F0E81D 663 | 664 | isa 665 | PBXGroup 666 | name 667 | HMSegmentedControl 668 | path 669 | HMSegmentedControl 670 | sourceTree 671 | <group> 672 | 673 | 7DB346D0F39D3F0E887471402A8071AB 674 | 675 | children 676 | 677 | BA6428E9F66FD5A23C0A2E06ED26CD2F 678 | 433CD3331B6C3787F473C941B61FC68F 679 | 38819E54439A6559568A5EB474E29D40 680 | E1BA1C0E83E9E6C305A8FC698C427D64 681 | 95628C8538AB831591D30F7FA946BE44 682 | 683 | isa 684 | PBXGroup 685 | sourceTree 686 | <group> 687 | 688 | 914C1CED89F4A611B944B9B36C2A43E5 689 | 690 | explicitFileType 691 | wrapper.framework 692 | includeInIndex 693 | 0 694 | isa 695 | PBXFileReference 696 | name 697 | Pods_GYPageViewController_Example.framework 698 | path 699 | Pods_GYPageViewController_Example.framework 700 | sourceTree 701 | BUILT_PRODUCTS_DIR 702 | 703 | 95628C8538AB831591D30F7FA946BE44 704 | 705 | children 706 | 707 | 3A3B01BCC68FC8960E130FA5890CE1CD 708 | 709 | isa 710 | PBXGroup 711 | name 712 | Targets Support Files 713 | sourceTree 714 | <group> 715 | 716 | 99DB9B7B8BFDFF9C8DDCD90079297DF2 717 | 718 | buildActionMask 719 | 2147483647 720 | files 721 | 722 | 060827A21CB1E5E56ABB15198472714A 723 | 724 | isa 725 | PBXFrameworksBuildPhase 726 | runOnlyForDeploymentPostprocessing 727 | 0 728 | 729 | 9B43677C39AA306AAAAFB2B63A0ACC91 730 | 731 | buildActionMask 732 | 2147483647 733 | files 734 | 735 | D982EC1F99BFBF6C98DB697D2D932C56 736 | 737 | isa 738 | PBXSourcesBuildPhase 739 | runOnlyForDeploymentPostprocessing 740 | 0 741 | 742 | 9C5076C79A4ABEE5B49A2E741E85EF9F 743 | 744 | includeInIndex 745 | 1 746 | isa 747 | PBXFileReference 748 | lastKnownFileType 749 | text.plist.xml 750 | path 751 | Info.plist 752 | sourceTree 753 | <group> 754 | 755 | A1915AF63D7466CAD869ECFA47897809 756 | 757 | buildConfigurations 758 | 759 | 68BF5E99A99585C62E5EEBA13B2B3CB8 760 | 2E30580CCB294AF085DB7E6440586FF6 761 | 762 | defaultConfigurationIsVisible 763 | 0 764 | defaultConfigurationName 765 | Release 766 | isa 767 | XCConfigurationList 768 | 769 | A6E67DEB921E16A09704BFDC8574B179 770 | 771 | fileRef 772 | 5A60B762A017035F2E553810DE176E93 773 | isa 774 | PBXBuildFile 775 | 776 | AA1C24BA61F025A4A2FD5F0D4836F001 777 | 778 | includeInIndex 779 | 1 780 | isa 781 | PBXFileReference 782 | path 783 | HMSegmentedControl.modulemap 784 | sourceTree 785 | <group> 786 | 787 | AFD4E8A30870E5FD44F04306824AB09A 788 | 789 | fileRef 790 | 280B94A5AB5C466A4247CD871C7A70E3 791 | isa 792 | PBXBuildFile 793 | settings 794 | 795 | ATTRIBUTES 796 | 797 | Public 798 | 799 | 800 | 801 | B06F02BCE4A6DEDD66E0F9D664A465B0 802 | 803 | includeInIndex 804 | 1 805 | isa 806 | PBXFileReference 807 | lastKnownFileType 808 | text.xcconfig 809 | path 810 | Pods-GYPageViewController_Example.debug.xcconfig 811 | sourceTree 812 | <group> 813 | 814 | B18F24645AA4D651DFC7B69A3A0833DB 815 | 816 | isa 817 | PBXFileReference 818 | lastKnownFileType 819 | wrapper.framework 820 | name 821 | QuartzCore.framework 822 | path 823 | Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/QuartzCore.framework 824 | sourceTree 825 | DEVELOPER_DIR 826 | 827 | B37F0F91F85060E28F1DAAB522DC7EC1 828 | 829 | buildSettings 830 | 831 | ALWAYS_SEARCH_USER_PATHS 832 | NO 833 | CLANG_CXX_LANGUAGE_STANDARD 834 | gnu++0x 835 | CLANG_CXX_LIBRARY 836 | libc++ 837 | CLANG_ENABLE_MODULES 838 | YES 839 | CLANG_ENABLE_OBJC_ARC 840 | YES 841 | CLANG_WARN_BOOL_CONVERSION 842 | YES 843 | CLANG_WARN_CONSTANT_CONVERSION 844 | YES 845 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE 846 | YES 847 | CLANG_WARN_EMPTY_BODY 848 | YES 849 | CLANG_WARN_ENUM_CONVERSION 850 | YES 851 | CLANG_WARN_INT_CONVERSION 852 | YES 853 | CLANG_WARN_OBJC_ROOT_CLASS 854 | YES 855 | CLANG_WARN_UNREACHABLE_CODE 856 | YES 857 | CLANG_WARN__DUPLICATE_METHOD_MATCH 858 | YES 859 | COPY_PHASE_STRIP 860 | NO 861 | GCC_C_LANGUAGE_STANDARD 862 | gnu99 863 | GCC_DYNAMIC_NO_PIC 864 | NO 865 | GCC_OPTIMIZATION_LEVEL 866 | 0 867 | GCC_PREPROCESSOR_DEFINITIONS 868 | 869 | DEBUG=1 870 | $(inherited) 871 | 872 | GCC_SYMBOLS_PRIVATE_EXTERN 873 | NO 874 | GCC_WARN_64_TO_32_BIT_CONVERSION 875 | YES 876 | GCC_WARN_ABOUT_RETURN_TYPE 877 | YES 878 | GCC_WARN_UNDECLARED_SELECTOR 879 | YES 880 | GCC_WARN_UNINITIALIZED_AUTOS 881 | YES 882 | GCC_WARN_UNUSED_FUNCTION 883 | YES 884 | GCC_WARN_UNUSED_VARIABLE 885 | YES 886 | IPHONEOS_DEPLOYMENT_TARGET 887 | 7.0 888 | ONLY_ACTIVE_ARCH 889 | YES 890 | STRIP_INSTALLED_PRODUCT 891 | NO 892 | SYMROOT 893 | ${SRCROOT}/../build 894 | 895 | isa 896 | XCBuildConfiguration 897 | name 898 | Debug 899 | 900 | B6ED7600D78934086D6B3F05A24D58C5 901 | 902 | includeInIndex 903 | 1 904 | isa 905 | PBXFileReference 906 | path 907 | Pods-GYPageViewController_Example.modulemap 908 | sourceTree 909 | <group> 910 | 911 | B84836F7FC874648BD77A9F291E8E149 912 | 913 | fileRef 914 | 422BDC9C6123942761D5E0D896917488 915 | isa 916 | PBXBuildFile 917 | settings 918 | 919 | ATTRIBUTES 920 | 921 | Public 922 | 923 | 924 | 925 | BA6428E9F66FD5A23C0A2E06ED26CD2F 926 | 927 | includeInIndex 928 | 1 929 | isa 930 | PBXFileReference 931 | lastKnownFileType 932 | text 933 | name 934 | Podfile 935 | path 936 | ../Podfile 937 | sourceTree 938 | SOURCE_ROOT 939 | xcLanguageSpecificationIdentifier 940 | xcode.lang.ruby 941 | 942 | BC56D9D67D700EDB23CAF47DD6EBC0EA 943 | 944 | fileRef 945 | C7AD363978D053D998F33619B64AD5BC 946 | isa 947 | PBXBuildFile 948 | settings 949 | 950 | ATTRIBUTES 951 | 952 | Public 953 | 954 | 955 | 956 | C28CFF643C308BFE7B498C70AF1B0BB2 957 | 958 | isa 959 | PBXTargetDependency 960 | name 961 | HMSegmentedControl 962 | target 963 | 71C1DF39EE1271EA1147F993CA1439A0 964 | targetProxy 965 | 223694660E2721CC985294E4182BDA36 966 | 967 | C6F4E5A720E5708C4069C210ED52FD2B 968 | 969 | includeInIndex 970 | 1 971 | isa 972 | PBXFileReference 973 | lastKnownFileType 974 | text.plist.xml 975 | path 976 | Pods-GYPageViewController_Example-acknowledgements.plist 977 | sourceTree 978 | <group> 979 | 980 | C75D9A388AC597502EA7D166CDA66D3D 981 | 982 | includeInIndex 983 | 1 984 | isa 985 | PBXFileReference 986 | lastKnownFileType 987 | sourcecode.c.objc 988 | path 989 | Pods-GYPageViewController_Example-dummy.m 990 | sourceTree 991 | <group> 992 | 993 | C7AD363978D053D998F33619B64AD5BC 994 | 995 | includeInIndex 996 | 1 997 | isa 998 | PBXFileReference 999 | lastKnownFileType 1000 | sourcecode.c.h 1001 | path 1002 | HMSegmentedControl-umbrella.h 1003 | sourceTree 1004 | <group> 1005 | 1006 | C8F7C797D3F0C6D0E55828EB5A4C2A2D 1007 | 1008 | includeInIndex 1009 | 1 1010 | isa 1011 | PBXFileReference 1012 | lastKnownFileType 1013 | text.script.sh 1014 | path 1015 | Pods-GYPageViewController_Example-resources.sh 1016 | sourceTree 1017 | <group> 1018 | 1019 | CEE3AEC544C38C57AD246522203EE2F3 1020 | 1021 | buildActionMask 1022 | 2147483647 1023 | files 1024 | 1025 | AFD4E8A30870E5FD44F04306824AB09A 1026 | 1027 | isa 1028 | PBXHeadersBuildPhase 1029 | runOnlyForDeploymentPostprocessing 1030 | 0 1031 | 1032 | D41D8CD98F00B204E9800998ECF8427E 1033 | 1034 | attributes 1035 | 1036 | LastSwiftUpdateCheck 1037 | 0700 1038 | LastUpgradeCheck 1039 | 0700 1040 | 1041 | buildConfigurationList 1042 | 2D8E8EC45A3A1A1D94AE762CB5028504 1043 | compatibilityVersion 1044 | Xcode 3.2 1045 | developmentRegion 1046 | English 1047 | hasScannedForEncodings 1048 | 0 1049 | isa 1050 | PBXProject 1051 | knownRegions 1052 | 1053 | en 1054 | 1055 | mainGroup 1056 | 7DB346D0F39D3F0E887471402A8071AB 1057 | productRefGroup 1058 | E1BA1C0E83E9E6C305A8FC698C427D64 1059 | projectDirPath 1060 | 1061 | projectReferences 1062 | 1063 | projectRoot 1064 | 1065 | targets 1066 | 1067 | 71C1DF39EE1271EA1147F993CA1439A0 1068 | 68BD7F91C7DADACED690F034DF220CA2 1069 | 1070 | 1071 | D982EC1F99BFBF6C98DB697D2D932C56 1072 | 1073 | fileRef 1074 | C75D9A388AC597502EA7D166CDA66D3D 1075 | isa 1076 | PBXBuildFile 1077 | 1078 | E1BA1C0E83E9E6C305A8FC698C427D64 1079 | 1080 | children 1081 | 1082 | F809D2ACDC6B773E7CCDA3CEDBA6FFB5 1083 | 914C1CED89F4A611B944B9B36C2A43E5 1084 | 1085 | isa 1086 | PBXGroup 1087 | name 1088 | Products 1089 | sourceTree 1090 | <group> 1091 | 1092 | E6D80CD0DC3E14F5F9CDBCE92986CDC5 1093 | 1094 | includeInIndex 1095 | 1 1096 | isa 1097 | PBXFileReference 1098 | lastKnownFileType 1099 | text.plist.xml 1100 | path 1101 | Info.plist 1102 | sourceTree 1103 | <group> 1104 | 1105 | F05541B20E779A463D53892816622D06 1106 | 1107 | includeInIndex 1108 | 1 1109 | isa 1110 | PBXFileReference 1111 | lastKnownFileType 1112 | sourcecode.c.h 1113 | path 1114 | HMSegmentedControl-prefix.pch 1115 | sourceTree 1116 | <group> 1117 | 1118 | F1B5E2E3E557858248F706F58B80B23F 1119 | 1120 | buildActionMask 1121 | 2147483647 1122 | files 1123 | 1124 | 296E453AD165A3259916C9DD032EC38A 1125 | 0DA1539DF2A64AEE5C3D7B7FA5A883AB 1126 | 1127 | isa 1128 | PBXFrameworksBuildPhase 1129 | runOnlyForDeploymentPostprocessing 1130 | 0 1131 | 1132 | F809D2ACDC6B773E7CCDA3CEDBA6FFB5 1133 | 1134 | explicitFileType 1135 | wrapper.framework 1136 | includeInIndex 1137 | 0 1138 | isa 1139 | PBXFileReference 1140 | name 1141 | HMSegmentedControl.framework 1142 | path 1143 | HMSegmentedControl.framework 1144 | sourceTree 1145 | BUILT_PRODUCTS_DIR 1146 | 1147 | FC171FEF35266CA040CF7D5D7740E472 1148 | 1149 | includeInIndex 1150 | 1 1151 | isa 1152 | PBXFileReference 1153 | lastKnownFileType 1154 | sourcecode.c.objc 1155 | name 1156 | HMSegmentedControl.m 1157 | path 1158 | HMSegmentedControl/HMSegmentedControl.m 1159 | sourceTree 1160 | <group> 1161 | 1162 | 1163 | rootObject 1164 | D41D8CD98F00B204E9800998ECF8427E 1165 | 1166 | 1167 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GYPageViewController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/HMSegmentedControl-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_HMSegmentedControl : NSObject 3 | @end 4 | @implementation PodsDummy_HMSegmentedControl 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/HMSegmentedControl-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/HMSegmentedControl-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "HMSegmentedControl.h" 4 | 5 | FOUNDATION_EXPORT double HMSegmentedControlVersionNumber; 6 | FOUNDATION_EXPORT const unsigned char HMSegmentedControlVersionString[]; 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/HMSegmentedControl.modulemap: -------------------------------------------------------------------------------- 1 | framework module HMSegmentedControl { 2 | umbrella header "HMSegmentedControl-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/HMSegmentedControl.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/HMSegmentedControl" "${PODS_ROOT}/Headers/Public" 3 | OTHER_LDFLAGS = -framework "QuartzCore" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/HMSegmentedControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.5.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## HMSegmentedControl 5 | 6 | # License 7 | 8 | ## MIT License 9 | 10 | Copyright (c) 2012 Hesham Abd-Elmegid (http://www.hesh.am) 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in 20 | all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | THE SOFTWARE. 29 | Generated by CocoaPods - http://cocoapods.org 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | # License 18 | 19 | ## MIT License 20 | 21 | Copyright (c) 2012 Hesham Abd-Elmegid (http://www.hesh.am) 22 | 23 | Permission is hereby granted, free of charge, to any person obtaining a copy 24 | of this software and associated documentation files (the "Software"), to deal 25 | in the Software without restriction, including without limitation the rights 26 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27 | copies of the Software, and to permit persons to whom the Software is 28 | furnished to do so, subject to the following conditions: 29 | 30 | The above copyright notice and this permission notice shall be included in 31 | all copies or substantial portions of the Software. 32 | 33 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 39 | THE SOFTWARE. 40 | Title 41 | HMSegmentedControl 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Generated by CocoaPods - http://cocoapods.org 48 | Title 49 | 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | StringsTable 55 | Acknowledgements 56 | Title 57 | Acknowledgements 58 | 59 | 60 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_GYPageViewController_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_GYPageViewController_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | 86 | if [[ "$CONFIGURATION" == "Debug" ]]; then 87 | install_framework "Pods-GYPageViewController_Example/HMSegmentedControl.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-GYPageViewController_Example/HMSegmentedControl.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_GYPageViewController_ExampleVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_GYPageViewController_ExampleVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/HMSegmentedControl.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "HMSegmentedControl" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-GYPageViewController_Example 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_GYPageViewController_Example { 2 | umbrella header "Pods-GYPageViewController_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GYPageViewController_Example/Pods-GYPageViewController_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/HMSegmentedControl.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "HMSegmentedControl" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-GYPageViewController_Example 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // GYPageViewControllerTests.m 3 | // GYPageViewControllerTests 4 | // 5 | // Created by GaoYu on 06/20/2016. 6 | // Copyright (c) 2016 GaoYu. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/UIView+GYPauseAnimation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+GYPauseAnimation.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/6/13. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | func pauseAnimations() { 13 | let paused_time = self.layer.convertTime(CACurrentMediaTime(), to: nil) 14 | self.layer.speed = 0.0 15 | self.layer.timeOffset = paused_time 16 | } 17 | 18 | func resumeAnimations() { 19 | let paused_time = self.layer.timeOffset 20 | self.layer.speed = 1.0 21 | self.layer.timeOffset = 0.0 22 | self.layer.beginTime = 0.0 23 | let time_since_pause = self.layer.convertTime(CACurrentMediaTime(), to: nil) - paused_time 24 | self.layer.beginTime = time_since_pause 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Example/UIView+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | func gy_removeConstraintsAffectingView() { 13 | var currentSuperView = self.superview 14 | let constraintsToRemove = NSMutableArray() 15 | while currentSuperView != nil { 16 | if let constraints = currentSuperView?.constraints { 17 | for c in constraints { 18 | let isImplicitConstraint = (NSStringFromClass(type(of: c)) == "NSContentSizeLayoutConstraint") 19 | if isImplicitConstraint != true { 20 | if self.isEqual(c.firstItem) || self.isEqual(c.secondItem) { 21 | constraintsToRemove.add(c) 22 | } 23 | } 24 | } 25 | } 26 | currentSuperView = currentSuperView?.superview 27 | } 28 | 29 | constraintsToRemove.gy_autoRemoveConstraints() 30 | } 31 | 32 | func gy_commonSuperviewWithView(_ otherView:UIView) -> UIView? { 33 | var startView:UIView? = self 34 | var commonSuperview:UIView? 35 | 36 | repeat { 37 | if let obj = startView { 38 | if otherView.isDescendant(of: obj) { 39 | commonSuperview = obj 40 | } 41 | } 42 | startView = startView?.superview 43 | } while (startView != nil && commonSuperview == nil) 44 | assert(commonSuperview != nil, "Can't constrain two views that do not share a common superview. Make sure that both views have been added into the same view hierarchy.") 45 | return commonSuperview; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Example/UIViewController+ChildController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+ChildController.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | func gy_addChildViewController(_ viewController:UIViewController) { 13 | self.gy_addChildViewController(viewController,frame: self.view.bounds) 14 | } 15 | 16 | func gy_addChildViewController(_ viewController:UIViewController,inView:UIView,withFrame:CGRect) { 17 | self.gy_addChildViewController(viewController) { (superViewController,childViewController) in 18 | childViewController.view.frame = withFrame; 19 | 20 | if inView.subviews.contains(viewController.view) == false { 21 | inView.addSubview(viewController.view) 22 | } 23 | } 24 | } 25 | 26 | func gy_addChildViewController(_ viewController:UIViewController,frame:CGRect) { 27 | self.gy_addChildViewController(viewController) { (superViewController,childViewController) in 28 | childViewController.view.frame = frame; 29 | 30 | if superViewController.view.subviews.contains(viewController.view) == false { 31 | superViewController.view.addSubview(viewController.view) 32 | } 33 | } 34 | } 35 | 36 | func gy_addChildViewController(_ viewController:UIViewController, 37 | setSubViewAction:((_ superViewController:UIViewController,_ childViewController:UIViewController) -> Void)?) { 38 | 39 | let containsVC = self.childViewControllers.contains(viewController) 40 | 41 | if containsVC == false { 42 | self.addChildViewController(viewController) 43 | } 44 | 45 | setSubViewAction?(self,viewController) 46 | 47 | if containsVC == false { 48 | viewController.didMove(toParentViewController: self) 49 | } 50 | } 51 | 52 | func gy_removeFromParentViewControllerOnly() { 53 | self.willMove(toParentViewController: nil) 54 | self.removeFromParentViewController() 55 | } 56 | 57 | func gy_removeFromParentViewController() { 58 | self.willMove(toParentViewController: nil) 59 | self.view.removeFromSuperview() 60 | self.removeFromParentViewController() 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GYPageViewController.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint GYPageViewController.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'GYPageViewController' 11 | s.version = '0.1.0' 12 | s.summary = 'Implementation a page view controller with scroll view. To solve 2 Problems of UIPageViewController and take the place of UIPageViewController.' 13 | s.description = <<-DESC 14 | TODO: Add long description of the pod here. 15 | DESC 16 | 17 | s.homepage = 'https://github.com//GYPageViewController' 18 | s.license = { :type => 'MIT', :file => 'LICENSE' } 19 | s.author = { 'GaoYu' => 'fightrain@126.com' } 20 | s.source = { :git => 'https://github.com//GYPageViewController.git', :tag => s.version.to_s } 21 | s.ios.deployment_target = '8.0' 22 | s.source_files = 'GYPageViewController/Classes/**/*' 23 | s.dependency 'HMSegmentedControl', '~> 1.5.2' 24 | end 25 | -------------------------------------------------------------------------------- /GYPageViewController/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-gao/GYPageViewController/5b5d85abf033c6e3b56de369ab1f7613d13b72f7/GYPageViewController/Assets/.gitkeep -------------------------------------------------------------------------------- /GYPageViewController/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-gao/GYPageViewController/5b5d85abf033c6e3b56de369ab1f7613d13b72f7/GYPageViewController/Classes/.gitkeep -------------------------------------------------------------------------------- /GYPageViewController/Classes/GYPageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GYPageViewController.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/27. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum GYPageScrollDirection { 12 | case Left 13 | case Right 14 | } 15 | 16 | @objc protocol GYPageViewControllerDelegate { 17 | 18 | // Sent when a gesture-initiated transition begins. 19 | optional func gy_pageViewController(pageViewController: GYPageViewController, 20 | willTransitonFrom fromVC:UIViewController, 21 | toViewController toVC:UIViewController) 22 | 23 | // Sent when a gesture-initiated transition ends. 24 | optional func gy_pageViewController(pageViewController: GYPageViewController, 25 | didTransitonFrom fromVC:UIViewController, 26 | toViewController toVC:UIViewController) 27 | 28 | // Sent when method(func showPageAtIndex(index:Int,animated:Bool)) begin to be called. 29 | optional func gy_pageViewController(pageViewController: GYPageViewController, 30 | willLeaveViewController fromVC:UIViewController, 31 | toViewController toVC:UIViewController, 32 | animated:Bool) 33 | 34 | // Sent after method(func showPageAtIndex(index:Int,animated:Bool)) finished. 35 | optional func gy_pageViewController(pageViewController: GYPageViewController, 36 | didLeaveViewController fromVC:UIViewController, 37 | toViewController toVC:UIViewController, 38 | finished:Bool) 39 | } 40 | 41 | class GYPageViewController: UIViewController, UIScrollViewDelegate { 42 | private(set) var scrollView:UIScrollView! = UIScrollView() 43 | private(set) var pageControllers:Array! 44 | private(set) var currentPageIndex = 0 45 | private(set) var isDragging = false 46 | var contentEdgeInsets = UIEdgeInsetsZero 47 | weak var delegate:GYPageViewControllerDelegate? 48 | 49 | private var originOffset = 0.0 //用于手势拖动scrollView时,判断方向 50 | private var guessToIndex = -1 //用于手势拖动scrollView时,判断要去的页面 51 | private var lastSelectedIndex = 0 //用于记录上次选择的index 52 | private var firstWillAppear = true //用于界定页面首次WillAppear。 53 | private var firstDidAppear = true //用于界定页面首次DidAppear。 54 | private var firstDidLayoutSubViews = true //用于界定页面首次DidLayoutsubviews。 55 | private var firstWillLayoutSubViews = true //用于界定页面首次WillLayoutsubviews。 56 | 57 | 58 | //MARK: - Init 59 | required init?(coder aDecoder: NSCoder) { 60 | fatalError("init(coder:) has not been implemented") 61 | } 62 | 63 | init(pageControllers:Array) { 64 | super.init(nibName: nil, bundle: nil) 65 | self.pageControllers = pageControllers 66 | assert(self.pageControllers != nil) 67 | } 68 | 69 | //MARK: - Lift Cycles 70 | override func viewDidLoad() { 71 | super.viewDidLoad() 72 | 73 | self.view.backgroundColor = UIColor.whiteColor() 74 | 75 | self.configScrollView(self.scrollView) 76 | } 77 | 78 | override func viewWillAppear(animated: Bool) { 79 | super.viewWillAppear(animated) 80 | if self.firstWillAppear { 81 | //Config init page 82 | self.gy_pageViewControllerWillShow(self.lastSelectedIndex, toIndex: self.currentPageIndex, animated: false) 83 | self.delegate?.gy_pageViewController?(self, willLeaveViewController: self.pageControllers[self.lastSelectedIndex], toViewController: self.pageControllers[self.currentPageIndex], animated: false) 84 | self.pageControllers[self.currentPageIndex].beginAppearanceTransition(true, animated: true) 85 | // print("viewWillAppear beginAppearanceTransition self.currentPageIndex \(self.currentPageIndex)") 86 | self.firstWillAppear = false 87 | } 88 | } 89 | 90 | override func viewWillLayoutSubviews() { 91 | super.viewWillLayoutSubviews() 92 | self.view.layoutIfNeeded() 93 | if self.firstWillLayoutSubViews { 94 | //Solve scrollView bug: can scroll to negative offset when pushing a UIViewController containing a UIScrollView using a UINavigationController. 95 | if let navigationController = self.navigationController { 96 | if navigationController.viewControllers[navigationController.viewControllers.count - 1] == self{ 97 | self.scrollView.contentOffset = CGPointZero; 98 | self.scrollView.contentInset = UIEdgeInsetsZero; 99 | } 100 | } 101 | self.updateScrollViewLayoutIfNeeded() 102 | self.firstWillLayoutSubViews = false 103 | } else { 104 | self.updateScrollViewLayoutIfNeeded() 105 | } 106 | } 107 | 108 | override func viewDidLayoutSubviews() { 109 | super.viewDidLayoutSubviews() 110 | if self.firstDidLayoutSubViews { 111 | self.updateScrollViewDisplayIndexIfNeeded() 112 | self.firstDidLayoutSubViews = false 113 | } 114 | } 115 | 116 | override func viewDidAppear(animated: Bool) { 117 | super.viewDidAppear(animated) 118 | if self.firstDidAppear { 119 | self.pageControllers[self.currentPageIndex].endAppearanceTransition() 120 | // print("viewDidAppear endAppearanceTransition self.currentPageIndex \(self.currentPageIndex)") 121 | //Config init page did appear 122 | self.gy_pageViewControllerDidShow(self.lastSelectedIndex, toIndex: self.currentPageIndex, finished: true) 123 | self.delegate?.gy_pageViewController?(self, didLeaveViewController: self.pageControllers[self.lastSelectedIndex], toViewController: self.pageControllers[self.currentPageIndex], finished: true) 124 | 125 | self.firstDidAppear = false 126 | } 127 | } 128 | 129 | override func viewWillDisappear(animated: Bool) { 130 | super.viewWillDisappear(animated) 131 | self.pageControllers[self.currentPageIndex].beginAppearanceTransition(false, animated: true) 132 | // print("viewWillDisappear beginAppearanceTransition self.currentPageIndex \(self.currentPageIndex)") 133 | } 134 | 135 | override func viewDidDisappear(animated: Bool) { 136 | super.viewDidDisappear(animated) 137 | self.pageControllers[self.currentPageIndex].endAppearanceTransition() 138 | // print("viewDidDisappear endAppearanceTransition self.currentPageIndex \(self.currentPageIndex)") 139 | } 140 | 141 | //MARK: - Update controllers & views 142 | 143 | /** 144 | Change index through tabbar or mannually invoking 145 | 146 | Simulate an scroll animation instead of scroll view setContentOffset animation. 147 | Because of the scroll native animation during two not neighbouring views is an unelegant, scroll view will tour all the views between the source index and destination index. 148 | 149 | The simulated animation will bring source view and dest view to front and scroll the two view like neighbouring views.After animation move them back to origin index. 150 | 151 | - parameter index: change to index 152 | - parameter animated: animation bool. true to animate, false not animate 153 | */ 154 | @objc func showPageAtIndex(index:Int,animated:Bool) { 155 | if index < 0 || index >= self.pageControllers.count { 156 | return 157 | } 158 | 159 | // Prepare to scroll if scrollView is initialized and displayed correctly 160 | if self.scrollView.frame.size.width > 0.0 && 161 | self.scrollView.contentSize.width > 0.0{ 162 | 163 | self.gy_pageViewControllerWillShow(self.currentPageIndex, toIndex: index, animated: animated) 164 | self.delegate?.gy_pageViewController?(self, willLeaveViewController: self.pageControllers[self.currentPageIndex], 165 | toViewController: self.pageControllers[index], animated: animated) 166 | 167 | self.addVisibleViewContorllerWith(index) 168 | } 169 | 170 | // Synchronize the indexs and store old select index 171 | let oldSelectedIndex = self.lastSelectedIndex 172 | self.lastSelectedIndex = self.currentPageIndex 173 | self.currentPageIndex = index 174 | 175 | // Scroll to current index if scrollView is initialized and displayed correctly 176 | if self.scrollView.frame.size.width > 0.0 && 177 | self.scrollView.contentSize.width > 0.0{ 178 | 179 | // Aciton closure before simulated scroll animation 180 | let scrollBeginAnimation = { () -> Void in 181 | self.pageControllers[self.currentPageIndex].beginAppearanceTransition(true, animated: animated) 182 | if self.currentPageIndex != self.lastSelectedIndex { 183 | self.pageControllers[self.lastSelectedIndex].beginAppearanceTransition(false, animated: animated) 184 | } 185 | } 186 | 187 | /* Scroll closure invoke setContentOffset with animation false. Because the scroll animation is customed. 188 | * 189 | * Simulate scroll animation among oldSelectView, lastView and currentView. 190 | * After simulated animation the scrollAnimation closure is invoked 191 | */ 192 | let scrollAnimation = { () -> Void in 193 | self.scrollView.setContentOffset(self.calcOffsetWithIndex( 194 | self.currentPageIndex, 195 | width:Float(self.scrollView.frame.size.width), 196 | maxWidth:Float(self.scrollView.contentSize.width)), animated: false) 197 | } 198 | 199 | // Action closure after simulated scroll animation 200 | let scrollEndAnimation = { () -> Void in 201 | self.pageControllers[self.currentPageIndex].endAppearanceTransition() 202 | if self.currentPageIndex != self.lastSelectedIndex { 203 | self.pageControllers[self.lastSelectedIndex].endAppearanceTransition() 204 | } 205 | 206 | self.gy_pageViewControllerDidShow(self.lastSelectedIndex, toIndex: self.currentPageIndex, finished: animated) 207 | self.delegate?.gy_pageViewController?(self, didLeaveViewController: self.pageControllers[self.lastSelectedIndex], 208 | toViewController: self.pageControllers[self.currentPageIndex], 209 | finished:animated) 210 | } 211 | 212 | scrollBeginAnimation() 213 | 214 | if animated { 215 | if self.lastSelectedIndex != self.currentPageIndex { 216 | // Define variables 217 | let pageSize = self.scrollView.frame.size 218 | let direction = (self.lastSelectedIndex < self.currentPageIndex) ? GYPageScrollDirection.Right : GYPageScrollDirection.Left 219 | let lastView = self.pageControllers[self.lastSelectedIndex].view 220 | let currentView = self.pageControllers[self.currentPageIndex].view 221 | let oldSelectView = self.pageControllers[oldSelectedIndex].view 222 | let duration = 0.3 223 | let backgroundIndex = self.calcIndexWithOffset(Float(self.scrollView.contentOffset.x), 224 | width: Float(self.scrollView.frame.size.width)) 225 | var backgroundView:UIView? 226 | 227 | /* 228 | * To solve the problem: when multiple animations were fired, there is an extra unuseful view appeared under the scrollview's two subviews(used to simulate animation: lastView, currentView). 229 | * 230 | * Hide the extra view, and after the animation is finished set its hidden property false. 231 | */ 232 | if oldSelectView.layer.animationKeys()?.count > 0 && 233 | lastView.layer.animationKeys()?.count > 0 234 | { 235 | let tmpView = self.pageControllers[backgroundIndex].view 236 | if tmpView != currentView && 237 | tmpView != lastView 238 | { 239 | backgroundView = tmpView 240 | backgroundView?.hidden = true 241 | } 242 | } 243 | 244 | // Cancel animations is not completed when multiple animations are fired 245 | self.scrollView.layer.removeAllAnimations() 246 | oldSelectView.layer.removeAllAnimations() 247 | lastView.layer.removeAllAnimations() 248 | currentView.layer.removeAllAnimations() 249 | 250 | // oldSelectView is not useful for simulating animation, move it to origin position. 251 | self.moveBackToOriginPositionIfNeeded(oldSelectView, index: oldSelectedIndex) 252 | 253 | // Bring the views for simulating scroll animation to front and make them visible 254 | self.scrollView.bringSubviewToFront(lastView) 255 | self.scrollView.bringSubviewToFront(currentView) 256 | lastView.hidden = false 257 | currentView.hidden = false 258 | 259 | // Calculate start positions , animate to positions , end positions for simulating animation views(lastView, currentView) 260 | let lastView_StartOrigin = lastView.frame.origin 261 | var currentView_StartOrigin = lastView.frame.origin 262 | if direction == .Right { 263 | currentView_StartOrigin.x += self.scrollView.frame.size.width 264 | } else { 265 | currentView_StartOrigin.x -= self.scrollView.frame.size.width 266 | } 267 | 268 | var lastView_AnimateToOrigin = lastView.frame.origin 269 | if direction == .Right { 270 | lastView_AnimateToOrigin.x -= self.scrollView.frame.size.width 271 | } else { 272 | lastView_AnimateToOrigin.x += self.scrollView.frame.size.width 273 | } 274 | let currentView_AnimateToOrigin = lastView.frame.origin 275 | 276 | let lastView_EndOrigin = lastView.frame.origin 277 | let currentView_EndOrigin = currentView.frame.origin 278 | 279 | /* 280 | * Simulate scroll animation 281 | * Bring two views(lastView, currentView) to front and simulate scroll in neighbouring position. 282 | */ 283 | lastView.frame = CGRectMake(lastView_StartOrigin.x, lastView_StartOrigin.y, pageSize.width, pageSize.height) 284 | currentView.frame = CGRectMake(currentView_StartOrigin.x, currentView_StartOrigin.y, pageSize.width, pageSize.height) 285 | 286 | UIView.animateWithDuration(duration, 287 | delay: 0.0, 288 | options: .CurveEaseInOut, 289 | animations: 290 | { 291 | lastView.frame = CGRectMake(lastView_AnimateToOrigin.x, lastView_AnimateToOrigin.y, pageSize.width, pageSize.height) 292 | currentView.frame = CGRectMake(currentView_AnimateToOrigin.x, currentView_AnimateToOrigin.y, pageSize.width, pageSize.height) 293 | }, 294 | completion: 295 | { [weak self] (finished) in 296 | if finished { 297 | lastView.frame = CGRectMake(lastView_EndOrigin.x, lastView_EndOrigin.y, pageSize.width, pageSize.height) 298 | currentView.frame = CGRectMake(currentView_EndOrigin.x, currentView_EndOrigin.y, pageSize.width, pageSize.height) 299 | backgroundView?.hidden = false 300 | if let weakSelf = self { 301 | weakSelf.moveBackToOriginPositionIfNeeded(currentView, index: weakSelf.currentPageIndex) 302 | weakSelf.moveBackToOriginPositionIfNeeded(lastView, index: weakSelf.lastSelectedIndex) 303 | } 304 | scrollAnimation() 305 | scrollEndAnimation() 306 | } 307 | } 308 | ) 309 | } else { 310 | // Scroll without animation if current page is the same with last page 311 | scrollAnimation() 312 | scrollEndAnimation() 313 | } 314 | } else { 315 | // Scroll without animation if animated is false 316 | scrollAnimation() 317 | scrollEndAnimation() 318 | } 319 | } 320 | } 321 | 322 | @objc private func moveBackToOriginPositionIfNeeded(view:UIView?,index:Int) 323 | { 324 | if index < 0 || index >= self.pageControllers.count { 325 | return 326 | } 327 | 328 | guard let destView = view else { print("moveBackToOriginPositionIfNeeded view nil"); return;} 329 | 330 | 331 | let originPosition = self.calcOffsetWithIndex(index, 332 | width: Float(self.scrollView.frame.size.width), 333 | maxWidth: Float(self.scrollView.contentSize.width)) 334 | if destView.frame.origin.x != originPosition.x { 335 | var newFrame = destView.frame 336 | newFrame.origin = originPosition 337 | destView.frame = newFrame 338 | } 339 | } 340 | 341 | @objc private func calcVisibleViewControllerFrameWith(index:Int) -> CGRect { 342 | var offsetX = 0.0 343 | offsetX = Double(index) * Double(self.scrollView.frame.size.width) 344 | return CGRectMake(CGFloat(offsetX), 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height) 345 | } 346 | 347 | @objc private func addVisibleViewContorllerWith(index:Int) { 348 | if index < 0 || index > self.pageControllers.count { 349 | return 350 | } 351 | let childViewFrame = self.calcVisibleViewControllerFrameWith(index) 352 | self.gy_addChildViewController(self.pageControllers[index], 353 | inView: self.scrollView, 354 | withFrame: childViewFrame) 355 | } 356 | 357 | @objc private func updateScrollViewDisplayIndexIfNeeded() { 358 | if self.scrollView.frame.size.width > 0.0 { 359 | self.addVisibleViewContorllerWith(self.currentPageIndex) 360 | let newOffset = self.calcOffsetWithIndex( 361 | self.currentPageIndex, 362 | width:Float(self.scrollView.frame.size.width), 363 | maxWidth:Float(self.scrollView.contentSize.width)) 364 | 365 | if newOffset.x != self.scrollView.contentOffset.x || 366 | newOffset.y != self.scrollView.contentOffset.y 367 | { 368 | self.scrollView.contentOffset = newOffset 369 | } 370 | self.pageControllers[self.currentPageIndex].view.frame = self.calcVisibleViewControllerFrameWith(self.currentPageIndex) 371 | } 372 | } 373 | 374 | // Do not use it in viewDidLayoutSubviews on ios 7 device. 375 | @objc private func updateScrollViewLayoutIfNeeded() { 376 | if self.scrollView.frame.size.width > 0.0 { 377 | let width = CGFloat(self.pageControllers.count) * self.scrollView.frame.size.width 378 | let height = self.scrollView.frame.size.height 379 | let oldContentSize = self.scrollView.contentSize 380 | if width != oldContentSize.width || 381 | height != oldContentSize.height 382 | { 383 | self.scrollView.contentSize = CGSizeMake(width, height) 384 | } 385 | } 386 | } 387 | 388 | //MARK: - Helper methods 389 | @objc private func calcOffsetWithIndex(index:Int,width:Float,maxWidth:Float) -> CGPoint { 390 | var offsetX = Float(Float(index) * width) 391 | 392 | if offsetX < 0 { 393 | offsetX = 0 394 | } 395 | 396 | if maxWidth > 0.0 && 397 | offsetX > maxWidth - width 398 | { 399 | offsetX = maxWidth - width 400 | } 401 | 402 | return CGPointMake(CGFloat(offsetX),0) 403 | } 404 | 405 | @objc private func calcIndexWithOffset(offset:Float,width:Float) -> Int { 406 | var startIndex = Int(offset/width) 407 | 408 | if startIndex < 0 { 409 | startIndex = 0 410 | } 411 | 412 | return startIndex 413 | } 414 | 415 | //MARK: - Subviews Configuration 416 | @objc private func configScrollView(scrollView:UIScrollView) { 417 | scrollView.translatesAutoresizingMaskIntoConstraints = false 418 | scrollView.delegate = self 419 | scrollView.showsHorizontalScrollIndicator = false 420 | scrollView.showsVerticalScrollIndicator = false 421 | scrollView.pagingEnabled = true 422 | scrollView.backgroundColor = UIColor.clearColor() 423 | scrollView.scrollsToTop = false 424 | 425 | self.view.addSubview(scrollView) 426 | 427 | var constraints = Array() 428 | let constraintAttributesDic:Dictionary = [.Leading:self.contentEdgeInsets.left, 429 | .Trailing:self.contentEdgeInsets.right] 430 | 431 | for attribute in constraintAttributesDic.keys { 432 | let constraint = NSLayoutConstraint(item: scrollView, 433 | attribute: attribute, 434 | relatedBy: .Equal, 435 | toItem: self.view, 436 | attribute: attribute, 437 | multiplier: 1.0, 438 | constant: constraintAttributesDic[attribute] ?? 0 ) 439 | constraints.append(constraint) 440 | } 441 | 442 | let topConstraint = NSLayoutConstraint(item: scrollView, 443 | attribute: .Top, 444 | relatedBy: .Equal, 445 | toItem: self.topLayoutGuide, 446 | attribute: .Bottom, 447 | multiplier: 1.0, 448 | constant: self.contentEdgeInsets.top) 449 | constraints.append(topConstraint) 450 | 451 | let bottomConstraint = NSLayoutConstraint(item: scrollView, 452 | attribute: .Bottom, 453 | relatedBy: .Equal, 454 | toItem: self.bottomLayoutGuide, 455 | attribute: .Top, 456 | multiplier: 1.0, 457 | constant: self.contentEdgeInsets.bottom) 458 | constraints.append(bottomConstraint) 459 | 460 | self.view.addConstraints(constraints) 461 | } 462 | 463 | //MARK: - UIScrollViewDelegate 464 | // any offset changes 465 | func scrollViewDidScroll(scrollView: UIScrollView) { 466 | if scrollView.dragging == true && scrollView == self.scrollView { 467 | let offset = scrollView.contentOffset.x 468 | let width = CGRectGetWidth(scrollView.frame) 469 | let lastGuessIndex = self.guessToIndex < 0 ? self.currentPageIndex : self.guessToIndex 470 | if self.originOffset < Double(offset) { 471 | self.guessToIndex = Int(ceil((offset)/width)) 472 | } else if (self.originOffset > Double(offset)) { 473 | self.guessToIndex = Int(floor((offset)/width)) 474 | } else {} 475 | let maxCount = self.pageControllers.count 476 | 477 | if lastGuessIndex != guessToIndex && 478 | guessToIndex != self.currentPageIndex && 479 | self.guessToIndex >= 0 && 480 | self.guessToIndex < maxCount 481 | { 482 | self.gy_pageViewControllerWillShow(self.guessToIndex, toIndex: self.currentPageIndex, animated: true) 483 | self.delegate?.gy_pageViewController?(self, willTransitonFrom: self.pageControllers[self.guessToIndex], 484 | toViewController: self.pageControllers[self.currentPageIndex]) 485 | 486 | self.addVisibleViewContorllerWith(self.guessToIndex) 487 | self.pageControllers[self.guessToIndex].beginAppearanceTransition(true, animated: true) 488 | // print("scrollViewDidScroll beginAppearanceTransition self.guessToIndex \(self.guessToIndex)") 489 | /** 490 | * Solve problem: When scroll with interaction, scroll page from one direction to the other for more than one time, the beginAppearanceTransition() method will invoke more than once but only one time endAppearanceTransition() invoked, so that the life cycle methods not correct. 491 | * When lastGuessIndex = self.currentPageIndex is the first time which need to invoke beginAppearanceTransition(). 492 | */ 493 | if lastGuessIndex == self.currentPageIndex { 494 | self.pageControllers[self.currentPageIndex].beginAppearanceTransition(false, animated: true) 495 | // print("scrollViewDidScroll beginAppearanceTransition self.currentPageIndex \(self.currentPageIndex)") 496 | } 497 | 498 | if lastGuessIndex != self.currentPageIndex && 499 | lastGuessIndex >= 0 && 500 | lastGuessIndex < maxCount{ 501 | self.pageControllers[lastGuessIndex].beginAppearanceTransition(false, animated: true) 502 | // print("scrollViewDidScroll beginAppearanceTransition lastGuessIndex \(lastGuessIndex)") 503 | self.pageControllers[lastGuessIndex].endAppearanceTransition() 504 | // print("scrollViewDidScroll endAppearanceTransition lastGuessIndex \(lastGuessIndex)") 505 | } 506 | } 507 | } 508 | // print("==== DidScroll dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 509 | } 510 | 511 | // called on finger up as we are moving 512 | func scrollViewWillBeginDecelerating(scrollView: UIScrollView) { 513 | // print("==== BeginDecelerating dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 514 | } 515 | 516 | // called when scroll view grinds to a halt 517 | func scrollViewDidEndDecelerating(scrollView: UIScrollView) { 518 | let newIndex = self.calcIndexWithOffset(Float(scrollView.contentOffset.x), 519 | width: Float(scrollView.frame.size.width)) 520 | let oldIndex = self.currentPageIndex 521 | self.currentPageIndex = newIndex 522 | 523 | if newIndex == oldIndex {//最终确定的位置与其实位置相同时,需要重新显示其实位置的视图,以及消失最近一次猜测的位置的视图。 524 | if self.guessToIndex >= 0 && self.guessToIndex < self.pageControllers.count { 525 | self.pageControllers[oldIndex].beginAppearanceTransition(true, animated: true) 526 | // print("EndDecelerating same beginAppearanceTransition oldIndex \(oldIndex)") 527 | self.pageControllers[oldIndex].endAppearanceTransition() 528 | // print("EndDecelerating same endAppearanceTransition oldIndex \(oldIndex)") 529 | self.pageControllers[self.guessToIndex].beginAppearanceTransition(false, animated: true) 530 | // print("EndDecelerating same beginAppearanceTransition self.guessToIndex \(self.guessToIndex)") 531 | self.pageControllers[self.guessToIndex].endAppearanceTransition() 532 | // print("EndDecelerating same endAppearanceTransition self.guessToIndex \(self.guessToIndex)") 533 | } 534 | } else { 535 | self.pageControllers[newIndex].endAppearanceTransition() 536 | // print("EndDecelerating endAppearanceTransition newIndex \(newIndex)") 537 | self.pageControllers[oldIndex].endAppearanceTransition() 538 | // print("EndDecelerating endAppearanceTransition oldIndex \(oldIndex)") 539 | } 540 | 541 | if self.guessToIndex >= 0 && self.guessToIndex < self.pageControllers.count { 542 | self.gy_pageViewControllerDidShow(self.guessToIndex, toIndex: self.currentPageIndex, finished:true) 543 | self.delegate?.gy_pageViewController?(self, didTransitonFrom: self.pageControllers[self.guessToIndex], 544 | toViewController: self.pageControllers[self.currentPageIndex]) 545 | } 546 | 547 | //归位,用于计算比较 548 | self.originOffset = Double(scrollView.contentOffset.x) 549 | self.guessToIndex = self.currentPageIndex 550 | // print("==== DidEndDecelerating dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 551 | } 552 | 553 | // called on start of dragging (may require some time and or distance to move) 554 | func scrollViewWillBeginDragging(scrollView: UIScrollView) { 555 | self.originOffset = Double(scrollView.contentOffset.x) 556 | self.guessToIndex = self.currentPageIndex 557 | // print("==== WillBeginDragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 558 | } 559 | 560 | // called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest 561 | func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { 562 | // print("==== WillEndDragging: \(velocity) targetContentOffset: \(targetContentOffset.memory) dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 563 | } 564 | 565 | // called on finger up if the user dragged. decelerate is true if it will continue moving afterwards 566 | func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) { 567 | // print("==== DidEndDragging: \(decelerate) dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 568 | } 569 | 570 | // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating 571 | func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) { 572 | /* Use when set scroll view contentOffset with animated true. But now scroll animation is customized by invoking setContentOffset() animation false. 573 | 574 | self.pageControllers[self.currentPageIndex].endAppearanceTransition() 575 | if self.currentPageIndex != self.lastSelectedIndex { 576 | self.pageControllers[self.lastSelectedIndex].endAppearanceTransition() 577 | } 578 | 579 | self.gy_pageViewControllerDidShow(self.lastSelectedIndex, toIndex: self.currentPageIndex, finished: true) 580 | self.delegate?.gy_pageViewController?(self, didLeaveViewController: self.pageControllers[self.lastSelectedIndex], 581 | toViewController: self.pageControllers[self.currentPageIndex], 582 | finished:true) 583 | */ 584 | 585 | // print("==== DidEndScrollingAnimation: dragging: \(scrollView.dragging) decelorating: \(scrollView.decelerating) offset:\(scrollView.contentOffset)") 586 | } 587 | 588 | override func shouldAutomaticallyForwardAppearanceMethods() -> Bool { 589 | return false 590 | } 591 | 592 | //MARK: - Method to be override in subclass 593 | 594 | // Sent when a gesture-initiated transition begins. 595 | func gy_pageViewControllerWillTransitonFrom(fromIndex:Int, toIndex:Int) { } 596 | 597 | // Sent when a gesture-initiated transition ends. 598 | func gy_pageViewControllerDidTransitonFrom(fromIndex:Int, toIndex:Int) { } 599 | 600 | // Sent when method(func showPageAtIndex(index:Int,animated:Bool)) begin to be called. 601 | func gy_pageViewControllerWillShow(fromIndex:Int, toIndex:Int, animated:Bool) { } 602 | 603 | // Sent after method(func showPageAtIndex(index:Int,animated:Bool)) finished. 604 | func gy_pageViewControllerDidShow(fromIndex:Int, toIndex:Int, finished:Bool) { } 605 | } 606 | -------------------------------------------------------------------------------- /GYPageViewController/Classes/GYTabPageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GYTabPageViewController.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/27. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc protocol GYTabPageViewControllerDelegate { 12 | optional func pageViewDidSelectedIndex(index:Int) 13 | } 14 | 15 | class GYTabPageViewController: GYPageViewController { 16 | var segmentedControl:HMSegmentedControl? 17 | var pageTitles:Array! 18 | var segmentHeight = 44.0 19 | 20 | //MARK: - Init 21 | required init?(coder aDecoder: NSCoder) { 22 | fatalError("init(coder:) has not been implemented") 23 | } 24 | 25 | init(pageTitles:Array,pageControllers:Array) { 26 | super.init(pageControllers: pageControllers) 27 | 28 | assert((pageTitles.count == pageControllers.count), "title count is not equal controllers count") 29 | 30 | self.pageTitles = pageTitles 31 | if self.pageTitles.count > 1 { 32 | self.segmentedControl = HMSegmentedControl(sectionTitles: self.pageTitles) 33 | self.setupSegmentedControl(self.segmentedControl) 34 | } 35 | } 36 | 37 | //MARK: - Lift Cycles 38 | override func viewDidLoad() { 39 | super.viewDidLoad() 40 | 41 | if self.pageTitles.count > 1 { 42 | self.layoutSegmentedControl(self.segmentedControl) 43 | } 44 | 45 | self.resetScrollViewLayoutConstraints(self.scrollView) 46 | } 47 | 48 | override func viewDidAppear(animated: Bool) { 49 | super.viewDidAppear(animated) 50 | } 51 | 52 | //MARK: - Target & Action 53 | @objc private func segmentValueChanged(sender:AnyObject) { 54 | if let segControl = self.segmentedControl { 55 | self.showPageAtIndex(segControl.selectedSegmentIndex, animated: true) 56 | } 57 | } 58 | 59 | //MARK: - Subviews Configuration 60 | @objc private func resetScrollViewLayoutConstraints(scrollView:UIScrollView) { 61 | scrollView.gy_removeConstraintsAffectingView() 62 | var constraints = Array() 63 | let constraintAttributes = Array(arrayLiteral: .Bottom,.Leading,.Trailing) 64 | 65 | let topConstraint = NSLayoutConstraint(item: scrollView, 66 | attribute: .Top, 67 | relatedBy: .Equal, 68 | toItem: self.segmentedControl, 69 | attribute: .Bottom, 70 | multiplier: 1, 71 | constant: 0) 72 | constraints.append(topConstraint) 73 | 74 | for attribute in constraintAttributes { 75 | let constraint = NSLayoutConstraint(item: scrollView, 76 | attribute: attribute, 77 | relatedBy: .Equal, 78 | toItem: self.view, 79 | attribute: attribute, 80 | multiplier: 1.0, 81 | constant: 0) 82 | constraints.append(constraint) 83 | } 84 | self.view.addConstraints(constraints) 85 | } 86 | 87 | @objc private func setupSegmentedControl(segmentedControl:HMSegmentedControl?) { 88 | if let segControl = segmentedControl { 89 | segControl.translatesAutoresizingMaskIntoConstraints = false 90 | segControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown 91 | segControl.selectionIndicatorColor = UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0) 92 | segControl.selectionIndicatorHeight = 3.0 93 | segControl.selectedTitleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0xdc/0xff, green: 0xb6/0xff, blue: 0x65/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFontOfSize(22)] 94 | segControl.titleTextAttributes = [NSForegroundColorAttributeName:UIColor(red: 0x84/0xff, green: 0xb0/0xff, blue: 0xdf/0xff, alpha: 1.0),NSFontAttributeName:UIFont.systemFontOfSize(18)] 95 | segControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe 96 | segControl.backgroundColor = UIColor.blueColor() 97 | segControl.addTarget(self, action: #selector(GYTabPageViewController.segmentValueChanged), forControlEvents: .ValueChanged) 98 | } 99 | } 100 | 101 | @objc private func layoutSegmentedControl(segmentedControl:HMSegmentedControl?) { 102 | if let segControl = segmentedControl { 103 | self.view.addSubview(segControl) 104 | 105 | var constraints = Array() 106 | let constraintAttributes = Array(arrayLiteral:.Leading,.Trailing) 107 | for attribute in constraintAttributes { 108 | let constraint = NSLayoutConstraint(item: segControl, 109 | attribute: attribute, 110 | relatedBy: .Equal, 111 | toItem: self.view, 112 | attribute: attribute, 113 | multiplier: 1.0, 114 | constant: 0) 115 | constraints.append(constraint) 116 | } 117 | 118 | let topConstraint = NSLayoutConstraint(item: segControl, 119 | attribute: .Top, 120 | relatedBy: .Equal, 121 | toItem: self.topLayoutGuide, 122 | attribute: .Bottom, 123 | multiplier: 1.0, 124 | constant: 0) 125 | constraints.append(topConstraint) 126 | 127 | let heightConstraint = NSLayoutConstraint(item: segControl, 128 | attribute: .Height, 129 | relatedBy: .Equal, 130 | toItem: nil, 131 | attribute: .NotAnAttribute, 132 | multiplier: 0.0, 133 | constant: CGFloat(segmentHeight)) 134 | constraints.append(heightConstraint) 135 | self.view.addConstraints(constraints) 136 | } 137 | } 138 | 139 | //MARK: - Override super class methods 140 | 141 | // Sent when a gesture-initiated transition ends. 142 | @objc override func gy_pageViewControllerDidTransitonFrom(fromIndex:Int, toIndex:Int) 143 | { 144 | super.gy_pageViewControllerDidTransitonFrom(fromIndex, toIndex: toIndex) 145 | self.segmentedControl?.setSelectedSegmentIndex(UInt(toIndex), animated: true) 146 | } 147 | 148 | // Sent after method(func showPageAtIndex(index:Int,animated:Bool)) finished. 149 | @objc override func gy_pageViewControllerDidShow(fromIndex:Int, toIndex:Int, finished:Bool) 150 | { 151 | super.gy_pageViewControllerDidShow(fromIndex, toIndex:toIndex, finished:finished) 152 | self.segmentedControl?.setSelectedSegmentIndex(UInt(toIndex), animated: true ) 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /GYPageViewController/Classes/NSArray+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSArray { 12 | 13 | func gy_autoRemoveConstraints() { 14 | if #available(iOS 8.0, *) { 15 | if NSLayoutConstraint.respondsToSelector(#selector(NSLayoutConstraint.deactivateConstraints)) { 16 | NSLayoutConstraint.deactivateConstraints(self as! [NSLayoutConstraint]) 17 | return 18 | } 19 | } 20 | 21 | for object in self { 22 | if object.isKindOfClass(NSLayoutConstraint.self) { 23 | (object as! NSLayoutConstraint).gy_autoRemove() 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GYPageViewController/Classes/NSLayoutConstraint+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSLayoutConstraint { 12 | func gy_autoRemove() { 13 | 14 | if #available(iOS 8.0, *) { 15 | if self.respondsToSelector(Selector("setActive:")) { 16 | self.active = false 17 | return 18 | } 19 | } 20 | 21 | if self.secondItem != nil { 22 | var commonSuperview:UIView? 23 | commonSuperview = (self.firstItem as! UIView).gy_commonSuperviewWithView(self.secondItem as! UIView) 24 | while commonSuperview != nil { 25 | if commonSuperview?.constraints.contains(self) == true { 26 | commonSuperview?.removeConstraint(self) 27 | return 28 | } 29 | commonSuperview = commonSuperview?.superview 30 | } 31 | } 32 | else { 33 | self.firstItem.removeConstraint(self) 34 | return 35 | } 36 | assert(false, "Failed to remove constraint: \(self)") 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /GYPageViewController/Classes/UIView+GYPauseAnimation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+GYPauseAnimation.swift 3 | // GYPageViewController 4 | // 5 | // Created by GaoYu on 16/6/13. 6 | // Copyright © 2016年 GaoYu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | func pauseAnimations() { 13 | let paused_time = self.layer.convertTime(CACurrentMediaTime(), toLayer: nil) 14 | self.layer.speed = 0.0 15 | self.layer.timeOffset = paused_time 16 | } 17 | 18 | func resumeAnimations() { 19 | let paused_time = self.layer.timeOffset 20 | self.layer.speed = 1.0 21 | self.layer.timeOffset = 0.0 22 | self.layer.beginTime = 0.0 23 | let time_since_pause = self.layer.convertTime(CACurrentMediaTime(), toLayer: nil) - paused_time 24 | self.layer.beginTime = time_since_pause 25 | } 26 | } -------------------------------------------------------------------------------- /GYPageViewController/Classes/UIView+RemoveConstraints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+RemoveConstraints.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | func gy_removeConstraintsAffectingView() { 13 | var currentSuperView = self.superview 14 | let constraintsToRemove = NSMutableArray() 15 | while currentSuperView != nil { 16 | if let constraints = currentSuperView?.constraints { 17 | for c in constraints { 18 | let isImplicitConstraint = (NSStringFromClass(c.dynamicType) == "NSContentSizeLayoutConstraint") 19 | if isImplicitConstraint != true { 20 | if self.isEqual(c.firstItem) || self.isEqual(c.secondItem) { 21 | constraintsToRemove.addObject(c) 22 | } 23 | } 24 | } 25 | } 26 | currentSuperView = currentSuperView?.superview 27 | } 28 | 29 | constraintsToRemove.gy_autoRemoveConstraints() 30 | } 31 | 32 | func gy_commonSuperviewWithView(otherView:UIView) -> UIView? { 33 | var startView:UIView? = self 34 | var commonSuperview:UIView? 35 | 36 | repeat { 37 | if let obj = startView { 38 | if otherView.isDescendantOfView(obj) { 39 | commonSuperview = obj 40 | } 41 | } 42 | startView = startView?.superview 43 | } while (startView != nil && commonSuperview == nil) 44 | assert(commonSuperview != nil, "Can't constrain two views that do not share a common superview. Make sure that both views have been added into the same view hierarchy.") 45 | return commonSuperview; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GYPageViewController/Classes/UIViewController+ChildController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+ChildController.swift 3 | // PreciousMetals 4 | // 5 | // Created by GaoYu on 16/5/29. 6 | // Copyright © 2016年 Dev-GY. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | func gy_addChildViewController(viewController:UIViewController) { 13 | self.gy_addChildViewController(viewController,frame: self.view.bounds) 14 | } 15 | 16 | func gy_addChildViewController(viewController:UIViewController,inView:UIView,withFrame:CGRect) { 17 | self.gy_addChildViewController(viewController) { (superViewController,childViewController) in 18 | childViewController.view.frame = withFrame; 19 | 20 | if inView.subviews.contains(viewController.view) == false { 21 | inView.addSubview(viewController.view) 22 | } 23 | } 24 | } 25 | 26 | func gy_addChildViewController(viewController:UIViewController,frame:CGRect) { 27 | self.gy_addChildViewController(viewController) { (superViewController,childViewController) in 28 | childViewController.view.frame = frame; 29 | 30 | if superViewController.view.subviews.contains(viewController.view) == false { 31 | superViewController.view.addSubview(viewController.view) 32 | } 33 | } 34 | } 35 | 36 | func gy_addChildViewController(viewController:UIViewController, 37 | setSubViewAction:((superViewController:UIViewController,childViewController:UIViewController) -> Void)?) { 38 | if self.childViewControllers.contains(viewController) == false { 39 | self.addChildViewController(viewController) 40 | } 41 | 42 | setSubViewAction?(superViewController:self,childViewController: viewController) 43 | 44 | if self.childViewControllers.contains(viewController) == false { 45 | viewController.didMoveToParentViewController(self) 46 | } 47 | } 48 | 49 | func gy_removeFromParentViewControllerOnly() { 50 | self.willMoveToParentViewController(nil) 51 | self.removeFromParentViewController() 52 | } 53 | 54 | func gy_removeFromParentViewController() { 55 | self.willMoveToParentViewController(nil) 56 | self.view.removeFromSuperview() 57 | self.removeFromParentViewController() 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 GaoYu 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GYPageViewController 2 | 中文博客: 3 | [UIPageViewController缺陷](http://www.jianshu.com/p/3cca93ceee96) 4 | [UIPageViewContorller替换方案](http://www.jianshu.com/p/52a393691e77) 5 | 6 | 7 | A page view controller instead of UIPageViewController. It manages the child controllers' life cycles as same as UIPageViewController.
8 | [Solve UIPageViewController bug which child controller is navigated to a wrong index](http://stackoverflow.com/questions/14220289/removing-a-view-controller-from-uipageviewcontroller/16308151)
9 | 10 | 一个简单的UIPageViewController替代方案,主要目的是解决UIPageViewController的[bug](http://stackoverflow.com/questions/14220289/removing-a-view-controller-from-uipageviewcontroller/16308151)及其不完善解决方案导致的线上偶现崩溃顽疾。 11 | 能够完全模拟UIPageViewController对child controllers的生命周期管理,区分开will、did的调用时机。并且可以在快速连续切换时也保证生命周期的正常调用(UIPageViewController有bug,快速连续切换生命周期顺序错乱) 12 | 13 | Support cache function to maintain child controllers usually used in order to avoid adding/removing child controllers frequently and make a lower CPU resource occupation. Cache limit can be set freely. 14 | 15 | 支持缓存方案,避免没必要调用dataSource方法;保证内存占用量可控。即降低页面切换add/remove child controllers带来的性能损耗。 16 | 17 | Support animation between two pages which are nonadjacent like UIPageViewController. Also do some work about frequent changing and animation interrupting. Most third party page view controller do not support this function. 18 | 19 | 支持非相邻页面间的非交互切换动画,并且处理了动画过程中连续操作出现的动画打断等问题。一般的第三方框架都规避了这个实现。 20 | 21 | Support fast continous interactive or non-interactive page changing with perfect life cycle management and cache cleaning. UIPageViewController can not do well at this point. 22 | 23 | 快速连续交互、非交互切换时,UIPageViewController存在页面闪白、生命周期管理错乱、内存波动等问题。本方案针对这些都做了相应优化和解决。 24 | 25 | - GYPageViewController can manages the child controllers and support navigation with invoking method and user interaction. 26 | - GYTabPageViewController adds a segmented control bar to the page view for the user to change index. 27 | 28 | ## ScreenShot 29 | 30 | ![img](https://github.com/dev-gao/GYPageViewController/blob/master/Example/GYTabPageViewController-ScreenShot.png) 31 | 32 | ## Example 33 | ```objc 34 | GYPageViewController: 35 | let vc = GYPageViewController(nibName: nil, bundle: nil) 36 | vc.showPageAtIndex(2, animated: false) 37 | self.navigationController?.pushViewController(vc, animated: true) 38 | 39 | GYTabPageViewController: 40 | let vc = GYTabPageViewController(pageTitles: titlesArray) 41 | vc.showPageAtIndex(2, animated: false) 42 | self.navigationController?.pushViewController(vc, animated: true) 43 | ``` 44 | 45 | ## Requirements 46 | 47 | iOS >= 7 48 | 49 | ## Installation 50 | Copy codes now, will add to git specs soon. 51 | 52 | ## Contact 53 | Email:fightrain@126.com GaoYu 54 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------