├── .gitignore ├── ColorPanel.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── carya.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── carya.xcuserdatad │ └── xcschemes │ ├── ColorPanel.xcscheme │ └── xcschememanagement.plist ├── ColorPanel.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── carya.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── ColorPanel ├── AppDelegate.h ├── AppDelegate.m ├── BarColorPanel.h ├── BarColorPanel.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── bg_color_panel.imageset │ │ ├── Contents.json │ │ └── bg_color_panel@2x.png │ └── color_panel_indicator.imageset │ │ ├── Contents.json │ │ └── color_panel_indicator@2x.png ├── ImmovableColorPanel.h ├── ImmovableColorPanel.m ├── ImmovableColorPanelViewController.h ├── ImmovableColorPanelViewController.m ├── Info.plist ├── RotaryColorPanel.h ├── RotaryColorPanel.m ├── RotaryColorPanel.xib ├── RotaryColorPanelViewController.h ├── RotaryColorPanelViewController.m ├── RoundColorPanel.h ├── RoundColorPanel.m ├── SliderColorPanel.h ├── SliderColorPanel.m ├── SliderColorPanelViewController.h ├── SliderColorPanelViewController.m ├── UIView+ColorOfPoint.h ├── UIView+ColorOfPoint.m ├── ViewController.h ├── ViewController.m └── main.m ├── ColorPanelTests ├── ColorPanelTests.m └── Info.plist ├── Podfile ├── Podfile.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | Pods/ 27 | -------------------------------------------------------------------------------- /ColorPanel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4AB1CA171B6454490025CFC7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA161B6454490025CFC7 /* main.m */; }; 11 | 4AB1CA1A1B6454490025CFC7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA191B6454490025CFC7 /* AppDelegate.m */; }; 12 | 4AB1CA1D1B6454490025CFC7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA1C1B6454490025CFC7 /* ViewController.m */; }; 13 | 4AB1CA201B6454490025CFC7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4AB1CA1E1B6454490025CFC7 /* Main.storyboard */; }; 14 | 4AB1CA221B6454490025CFC7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4AB1CA211B6454490025CFC7 /* Images.xcassets */; }; 15 | 4AB1CA251B6454490025CFC7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4AB1CA231B6454490025CFC7 /* LaunchScreen.xib */; }; 16 | 4AB1CA311B6454490025CFC7 /* ColorPanelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA301B6454490025CFC7 /* ColorPanelTests.m */; }; 17 | 4AB1CA3D1B6455550025CFC7 /* UIView+ColorOfPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA3C1B6455550025CFC7 /* UIView+ColorOfPoint.m */; }; 18 | 4AB1CA401B6455A90025CFC7 /* ImmovableColorPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA3F1B6455A90025CFC7 /* ImmovableColorPanel.m */; }; 19 | 4AB1CA431B6455F60025CFC7 /* ImmovableColorPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA421B6455F60025CFC7 /* ImmovableColorPanelViewController.m */; }; 20 | 4AB1CA471B6473A00025CFC7 /* RotaryColorPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA461B6473A00025CFC7 /* RotaryColorPanelViewController.m */; }; 21 | 4AB1CA4A1B6473D80025CFC7 /* RotaryColorPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA491B6473D80025CFC7 /* RotaryColorPanel.m */; }; 22 | 4AB1CA4C1B6473EB0025CFC7 /* RotaryColorPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4AB1CA4B1B6473EB0025CFC7 /* RotaryColorPanel.xib */; }; 23 | 4AB1CA501B6477940025CFC7 /* RoundColorPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB1CA4F1B6477940025CFC7 /* RoundColorPanel.m */; }; 24 | 4AF9F2561B666C78000F33F3 /* SliderColorPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF9F2551B666C78000F33F3 /* SliderColorPanelViewController.m */; }; 25 | 4AF9F25A1B667812000F33F3 /* SliderColorPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF9F2591B667812000F33F3 /* SliderColorPanel.m */; }; 26 | 4AF9F25D1B667847000F33F3 /* BarColorPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AF9F25C1B667847000F33F3 /* BarColorPanel.m */; }; 27 | F0F71BEBEEA87AEF276CF593 /* libPods-ColorPanel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F5E3506E095E6AAF7F676A3F /* libPods-ColorPanel.a */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 4AB1CA2B1B6454490025CFC7 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 4AB1CA091B6454490025CFC7 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 4AB1CA101B6454490025CFC7; 36 | remoteInfo = ColorPanel; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 4AB1CA111B6454490025CFC7 /* ColorPanel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ColorPanel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 4AB1CA151B6454490025CFC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 4AB1CA161B6454490025CFC7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 4AB1CA181B6454490025CFC7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 4AB1CA191B6454490025CFC7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 4AB1CA1B1B6454490025CFC7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 47 | 4AB1CA1C1B6454490025CFC7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 48 | 4AB1CA1F1B6454490025CFC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | 4AB1CA211B6454490025CFC7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 50 | 4AB1CA241B6454490025CFC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 51 | 4AB1CA2A1B6454490025CFC7 /* ColorPanelTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ColorPanelTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 4AB1CA2F1B6454490025CFC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 4AB1CA301B6454490025CFC7 /* ColorPanelTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ColorPanelTests.m; sourceTree = ""; }; 54 | 4AB1CA3B1B6455550025CFC7 /* UIView+ColorOfPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ColorOfPoint.h"; sourceTree = ""; }; 55 | 4AB1CA3C1B6455550025CFC7 /* UIView+ColorOfPoint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ColorOfPoint.m"; sourceTree = ""; }; 56 | 4AB1CA3E1B6455A90025CFC7 /* ImmovableColorPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmovableColorPanel.h; sourceTree = ""; }; 57 | 4AB1CA3F1B6455A90025CFC7 /* ImmovableColorPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImmovableColorPanel.m; sourceTree = ""; }; 58 | 4AB1CA411B6455F60025CFC7 /* ImmovableColorPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImmovableColorPanelViewController.h; sourceTree = ""; }; 59 | 4AB1CA421B6455F60025CFC7 /* ImmovableColorPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImmovableColorPanelViewController.m; sourceTree = ""; }; 60 | 4AB1CA451B6473A00025CFC7 /* RotaryColorPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RotaryColorPanelViewController.h; sourceTree = ""; }; 61 | 4AB1CA461B6473A00025CFC7 /* RotaryColorPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RotaryColorPanelViewController.m; sourceTree = ""; }; 62 | 4AB1CA481B6473D80025CFC7 /* RotaryColorPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RotaryColorPanel.h; sourceTree = ""; }; 63 | 4AB1CA491B6473D80025CFC7 /* RotaryColorPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RotaryColorPanel.m; sourceTree = ""; }; 64 | 4AB1CA4B1B6473EB0025CFC7 /* RotaryColorPanel.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RotaryColorPanel.xib; sourceTree = ""; }; 65 | 4AB1CA4E1B6477940025CFC7 /* RoundColorPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundColorPanel.h; sourceTree = ""; }; 66 | 4AB1CA4F1B6477940025CFC7 /* RoundColorPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoundColorPanel.m; sourceTree = ""; }; 67 | 4AF9F2541B666C78000F33F3 /* SliderColorPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderColorPanelViewController.h; sourceTree = ""; }; 68 | 4AF9F2551B666C78000F33F3 /* SliderColorPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SliderColorPanelViewController.m; sourceTree = ""; }; 69 | 4AF9F2581B667812000F33F3 /* SliderColorPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderColorPanel.h; sourceTree = ""; }; 70 | 4AF9F2591B667812000F33F3 /* SliderColorPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SliderColorPanel.m; sourceTree = ""; }; 71 | 4AF9F25B1B667847000F33F3 /* BarColorPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarColorPanel.h; sourceTree = ""; }; 72 | 4AF9F25C1B667847000F33F3 /* BarColorPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarColorPanel.m; sourceTree = ""; }; 73 | 6EB97DFB3D9EDC0E2CCEC397 /* Pods-ColorPanel.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ColorPanel.release.xcconfig"; path = "Pods/Target Support Files/Pods-ColorPanel/Pods-ColorPanel.release.xcconfig"; sourceTree = ""; }; 74 | BDF81275B0B646BB587DB150 /* Pods-ColorPanel.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ColorPanel.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ColorPanel/Pods-ColorPanel.debug.xcconfig"; sourceTree = ""; }; 75 | F5E3506E095E6AAF7F676A3F /* libPods-ColorPanel.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ColorPanel.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 4AB1CA0E1B6454490025CFC7 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | F0F71BEBEEA87AEF276CF593 /* libPods-ColorPanel.a in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | 4AB1CA271B6454490025CFC7 /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | 4AB1CA081B6454490025CFC7 = { 98 | isa = PBXGroup; 99 | children = ( 100 | 4AB1CA131B6454490025CFC7 /* ColorPanel */, 101 | 4AB1CA2D1B6454490025CFC7 /* ColorPanelTests */, 102 | 4AB1CA121B6454490025CFC7 /* Products */, 103 | 94B671A7456003BAF96A8393 /* Pods */, 104 | 7E5D6CCB01C31E973A52A35A /* Frameworks */, 105 | ); 106 | sourceTree = ""; 107 | }; 108 | 4AB1CA121B6454490025CFC7 /* Products */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 4AB1CA111B6454490025CFC7 /* ColorPanel.app */, 112 | 4AB1CA2A1B6454490025CFC7 /* ColorPanelTests.xctest */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 4AB1CA131B6454490025CFC7 /* ColorPanel */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 4AB1CA3B1B6455550025CFC7 /* UIView+ColorOfPoint.h */, 121 | 4AB1CA3C1B6455550025CFC7 /* UIView+ColorOfPoint.m */, 122 | 4AF9F2531B666B12000F33F3 /* SliderColorPanel */, 123 | 4AB1CA441B6473750025CFC7 /* RotaryColorPanel */, 124 | 4AB1CA3A1B6454A20025CFC7 /* ImmovableColorPanel */, 125 | 4AB1CA181B6454490025CFC7 /* AppDelegate.h */, 126 | 4AB1CA191B6454490025CFC7 /* AppDelegate.m */, 127 | 4AB1CA1B1B6454490025CFC7 /* ViewController.h */, 128 | 4AB1CA1C1B6454490025CFC7 /* ViewController.m */, 129 | 4AB1CA1E1B6454490025CFC7 /* Main.storyboard */, 130 | 4AB1CA211B6454490025CFC7 /* Images.xcassets */, 131 | 4AB1CA231B6454490025CFC7 /* LaunchScreen.xib */, 132 | 4AB1CA141B6454490025CFC7 /* Supporting Files */, 133 | ); 134 | path = ColorPanel; 135 | sourceTree = ""; 136 | }; 137 | 4AB1CA141B6454490025CFC7 /* Supporting Files */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 4AB1CA151B6454490025CFC7 /* Info.plist */, 141 | 4AB1CA161B6454490025CFC7 /* main.m */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | 4AB1CA2D1B6454490025CFC7 /* ColorPanelTests */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 4AB1CA301B6454490025CFC7 /* ColorPanelTests.m */, 150 | 4AB1CA2E1B6454490025CFC7 /* Supporting Files */, 151 | ); 152 | path = ColorPanelTests; 153 | sourceTree = ""; 154 | }; 155 | 4AB1CA2E1B6454490025CFC7 /* Supporting Files */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 4AB1CA2F1B6454490025CFC7 /* Info.plist */, 159 | ); 160 | name = "Supporting Files"; 161 | sourceTree = ""; 162 | }; 163 | 4AB1CA3A1B6454A20025CFC7 /* ImmovableColorPanel */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 4AB1CA3E1B6455A90025CFC7 /* ImmovableColorPanel.h */, 167 | 4AB1CA3F1B6455A90025CFC7 /* ImmovableColorPanel.m */, 168 | 4AB1CA411B6455F60025CFC7 /* ImmovableColorPanelViewController.h */, 169 | 4AB1CA421B6455F60025CFC7 /* ImmovableColorPanelViewController.m */, 170 | ); 171 | name = ImmovableColorPanel; 172 | sourceTree = ""; 173 | }; 174 | 4AB1CA441B6473750025CFC7 /* RotaryColorPanel */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 4AB1CA4D1B6476690025CFC7 /* RotaryColorPanel */, 178 | 4AB1CA451B6473A00025CFC7 /* RotaryColorPanelViewController.h */, 179 | 4AB1CA461B6473A00025CFC7 /* RotaryColorPanelViewController.m */, 180 | ); 181 | name = RotaryColorPanel; 182 | sourceTree = ""; 183 | }; 184 | 4AB1CA4D1B6476690025CFC7 /* RotaryColorPanel */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 4AB1CA481B6473D80025CFC7 /* RotaryColorPanel.h */, 188 | 4AB1CA491B6473D80025CFC7 /* RotaryColorPanel.m */, 189 | 4AB1CA4B1B6473EB0025CFC7 /* RotaryColorPanel.xib */, 190 | 4AB1CA4E1B6477940025CFC7 /* RoundColorPanel.h */, 191 | 4AB1CA4F1B6477940025CFC7 /* RoundColorPanel.m */, 192 | ); 193 | name = RotaryColorPanel; 194 | sourceTree = ""; 195 | }; 196 | 4AF9F2531B666B12000F33F3 /* SliderColorPanel */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | 4AF9F2571B6677EB000F33F3 /* SliderColorPanel */, 200 | 4AF9F2541B666C78000F33F3 /* SliderColorPanelViewController.h */, 201 | 4AF9F2551B666C78000F33F3 /* SliderColorPanelViewController.m */, 202 | ); 203 | name = SliderColorPanel; 204 | sourceTree = ""; 205 | }; 206 | 4AF9F2571B6677EB000F33F3 /* SliderColorPanel */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | 4AF9F2581B667812000F33F3 /* SliderColorPanel.h */, 210 | 4AF9F2591B667812000F33F3 /* SliderColorPanel.m */, 211 | 4AF9F25B1B667847000F33F3 /* BarColorPanel.h */, 212 | 4AF9F25C1B667847000F33F3 /* BarColorPanel.m */, 213 | ); 214 | name = SliderColorPanel; 215 | sourceTree = ""; 216 | }; 217 | 7E5D6CCB01C31E973A52A35A /* Frameworks */ = { 218 | isa = PBXGroup; 219 | children = ( 220 | F5E3506E095E6AAF7F676A3F /* libPods-ColorPanel.a */, 221 | ); 222 | name = Frameworks; 223 | sourceTree = ""; 224 | }; 225 | 94B671A7456003BAF96A8393 /* Pods */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | BDF81275B0B646BB587DB150 /* Pods-ColorPanel.debug.xcconfig */, 229 | 6EB97DFB3D9EDC0E2CCEC397 /* Pods-ColorPanel.release.xcconfig */, 230 | ); 231 | name = Pods; 232 | sourceTree = ""; 233 | }; 234 | /* End PBXGroup section */ 235 | 236 | /* Begin PBXNativeTarget section */ 237 | 4AB1CA101B6454490025CFC7 /* ColorPanel */ = { 238 | isa = PBXNativeTarget; 239 | buildConfigurationList = 4AB1CA341B6454490025CFC7 /* Build configuration list for PBXNativeTarget "ColorPanel" */; 240 | buildPhases = ( 241 | 9A998DB2C94BE07F6F2E8453 /* Check Pods Manifest.lock */, 242 | 4AB1CA0D1B6454490025CFC7 /* Sources */, 243 | 4AB1CA0E1B6454490025CFC7 /* Frameworks */, 244 | 4AB1CA0F1B6454490025CFC7 /* Resources */, 245 | 5E92C64793494DA043A6B689 /* Copy Pods Resources */, 246 | ); 247 | buildRules = ( 248 | ); 249 | dependencies = ( 250 | ); 251 | name = ColorPanel; 252 | productName = ColorPanel; 253 | productReference = 4AB1CA111B6454490025CFC7 /* ColorPanel.app */; 254 | productType = "com.apple.product-type.application"; 255 | }; 256 | 4AB1CA291B6454490025CFC7 /* ColorPanelTests */ = { 257 | isa = PBXNativeTarget; 258 | buildConfigurationList = 4AB1CA371B6454490025CFC7 /* Build configuration list for PBXNativeTarget "ColorPanelTests" */; 259 | buildPhases = ( 260 | 4AB1CA261B6454490025CFC7 /* Sources */, 261 | 4AB1CA271B6454490025CFC7 /* Frameworks */, 262 | 4AB1CA281B6454490025CFC7 /* Resources */, 263 | ); 264 | buildRules = ( 265 | ); 266 | dependencies = ( 267 | 4AB1CA2C1B6454490025CFC7 /* PBXTargetDependency */, 268 | ); 269 | name = ColorPanelTests; 270 | productName = ColorPanelTests; 271 | productReference = 4AB1CA2A1B6454490025CFC7 /* ColorPanelTests.xctest */; 272 | productType = "com.apple.product-type.bundle.unit-test"; 273 | }; 274 | /* End PBXNativeTarget section */ 275 | 276 | /* Begin PBXProject section */ 277 | 4AB1CA091B6454490025CFC7 /* Project object */ = { 278 | isa = PBXProject; 279 | attributes = { 280 | LastUpgradeCheck = 0640; 281 | ORGANIZATIONNAME = CaryaLiu; 282 | TargetAttributes = { 283 | 4AB1CA101B6454490025CFC7 = { 284 | CreatedOnToolsVersion = 6.4; 285 | }; 286 | 4AB1CA291B6454490025CFC7 = { 287 | CreatedOnToolsVersion = 6.4; 288 | TestTargetID = 4AB1CA101B6454490025CFC7; 289 | }; 290 | }; 291 | }; 292 | buildConfigurationList = 4AB1CA0C1B6454490025CFC7 /* Build configuration list for PBXProject "ColorPanel" */; 293 | compatibilityVersion = "Xcode 3.2"; 294 | developmentRegion = English; 295 | hasScannedForEncodings = 0; 296 | knownRegions = ( 297 | en, 298 | Base, 299 | ); 300 | mainGroup = 4AB1CA081B6454490025CFC7; 301 | productRefGroup = 4AB1CA121B6454490025CFC7 /* Products */; 302 | projectDirPath = ""; 303 | projectRoot = ""; 304 | targets = ( 305 | 4AB1CA101B6454490025CFC7 /* ColorPanel */, 306 | 4AB1CA291B6454490025CFC7 /* ColorPanelTests */, 307 | ); 308 | }; 309 | /* End PBXProject section */ 310 | 311 | /* Begin PBXResourcesBuildPhase section */ 312 | 4AB1CA0F1B6454490025CFC7 /* Resources */ = { 313 | isa = PBXResourcesBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | 4AB1CA201B6454490025CFC7 /* Main.storyboard in Resources */, 317 | 4AB1CA4C1B6473EB0025CFC7 /* RotaryColorPanel.xib in Resources */, 318 | 4AB1CA251B6454490025CFC7 /* LaunchScreen.xib in Resources */, 319 | 4AB1CA221B6454490025CFC7 /* Images.xcassets in Resources */, 320 | ); 321 | runOnlyForDeploymentPostprocessing = 0; 322 | }; 323 | 4AB1CA281B6454490025CFC7 /* Resources */ = { 324 | isa = PBXResourcesBuildPhase; 325 | buildActionMask = 2147483647; 326 | files = ( 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | }; 330 | /* End PBXResourcesBuildPhase section */ 331 | 332 | /* Begin PBXShellScriptBuildPhase section */ 333 | 5E92C64793494DA043A6B689 /* Copy Pods Resources */ = { 334 | isa = PBXShellScriptBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | ); 338 | inputPaths = ( 339 | ); 340 | name = "Copy Pods Resources"; 341 | outputPaths = ( 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | shellPath = /bin/sh; 345 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ColorPanel/Pods-ColorPanel-resources.sh\"\n"; 346 | showEnvVarsInLog = 0; 347 | }; 348 | 9A998DB2C94BE07F6F2E8453 /* Check Pods Manifest.lock */ = { 349 | isa = PBXShellScriptBuildPhase; 350 | buildActionMask = 2147483647; 351 | files = ( 352 | ); 353 | inputPaths = ( 354 | ); 355 | name = "Check Pods Manifest.lock"; 356 | outputPaths = ( 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | shellPath = /bin/sh; 360 | 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"; 361 | showEnvVarsInLog = 0; 362 | }; 363 | /* End PBXShellScriptBuildPhase section */ 364 | 365 | /* Begin PBXSourcesBuildPhase section */ 366 | 4AB1CA0D1B6454490025CFC7 /* Sources */ = { 367 | isa = PBXSourcesBuildPhase; 368 | buildActionMask = 2147483647; 369 | files = ( 370 | 4AB1CA1D1B6454490025CFC7 /* ViewController.m in Sources */, 371 | 4AB1CA1A1B6454490025CFC7 /* AppDelegate.m in Sources */, 372 | 4AB1CA3D1B6455550025CFC7 /* UIView+ColorOfPoint.m in Sources */, 373 | 4AB1CA171B6454490025CFC7 /* main.m in Sources */, 374 | 4AB1CA431B6455F60025CFC7 /* ImmovableColorPanelViewController.m in Sources */, 375 | 4AB1CA4A1B6473D80025CFC7 /* RotaryColorPanel.m in Sources */, 376 | 4AF9F25D1B667847000F33F3 /* BarColorPanel.m in Sources */, 377 | 4AB1CA471B6473A00025CFC7 /* RotaryColorPanelViewController.m in Sources */, 378 | 4AB1CA501B6477940025CFC7 /* RoundColorPanel.m in Sources */, 379 | 4AF9F2561B666C78000F33F3 /* SliderColorPanelViewController.m in Sources */, 380 | 4AF9F25A1B667812000F33F3 /* SliderColorPanel.m in Sources */, 381 | 4AB1CA401B6455A90025CFC7 /* ImmovableColorPanel.m in Sources */, 382 | ); 383 | runOnlyForDeploymentPostprocessing = 0; 384 | }; 385 | 4AB1CA261B6454490025CFC7 /* Sources */ = { 386 | isa = PBXSourcesBuildPhase; 387 | buildActionMask = 2147483647; 388 | files = ( 389 | 4AB1CA311B6454490025CFC7 /* ColorPanelTests.m in Sources */, 390 | ); 391 | runOnlyForDeploymentPostprocessing = 0; 392 | }; 393 | /* End PBXSourcesBuildPhase section */ 394 | 395 | /* Begin PBXTargetDependency section */ 396 | 4AB1CA2C1B6454490025CFC7 /* PBXTargetDependency */ = { 397 | isa = PBXTargetDependency; 398 | target = 4AB1CA101B6454490025CFC7 /* ColorPanel */; 399 | targetProxy = 4AB1CA2B1B6454490025CFC7 /* PBXContainerItemProxy */; 400 | }; 401 | /* End PBXTargetDependency section */ 402 | 403 | /* Begin PBXVariantGroup section */ 404 | 4AB1CA1E1B6454490025CFC7 /* Main.storyboard */ = { 405 | isa = PBXVariantGroup; 406 | children = ( 407 | 4AB1CA1F1B6454490025CFC7 /* Base */, 408 | ); 409 | name = Main.storyboard; 410 | sourceTree = ""; 411 | }; 412 | 4AB1CA231B6454490025CFC7 /* LaunchScreen.xib */ = { 413 | isa = PBXVariantGroup; 414 | children = ( 415 | 4AB1CA241B6454490025CFC7 /* Base */, 416 | ); 417 | name = LaunchScreen.xib; 418 | sourceTree = ""; 419 | }; 420 | /* End PBXVariantGroup section */ 421 | 422 | /* Begin XCBuildConfiguration section */ 423 | 4AB1CA321B6454490025CFC7 /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | ALWAYS_SEARCH_USER_PATHS = NO; 427 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 428 | CLANG_CXX_LIBRARY = "libc++"; 429 | CLANG_ENABLE_MODULES = YES; 430 | CLANG_ENABLE_OBJC_ARC = YES; 431 | CLANG_WARN_BOOL_CONVERSION = YES; 432 | CLANG_WARN_CONSTANT_CONVERSION = YES; 433 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 434 | CLANG_WARN_EMPTY_BODY = YES; 435 | CLANG_WARN_ENUM_CONVERSION = YES; 436 | CLANG_WARN_INT_CONVERSION = YES; 437 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 438 | CLANG_WARN_UNREACHABLE_CODE = YES; 439 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 440 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 441 | COPY_PHASE_STRIP = NO; 442 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 443 | ENABLE_STRICT_OBJC_MSGSEND = YES; 444 | GCC_C_LANGUAGE_STANDARD = gnu99; 445 | GCC_DYNAMIC_NO_PIC = NO; 446 | GCC_NO_COMMON_BLOCKS = YES; 447 | GCC_OPTIMIZATION_LEVEL = 0; 448 | GCC_PREPROCESSOR_DEFINITIONS = ( 449 | "DEBUG=1", 450 | "$(inherited)", 451 | ); 452 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 453 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 454 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 455 | GCC_WARN_UNDECLARED_SELECTOR = YES; 456 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 457 | GCC_WARN_UNUSED_FUNCTION = YES; 458 | GCC_WARN_UNUSED_VARIABLE = YES; 459 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 460 | MTL_ENABLE_DEBUG_INFO = YES; 461 | ONLY_ACTIVE_ARCH = YES; 462 | SDKROOT = iphoneos; 463 | }; 464 | name = Debug; 465 | }; 466 | 4AB1CA331B6454490025CFC7 /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ALWAYS_SEARCH_USER_PATHS = NO; 470 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 471 | CLANG_CXX_LIBRARY = "libc++"; 472 | CLANG_ENABLE_MODULES = YES; 473 | CLANG_ENABLE_OBJC_ARC = YES; 474 | CLANG_WARN_BOOL_CONVERSION = YES; 475 | CLANG_WARN_CONSTANT_CONVERSION = YES; 476 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 477 | CLANG_WARN_EMPTY_BODY = YES; 478 | CLANG_WARN_ENUM_CONVERSION = YES; 479 | CLANG_WARN_INT_CONVERSION = YES; 480 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 481 | CLANG_WARN_UNREACHABLE_CODE = YES; 482 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 483 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 484 | COPY_PHASE_STRIP = NO; 485 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 486 | ENABLE_NS_ASSERTIONS = NO; 487 | ENABLE_STRICT_OBJC_MSGSEND = YES; 488 | GCC_C_LANGUAGE_STANDARD = gnu99; 489 | GCC_NO_COMMON_BLOCKS = YES; 490 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 491 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 492 | GCC_WARN_UNDECLARED_SELECTOR = YES; 493 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 494 | GCC_WARN_UNUSED_FUNCTION = YES; 495 | GCC_WARN_UNUSED_VARIABLE = YES; 496 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 497 | MTL_ENABLE_DEBUG_INFO = NO; 498 | SDKROOT = iphoneos; 499 | VALIDATE_PRODUCT = YES; 500 | }; 501 | name = Release; 502 | }; 503 | 4AB1CA351B6454490025CFC7 /* Debug */ = { 504 | isa = XCBuildConfiguration; 505 | baseConfigurationReference = BDF81275B0B646BB587DB150 /* Pods-ColorPanel.debug.xcconfig */; 506 | buildSettings = { 507 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 508 | INFOPLIST_FILE = ColorPanel/Info.plist; 509 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 510 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 511 | PRODUCT_NAME = "$(TARGET_NAME)"; 512 | TARGETED_DEVICE_FAMILY = "1,2"; 513 | }; 514 | name = Debug; 515 | }; 516 | 4AB1CA361B6454490025CFC7 /* Release */ = { 517 | isa = XCBuildConfiguration; 518 | baseConfigurationReference = 6EB97DFB3D9EDC0E2CCEC397 /* Pods-ColorPanel.release.xcconfig */; 519 | buildSettings = { 520 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 521 | INFOPLIST_FILE = ColorPanel/Info.plist; 522 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 524 | PRODUCT_NAME = "$(TARGET_NAME)"; 525 | TARGETED_DEVICE_FAMILY = "1,2"; 526 | }; 527 | name = Release; 528 | }; 529 | 4AB1CA381B6454490025CFC7 /* Debug */ = { 530 | isa = XCBuildConfiguration; 531 | buildSettings = { 532 | BUNDLE_LOADER = "$(TEST_HOST)"; 533 | FRAMEWORK_SEARCH_PATHS = ( 534 | "$(SDKROOT)/Developer/Library/Frameworks", 535 | "$(inherited)", 536 | ); 537 | GCC_PREPROCESSOR_DEFINITIONS = ( 538 | "DEBUG=1", 539 | "$(inherited)", 540 | ); 541 | INFOPLIST_FILE = ColorPanelTests/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 543 | PRODUCT_NAME = "$(TARGET_NAME)"; 544 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ColorPanel.app/ColorPanel"; 545 | }; 546 | name = Debug; 547 | }; 548 | 4AB1CA391B6454490025CFC7 /* Release */ = { 549 | isa = XCBuildConfiguration; 550 | buildSettings = { 551 | BUNDLE_LOADER = "$(TEST_HOST)"; 552 | FRAMEWORK_SEARCH_PATHS = ( 553 | "$(SDKROOT)/Developer/Library/Frameworks", 554 | "$(inherited)", 555 | ); 556 | INFOPLIST_FILE = ColorPanelTests/Info.plist; 557 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 558 | PRODUCT_NAME = "$(TARGET_NAME)"; 559 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ColorPanel.app/ColorPanel"; 560 | }; 561 | name = Release; 562 | }; 563 | /* End XCBuildConfiguration section */ 564 | 565 | /* Begin XCConfigurationList section */ 566 | 4AB1CA0C1B6454490025CFC7 /* Build configuration list for PBXProject "ColorPanel" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 4AB1CA321B6454490025CFC7 /* Debug */, 570 | 4AB1CA331B6454490025CFC7 /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 4AB1CA341B6454490025CFC7 /* Build configuration list for PBXNativeTarget "ColorPanel" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 4AB1CA351B6454490025CFC7 /* Debug */, 579 | 4AB1CA361B6454490025CFC7 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 4AB1CA371B6454490025CFC7 /* Build configuration list for PBXNativeTarget "ColorPanelTests" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 4AB1CA381B6454490025CFC7 /* Debug */, 588 | 4AB1CA391B6454490025CFC7 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | /* End XCConfigurationList section */ 594 | }; 595 | rootObject = 4AB1CA091B6454490025CFC7 /* Project object */; 596 | } 597 | -------------------------------------------------------------------------------- /ColorPanel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ColorPanel.xcodeproj/project.xcworkspace/xcuserdata/carya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carya/ColorPanel/051c9bb36b7675e6675c4928b46902f8c9002ea0/ColorPanel.xcodeproj/project.xcworkspace/xcuserdata/carya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ColorPanel.xcodeproj/xcuserdata/carya.xcuserdatad/xcschemes/ColorPanel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ColorPanel.xcodeproj/xcuserdata/carya.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ColorPanel.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4AB1CA101B6454490025CFC7 16 | 17 | primary 18 | 19 | 20 | 4AB1CA291B6454490025CFC7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ColorPanel.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ColorPanel.xcworkspace/xcuserdata/carya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carya/ColorPanel/051c9bb36b7675e6675c4928b46902f8c9002ea0/ColorPanel.xcworkspace/xcuserdata/carya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ColorPanel/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /ColorPanel/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ColorPanel/BarColorPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // BarColorPanel.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BarColorPanel : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ColorPanel/BarColorPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // BarColorPanel.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "BarColorPanel.h" 10 | 11 | #define SLIDER_HEIGHT 5 12 | #define HANDLE_RADIUS 10 13 | 14 | @interface BarColorPanel () 15 | 16 | @property (strong, nonatomic) CAGradientLayer *gradientLayer; 17 | 18 | @end 19 | 20 | @implementation BarColorPanel 21 | 22 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 23 | self = [super initWithCoder:aDecoder]; 24 | if (self) { 25 | self.gradientLayer = [CAGradientLayer layer]; 26 | self.gradientLayer.colors = @[(__bridge id)[UIColor colorWithRed:249/255.0f green:220/255.0f blue:89/255.0f alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:131/255.0f green:194/255.0f blue:254/255.0f alpha:1].CGColor]; 27 | self.gradientLayer.startPoint = CGPointMake(0, 0.5); 28 | self.gradientLayer.endPoint = CGPointMake(1, 0.5); 29 | [self.layer addSublayer:self.gradientLayer]; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (instancetype)init { 36 | self = [super init]; 37 | if (self) { 38 | self.gradientLayer = [CAGradientLayer layer]; 39 | self.gradientLayer.colors = @[(__bridge id)[UIColor colorWithRed:249/255.0f green:220/255.0f blue:89/255.0f alpha:1].CGColor, (__bridge id)[UIColor whiteColor].CGColor, (__bridge id)[UIColor colorWithRed:131/255.0f green:194/255.0f blue:254/255.0f alpha:1].CGColor]; 40 | self.gradientLayer.startPoint = CGPointMake(0, 0.5); 41 | self.gradientLayer.endPoint = CGPointMake(1, 0.5); 42 | [self.layer addSublayer:self.gradientLayer]; 43 | } 44 | 45 | return self; 46 | } 47 | 48 | - (void)layoutSublayersOfLayer:(CALayer *)layer { 49 | [super layoutSublayersOfLayer:layer]; 50 | 51 | self.gradientLayer = [CAGradientLayer layer]; 52 | self.gradientLayer.colors = @[(__bridge id)[UIColor colorWithRed:249/255.0f green:220/255.0f blue:89/255.0f alpha:1].CGColor, (__bridge id)[UIColor whiteColor].CGColor, (__bridge id)[UIColor colorWithRed:131/255.0f green:194/255.0f blue:254/255.0f alpha:1].CGColor]; 53 | self.gradientLayer.startPoint = CGPointMake(0, 0.5); 54 | self.gradientLayer.endPoint = CGPointMake(1, 0.5); 55 | [self.layer addSublayer:self.gradientLayer]; 56 | self.gradientLayer.frame = self.bounds; 57 | self.gradientLayer.cornerRadius = CGRectGetHeight(self.bounds) / 2.0f; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /ColorPanel/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ColorPanel/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 38 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /ColorPanel/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ColorPanel/Images.xcassets/bg_color_panel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "bg_color_panel@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ColorPanel/Images.xcassets/bg_color_panel.imageset/bg_color_panel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carya/ColorPanel/051c9bb36b7675e6675c4928b46902f8c9002ea0/ColorPanel/Images.xcassets/bg_color_panel.imageset/bg_color_panel@2x.png -------------------------------------------------------------------------------- /ColorPanel/Images.xcassets/color_panel_indicator.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "color_panel_indicator@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ColorPanel/Images.xcassets/color_panel_indicator.imageset/color_panel_indicator@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carya/ColorPanel/051c9bb36b7675e6675c4928b46902f8c9002ea0/ColorPanel/Images.xcassets/color_panel_indicator.imageset/color_panel_indicator@2x.png -------------------------------------------------------------------------------- /ColorPanel/ImmovableColorPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImmovableColorPanel.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImmovableColorPanel : UIControl 12 | 13 | @property (strong, nonatomic) UIColor *color; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ColorPanel/ImmovableColorPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImmovableColorPanel.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "ImmovableColorPanel.h" 10 | #import "UIView+ColorOfPoint.h" 11 | 12 | @implementation ImmovableColorPanel 13 | 14 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 15 | CGPoint location = [touch locationInView:self]; 16 | self.color = [self colorOfPoint:location]; 17 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 18 | return YES; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ColorPanel/ImmovableColorPanelViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImmovableColorPanelViewController.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImmovableColorPanelViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ColorPanel/ImmovableColorPanelViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImmovableColorPanelViewController.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "ImmovableColorPanelViewController.h" 10 | #import "ImmovableColorPanel.h" 11 | 12 | @interface ImmovableColorPanelViewController () 13 | 14 | @end 15 | 16 | @implementation ImmovableColorPanelViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | - (IBAction)touchMoved:(id)sender { 29 | ImmovableColorPanel *colorPanel = (ImmovableColorPanel *)sender; 30 | UIColor *color = colorPanel.color; 31 | self.view.backgroundColor = color; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ColorPanel/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.readus.$(PRODUCT_NAME:rfc1034identifier) 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 | 40 | 41 | -------------------------------------------------------------------------------- /ColorPanel/RotaryColorPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // RotaryColorPanel.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface RotaryColorPanel : UIView 13 | 14 | @property (copy, nonatomic) void(^colorChangedHandler)(UIColor *color); 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ColorPanel/RotaryColorPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // RotaryColorPanel.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "RotaryColorPanel.h" 10 | #import "RoundColorPanel.h" 11 | #import "UIView+ColorOfPoint.h" 12 | #import "XXNibBridge.h" 13 | 14 | @interface RotaryColorPanel () 15 | 16 | /** 17 | * 可旋转的颜色板 18 | */ 19 | @property (weak, nonatomic) IBOutlet RoundColorPanel *roundColorPanel; 20 | /** 21 | * 下三角指示标识 22 | */ 23 | @property (weak, nonatomic) IBOutlet UIImageView *indicator; 24 | 25 | /** 26 | * 获取该点的颜色值 27 | */ 28 | @property (nonatomic) CGPoint referPoint; 29 | 30 | @end 31 | 32 | @implementation RotaryColorPanel 33 | 34 | - (void)awakeFromNib { 35 | [super awakeFromNib]; 36 | 37 | self.referPoint = CGPointMake(CGRectGetMidX(self.indicator.frame), CGRectGetMaxY(self.indicator.frame)); 38 | [self.roundColorPanel addTarget:self action:@selector(colorPanelRotated:) forControlEvents:UIControlEventValueChanged]; 39 | } 40 | 41 | - (void)colorPanelRotated:(id)sender { 42 | UIColor *color = [self colorOfPoint:self.referPoint]; 43 | if (self.colorChangedHandler) { 44 | self.colorChangedHandler(color); 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /ColorPanel/RotaryColorPanel.xib: -------------------------------------------------------------------------------- 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 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ColorPanel/RotaryColorPanelViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RotaryColorPanelViewController.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RotaryColorPanelViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ColorPanel/RotaryColorPanelViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RotaryColorPanelViewController.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "RotaryColorPanelViewController.h" 10 | #import "RotaryColorPanel.h" 11 | 12 | @interface RotaryColorPanelViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet RotaryColorPanel *rotaryColorPanel; 15 | 16 | @end 17 | 18 | @implementation RotaryColorPanelViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | __weak typeof(self) weakSelf = self; 24 | self.rotaryColorPanel.colorChangedHandler = ^(UIColor *color) { 25 | weakSelf.view.backgroundColor = color; 26 | }; 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ColorPanel/RoundColorPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // RoundColorPanel.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RoundColorPanel : UIControl 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ColorPanel/RoundColorPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // RoundColorPanel.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "RoundColorPanel.h" 10 | 11 | @interface RoundColorPanel () 12 | 13 | /** 14 | * ColorPanel中心点的坐标值 15 | */ 16 | @property (nonatomic) CGPoint centerPoint; 17 | 18 | @end 19 | 20 | @implementation RoundColorPanel 21 | 22 | - (void)awakeFromNib { 23 | [super awakeFromNib]; 24 | 25 | self.centerPoint = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); 26 | } 27 | 28 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 29 | 30 | CGPoint previousLocation = [touch previousLocationInView:self]; 31 | CGPoint location = [touch locationInView:self]; 32 | CGFloat previousRadian = [self radianToCenterPoint:self.centerPoint withPoint:previousLocation]; 33 | CGFloat curRadian = [self radianToCenterPoint:self.centerPoint withPoint:location]; 34 | CGFloat changedRadian = curRadian - previousRadian; 35 | [self rotateByRadian:changedRadian]; 36 | 37 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 38 | return YES; 39 | } 40 | 41 | /** 42 | * 以ColorPanel的anchorPoint为坐标原点建立坐标系,计算坐标点|point|与坐标原点的连线距离x轴正方向的夹角 43 | * 44 | * @param centerPoint 坐标原点坐标 45 | * @param point 某坐标点 46 | * 47 | * @return 坐标点|point|与坐标原点的连线距离x轴正方向的夹角 48 | */ 49 | - (CGFloat)radianToCenterPoint:(CGPoint)centerPoint withPoint:(CGPoint)point { 50 | CGVector vector = CGVectorMake(point.x - centerPoint.x, point.y - centerPoint.y); 51 | return atan2f(vector.dy, vector.dx); 52 | } 53 | 54 | /** 55 | * 将图层旋转radian弧度 56 | * 57 | * @param radian 旋转的弧度 58 | */ 59 | - (void)rotateByRadian:(CGFloat)radian { 60 | CGAffineTransform transform = self.layer.affineTransform; 61 | transform = CGAffineTransformRotate(transform, radian); 62 | self.layer.affineTransform = transform; 63 | } 64 | @end 65 | -------------------------------------------------------------------------------- /ColorPanel/SliderColorPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SliderColorPanel.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SliderColorPanel : UIControl 12 | 13 | @property (strong, nonatomic) UIColor *color; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ColorPanel/SliderColorPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SliderColorPanel.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "SliderColorPanel.h" 10 | #import "BarColorPanel.h" 11 | #import "UIView+ColorOfPoint.h" 12 | 13 | #define kColorPanelHeight 5 14 | #define kHandleRadius 10 15 | 16 | @interface SliderColorPanel () 17 | 18 | @property (strong, nonatomic) BarColorPanel *colorPanel; 19 | 20 | @property (strong, nonatomic) CALayer *outerLayer; 21 | 22 | @property (strong, nonatomic) CALayer *innerLayer; 23 | 24 | @property (nonatomic) CGFloat positionPercent; 25 | 26 | @end 27 | 28 | @implementation SliderColorPanel 29 | 30 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 31 | self = [ super initWithCoder:aDecoder]; 32 | if (self) { 33 | self.positionPercent = 0.9; 34 | 35 | if (!self.colorPanel) { 36 | self.colorPanel = [[BarColorPanel alloc] init]; 37 | [self addSubview:self.colorPanel]; 38 | } 39 | if (!self.outerLayer) { 40 | self.outerLayer = [CALayer layer]; 41 | self.outerLayer.backgroundColor = [UIColor whiteColor].CGColor; 42 | self.outerLayer.borderWidth = 1; 43 | self.outerLayer.borderColor = [UIColor colorWithRed:128/255.0f green:128/255.0f blue:128/255.0f alpha:1].CGColor; 44 | [self.layer addSublayer:self.outerLayer]; 45 | } 46 | 47 | if (!self.innerLayer) { 48 | self.innerLayer = [CALayer layer]; 49 | self.innerLayer.backgroundColor = [UIColor whiteColor].CGColor; 50 | self.innerLayer.borderWidth = 1; 51 | self.innerLayer.borderColor = [UIColor colorWithRed:128/255.0f green:128/255.0f blue:128/255.0f alpha:1].CGColor; 52 | [self.outerLayer addSublayer:self.innerLayer]; 53 | } 54 | } 55 | 56 | return self; 57 | } 58 | 59 | - (void)layoutSublayersOfLayer:(CALayer *)layer { 60 | [super layoutSublayersOfLayer:layer]; 61 | 62 | self.colorPanel.frame = CGRectMake(kHandleRadius, (CGRectGetHeight(self.frame) - kColorPanelHeight)/2, CGRectGetWidth(self.frame) - 2 * kHandleRadius, kColorPanelHeight); 63 | self.colorPanel.layer.cornerRadius = kColorPanelHeight / 2.0f; 64 | 65 | self.outerLayer.bounds = CGRectMake(0, 0, 2 * kHandleRadius, 2 * kHandleRadius); 66 | self.outerLayer.cornerRadius = kHandleRadius; 67 | self.outerLayer.position = CGPointMake(kHandleRadius + CGRectGetWidth(self.colorPanel.bounds) * self.positionPercent, CGRectGetHeight(self.frame) / 2); 68 | 69 | self.innerLayer.bounds = CGRectMake(0, 0, 9, 9); 70 | self.innerLayer.cornerRadius = CGRectGetWidth(self.innerLayer.bounds) / 2; 71 | self.innerLayer.position = CGPointMake(CGRectGetMidX(self.outerLayer.bounds), CGRectGetMidY(self.outerLayer.bounds)); 72 | } 73 | 74 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { 75 | 76 | CGPoint location = [touch locationInView:self]; 77 | CGPoint colorPanelPoint = [self convertPoint:location toView:self.colorPanel]; 78 | colorPanelPoint.y = CGRectGetHeight(self.colorPanel.bounds) / 2; 79 | CGPoint handlePoint = CGPointMake(location.x, CGRectGetHeight(self.bounds) / 2); 80 | if (colorPanelPoint.x >= 0 && colorPanelPoint.x <= CGRectGetWidth(self.colorPanel.bounds)) { 81 | [CATransaction begin]; 82 | [CATransaction setDisableActions:YES]; 83 | self.outerLayer.position = handlePoint; 84 | [CATransaction commit]; 85 | self.positionPercent = handlePoint.x / CGRectGetWidth(self.colorPanel.bounds); 86 | 87 | self.color = [self.colorPanel colorOfPoint:colorPanelPoint]; 88 | self.innerLayer.backgroundColor = self.color.CGColor; 89 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 90 | return YES; 91 | } else { 92 | return NO; 93 | } 94 | } 95 | 96 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { 97 | CGPoint handlePoint = [self.layer convertPoint:point toLayer:self.outerLayer]; 98 | CGRect largerRect = CGRectInset(self.outerLayer.bounds, -7, -7); 99 | 100 | if (CGRectContainsPoint(largerRect, handlePoint)) { 101 | return [super hitTest:point withEvent:event]; 102 | } else { 103 | return nil; 104 | } 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /ColorPanel/SliderColorPanelViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SliderColorPanelViewController.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SliderColorPanelViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ColorPanel/SliderColorPanelViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SliderColorPanelViewController.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/27. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "SliderColorPanelViewController.h" 10 | #import "SliderColorPanel.h" 11 | 12 | @interface SliderColorPanelViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet SliderColorPanel *sliderColorPanel; 15 | 16 | @end 17 | 18 | @implementation SliderColorPanelViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | [self.sliderColorPanel addTarget:self action:@selector(sliderColorPanelValueChanged:) forControlEvents:UIControlEventValueChanged]; 24 | } 25 | 26 | - (void)didReceiveMemoryWarning { 27 | [super didReceiveMemoryWarning]; 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | - (void)sliderColorPanelValueChanged:(SliderColorPanel *)sender { 32 | UIColor *color = sender.color; 33 | self.view.backgroundColor = color; 34 | } 35 | 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ColorPanel/UIView+ColorOfPoint.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ColorOfPoint.h 3 | // Bulb 4 | // 5 | // Created by MaohuaLiu on 15/7/22. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @interface UIView (ColorOfPoint) 13 | 14 | - (UIColor *)colorOfPoint:(CGPoint)point; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ColorPanel/UIView+ColorOfPoint.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ColorOfPoint.m 3 | // Bulb 4 | // 5 | // Created by MaohuaLiu on 15/7/22. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | 10 | #import "UIView+ColorOfPoint.h" 11 | #import 12 | 13 | @implementation UIView (ColorOfPoint) 14 | 15 | - (UIColor *)colorOfPoint:(CGPoint)point { 16 | unsigned char pixel[4] = {0}; 17 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 18 | CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); 19 | 20 | CGContextTranslateCTM(context, -point.x, -point.y); 21 | 22 | [self.layer renderInContext:context]; 23 | 24 | CGContextRelease(context); 25 | CGColorSpaceRelease(colorSpace); 26 | 27 | UIColor *color = [UIColor colorWithRed:pixel[0]/255.0 green:pixel[1]/255.0 blue:pixel[2]/255.0 alpha:pixel[3]/255.0]; 28 | 29 | return color; 30 | } 31 | @end 32 | -------------------------------------------------------------------------------- /ColorPanel/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ColorPanel/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ColorPanel/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ColorPanel 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ColorPanelTests/ColorPanelTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ColorPanelTests.m 3 | // ColorPanelTests 4 | // 5 | // Created by MaohuaLiu on 15/7/26. 6 | // Copyright (c) 2015年 CaryaLiu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ColorPanelTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ColorPanelTests 17 | 18 | - (void)setUp { 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 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ColorPanelTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.readus.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'ColorPanel' do 5 | 6 | pod 'XXNibBridge', '2.1' 7 | 8 | end 9 | 10 | target 'ColorPanelTests' do 11 | 12 | end 13 | 14 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - XXNibBridge (2.1) 3 | 4 | DEPENDENCIES: 5 | - XXNibBridge (= 2.1) 6 | 7 | SPEC CHECKSUMS: 8 | XXNibBridge: 04ce6b4f8a2e33857396f1c369581436c390cb7d 9 | 10 | COCOAPODS: 0.35.0 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Demo to get the color at one point of UIView, include of the color of immovable view, color of rotating view. like this: 2 | 3 | ![不可移动的颜色板][] 4 | 5 | ![可旋转的颜色板][] 6 | 7 | ![滑条式颜色板][] 8 | 9 | 10 | [不可移动的颜色板]: http://7jpr4u.com1.z0.glb.clouddn.com/img/ios-color-panel/ios-immovable-color-panel.png 11 | [可旋转的颜色板]: http://7jpr4u.com1.z0.glb.clouddn.com/img/ios-color-panel/ios-rotary-color-panel.png 12 | [滑条式颜色板]: http://7jpr4u.com1.z0.glb.clouddn.com/img/ios-color-panel/ios-slider-color-panel.png --------------------------------------------------------------------------------