├── MostColorPicker.xcodeproj └── project.pbxproj ├── MostColorPicker ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── MostColorPicker-Info.plist ├── MostColorPicker-Prefix.pch ├── SBAppDelegate.h ├── SBAppDelegate.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── README.md ├── UIImage+MostColor.h └── UIImage+MostColor.m /MostColorPicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1F2D988A175768AA00EF4C87 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F2D9889175768AA00EF4C87 /* UIKit.framework */; }; 11 | 1F2D988C175768AA00EF4C87 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F2D988B175768AA00EF4C87 /* Foundation.framework */; }; 12 | 1F2D988E175768AA00EF4C87 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F2D988D175768AA00EF4C87 /* CoreGraphics.framework */; }; 13 | 1F2D9894175768AB00EF4C87 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D9892175768AB00EF4C87 /* InfoPlist.strings */; }; 14 | 1F2D9896175768AB00EF4C87 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F2D9895175768AB00EF4C87 /* main.m */; }; 15 | 1F2D989A175768AB00EF4C87 /* SBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F2D9899175768AB00EF4C87 /* SBAppDelegate.m */; }; 16 | 1F2D989C175768AB00EF4C87 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D989B175768AB00EF4C87 /* Default.png */; }; 17 | 1F2D989E175768AB00EF4C87 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D989D175768AB00EF4C87 /* Default@2x.png */; }; 18 | 1F2D98A0175768AB00EF4C87 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D989F175768AB00EF4C87 /* Default-568h@2x.png */; }; 19 | 1F2D98A8175768CB00EF4C87 /* UIImage+MostColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F2D98A7175768CB00EF4C87 /* UIImage+MostColor.m */; }; 20 | 1F2D98AC17576BF900EF4C87 /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D98A917576BF900EF4C87 /* 1.jpg */; }; 21 | 1F2D98AD17576BF900EF4C87 /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D98AA17576BF900EF4C87 /* 3.jpg */; }; 22 | 1F2D98AE17576BF900EF4C87 /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 1F2D98AB17576BF900EF4C87 /* 2.jpg */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 1F2D9886175768AA00EF4C87 /* MostColorPicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MostColorPicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 1F2D9889175768AA00EF4C87 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 28 | 1F2D988B175768AA00EF4C87 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 29 | 1F2D988D175768AA00EF4C87 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | 1F2D9891175768AB00EF4C87 /* MostColorPicker-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MostColorPicker-Info.plist"; sourceTree = ""; }; 31 | 1F2D9893175768AB00EF4C87 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 32 | 1F2D9895175768AB00EF4C87 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 1F2D9897175768AB00EF4C87 /* MostColorPicker-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MostColorPicker-Prefix.pch"; sourceTree = ""; }; 34 | 1F2D9898175768AB00EF4C87 /* SBAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBAppDelegate.h; sourceTree = ""; }; 35 | 1F2D9899175768AB00EF4C87 /* SBAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBAppDelegate.m; sourceTree = ""; }; 36 | 1F2D989B175768AB00EF4C87 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 37 | 1F2D989D175768AB00EF4C87 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 38 | 1F2D989F175768AB00EF4C87 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 39 | 1F2D98A6175768CB00EF4C87 /* UIImage+MostColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+MostColor.h"; sourceTree = ""; }; 40 | 1F2D98A7175768CB00EF4C87 /* UIImage+MostColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+MostColor.m"; sourceTree = ""; }; 41 | 1F2D98A917576BF900EF4C87 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = ""; }; 42 | 1F2D98AA17576BF900EF4C87 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = ""; }; 43 | 1F2D98AB17576BF900EF4C87 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = ""; }; 44 | /* End PBXFileReference section */ 45 | 46 | /* Begin PBXFrameworksBuildPhase section */ 47 | 1F2D9883175768AA00EF4C87 /* Frameworks */ = { 48 | isa = PBXFrameworksBuildPhase; 49 | buildActionMask = 2147483647; 50 | files = ( 51 | 1F2D988A175768AA00EF4C87 /* UIKit.framework in Frameworks */, 52 | 1F2D988C175768AA00EF4C87 /* Foundation.framework in Frameworks */, 53 | 1F2D988E175768AA00EF4C87 /* CoreGraphics.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 1F2D987D175768AA00EF4C87 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 1F2D98A6175768CB00EF4C87 /* UIImage+MostColor.h */, 64 | 1F2D98A7175768CB00EF4C87 /* UIImage+MostColor.m */, 65 | 1F2D988F175768AB00EF4C87 /* MostColorPicker */, 66 | 1F2D9888175768AA00EF4C87 /* Frameworks */, 67 | 1F2D9887175768AA00EF4C87 /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 1F2D9887175768AA00EF4C87 /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 1F2D9886175768AA00EF4C87 /* MostColorPicker.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 1F2D9888175768AA00EF4C87 /* Frameworks */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 1F2D9889175768AA00EF4C87 /* UIKit.framework */, 83 | 1F2D988B175768AA00EF4C87 /* Foundation.framework */, 84 | 1F2D988D175768AA00EF4C87 /* CoreGraphics.framework */, 85 | ); 86 | name = Frameworks; 87 | sourceTree = ""; 88 | }; 89 | 1F2D988F175768AB00EF4C87 /* MostColorPicker */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 1F2D9898175768AB00EF4C87 /* SBAppDelegate.h */, 93 | 1F2D9899175768AB00EF4C87 /* SBAppDelegate.m */, 94 | 1F2D9890175768AB00EF4C87 /* Supporting Files */, 95 | ); 96 | path = MostColorPicker; 97 | sourceTree = ""; 98 | }; 99 | 1F2D9890175768AB00EF4C87 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 1F2D98A917576BF900EF4C87 /* 1.jpg */, 103 | 1F2D98AA17576BF900EF4C87 /* 3.jpg */, 104 | 1F2D98AB17576BF900EF4C87 /* 2.jpg */, 105 | 1F2D9891175768AB00EF4C87 /* MostColorPicker-Info.plist */, 106 | 1F2D9892175768AB00EF4C87 /* InfoPlist.strings */, 107 | 1F2D9895175768AB00EF4C87 /* main.m */, 108 | 1F2D9897175768AB00EF4C87 /* MostColorPicker-Prefix.pch */, 109 | 1F2D989B175768AB00EF4C87 /* Default.png */, 110 | 1F2D989D175768AB00EF4C87 /* Default@2x.png */, 111 | 1F2D989F175768AB00EF4C87 /* Default-568h@2x.png */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | 1F2D9885175768AA00EF4C87 /* MostColorPicker */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = 1F2D98A3175768AB00EF4C87 /* Build configuration list for PBXNativeTarget "MostColorPicker" */; 122 | buildPhases = ( 123 | 1F2D9882175768AA00EF4C87 /* Sources */, 124 | 1F2D9883175768AA00EF4C87 /* Frameworks */, 125 | 1F2D9884175768AA00EF4C87 /* Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = MostColorPicker; 132 | productName = MostColorPicker; 133 | productReference = 1F2D9886175768AA00EF4C87 /* MostColorPicker.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | 1F2D987E175768AA00EF4C87 /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | CLASSPREFIX = SB; 143 | LastUpgradeCheck = 0460; 144 | ORGANIZATIONNAME = "Plumn LLC."; 145 | }; 146 | buildConfigurationList = 1F2D9881175768AA00EF4C87 /* Build configuration list for PBXProject "MostColorPicker" */; 147 | compatibilityVersion = "Xcode 3.2"; 148 | developmentRegion = English; 149 | hasScannedForEncodings = 0; 150 | knownRegions = ( 151 | en, 152 | ); 153 | mainGroup = 1F2D987D175768AA00EF4C87; 154 | productRefGroup = 1F2D9887175768AA00EF4C87 /* Products */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | 1F2D9885175768AA00EF4C87 /* MostColorPicker */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | 1F2D9884175768AA00EF4C87 /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 1F2D9894175768AB00EF4C87 /* InfoPlist.strings in Resources */, 169 | 1F2D989C175768AB00EF4C87 /* Default.png in Resources */, 170 | 1F2D989E175768AB00EF4C87 /* Default@2x.png in Resources */, 171 | 1F2D98A0175768AB00EF4C87 /* Default-568h@2x.png in Resources */, 172 | 1F2D98AC17576BF900EF4C87 /* 1.jpg in Resources */, 173 | 1F2D98AD17576BF900EF4C87 /* 3.jpg in Resources */, 174 | 1F2D98AE17576BF900EF4C87 /* 2.jpg in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXResourcesBuildPhase section */ 179 | 180 | /* Begin PBXSourcesBuildPhase section */ 181 | 1F2D9882175768AA00EF4C87 /* Sources */ = { 182 | isa = PBXSourcesBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | 1F2D9896175768AB00EF4C87 /* main.m in Sources */, 186 | 1F2D989A175768AB00EF4C87 /* SBAppDelegate.m in Sources */, 187 | 1F2D98A8175768CB00EF4C87 /* UIImage+MostColor.m in Sources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXSourcesBuildPhase section */ 192 | 193 | /* Begin PBXVariantGroup section */ 194 | 1F2D9892175768AB00EF4C87 /* InfoPlist.strings */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 1F2D9893175768AB00EF4C87 /* en */, 198 | ); 199 | name = InfoPlist.strings; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXVariantGroup section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | 1F2D98A1175768AB00EF4C87 /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_WARN_CONSTANT_CONVERSION = YES; 212 | CLANG_WARN_EMPTY_BODY = YES; 213 | CLANG_WARN_ENUM_CONVERSION = YES; 214 | CLANG_WARN_INT_CONVERSION = YES; 215 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 216 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 217 | COPY_PHASE_STRIP = NO; 218 | GCC_C_LANGUAGE_STANDARD = gnu99; 219 | GCC_DYNAMIC_NO_PIC = NO; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 227 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 228 | GCC_WARN_UNUSED_VARIABLE = YES; 229 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | TARGETED_DEVICE_FAMILY = "1,2"; 233 | }; 234 | name = Debug; 235 | }; 236 | 1F2D98A2175768AB00EF4C87 /* Release */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_WARN_CONSTANT_CONVERSION = YES; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INT_CONVERSION = YES; 246 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 247 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 248 | COPY_PHASE_STRIP = YES; 249 | GCC_C_LANGUAGE_STANDARD = gnu99; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 254 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 255 | SDKROOT = iphoneos; 256 | TARGETED_DEVICE_FAMILY = "1,2"; 257 | VALIDATE_PRODUCT = YES; 258 | }; 259 | name = Release; 260 | }; 261 | 1F2D98A4175768AB00EF4C87 /* Debug */ = { 262 | isa = XCBuildConfiguration; 263 | buildSettings = { 264 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 265 | GCC_PREFIX_HEADER = "MostColorPicker/MostColorPicker-Prefix.pch"; 266 | INFOPLIST_FILE = "MostColorPicker/MostColorPicker-Info.plist"; 267 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | WRAPPER_EXTENSION = app; 270 | }; 271 | name = Debug; 272 | }; 273 | 1F2D98A5175768AB00EF4C87 /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 277 | GCC_PREFIX_HEADER = "MostColorPicker/MostColorPicker-Prefix.pch"; 278 | INFOPLIST_FILE = "MostColorPicker/MostColorPicker-Info.plist"; 279 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 280 | PRODUCT_NAME = "$(TARGET_NAME)"; 281 | WRAPPER_EXTENSION = app; 282 | }; 283 | name = Release; 284 | }; 285 | /* End XCBuildConfiguration section */ 286 | 287 | /* Begin XCConfigurationList section */ 288 | 1F2D9881175768AA00EF4C87 /* Build configuration list for PBXProject "MostColorPicker" */ = { 289 | isa = XCConfigurationList; 290 | buildConfigurations = ( 291 | 1F2D98A1175768AB00EF4C87 /* Debug */, 292 | 1F2D98A2175768AB00EF4C87 /* Release */, 293 | ); 294 | defaultConfigurationIsVisible = 0; 295 | defaultConfigurationName = Release; 296 | }; 297 | 1F2D98A3175768AB00EF4C87 /* Build configuration list for PBXNativeTarget "MostColorPicker" */ = { 298 | isa = XCConfigurationList; 299 | buildConfigurations = ( 300 | 1F2D98A4175768AB00EF4C87 /* Debug */, 301 | 1F2D98A5175768AB00EF4C87 /* Release */, 302 | ); 303 | defaultConfigurationIsVisible = 0; 304 | defaultConfigurationName = Release; 305 | }; 306 | /* End XCConfigurationList section */ 307 | }; 308 | rootObject = 1F2D987E175768AA00EF4C87 /* Project object */; 309 | } 310 | -------------------------------------------------------------------------------- /MostColorPicker/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/1.jpg -------------------------------------------------------------------------------- /MostColorPicker/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/2.jpg -------------------------------------------------------------------------------- /MostColorPicker/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/3.jpg -------------------------------------------------------------------------------- /MostColorPicker/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/Default-568h@2x.png -------------------------------------------------------------------------------- /MostColorPicker/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/Default.png -------------------------------------------------------------------------------- /MostColorPicker/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trawor/MostColorPicker/f26d9177d5c932fcb973b12b2235f477be0a323f/MostColorPicker/Default@2x.png -------------------------------------------------------------------------------- /MostColorPicker/MostColorPicker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.plumn.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /MostColorPicker/MostColorPicker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MostColorPicker' target in the 'MostColorPicker' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /MostColorPicker/SBAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SBAppDelegate.h 3 | // MostColorPicker 4 | // 5 | // Created by Travis on 13-5-30. 6 | // Copyright (c) 2013年 Plumn LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SBAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | @property (nonatomic,assign) UIImageView *imageView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MostColorPicker/SBAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SBAppDelegate.m 3 | // MostColorPicker 4 | // 5 | // Created by Travis on 13-5-30. 6 | // Copyright (c) 2013年 Plumn LLC. All rights reserved. 7 | // 8 | 9 | #import "SBAppDelegate.h" 10 | 11 | #import "UIImage+MostColor.h" 12 | 13 | 14 | @implementation SBAppDelegate 15 | 16 | - (void)dealloc 17 | { 18 | [_window release]; 19 | [super dealloc]; 20 | } 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 23 | { 24 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 25 | [self.window makeKeyAndVisible]; 26 | self.window.backgroundColor=[UIColor whiteColor]; 27 | 28 | self.imageView=[[[UIImageView alloc] initWithFrame:CGRectMake(110, 200, 100, 100)] autorelease]; 29 | [self.window addSubview:self.imageView]; 30 | 31 | 32 | 33 | UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 34 | 35 | btn.frame=CGRectMake(20, 20, 60, 60); 36 | [btn addTarget:self action:@selector(onBtn:) forControlEvents:UIControlEventTouchUpInside]; 37 | [btn setTitle:@"1" forState:UIControlStateNormal]; 38 | btn.tag=1; 39 | [self.window addSubview:btn]; 40 | 41 | btn=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 42 | [btn addTarget:self action:@selector(onBtn:) forControlEvents:UIControlEventTouchUpInside]; 43 | btn.frame=CGRectMake(100, 20, 60, 60); 44 | [btn setTitle:@"2" forState:UIControlStateNormal]; 45 | btn.tag=2; 46 | [self.window addSubview:btn]; 47 | 48 | btn=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 49 | [btn addTarget:self action:@selector(onBtn:) forControlEvents:UIControlEventTouchUpInside]; 50 | btn.frame=CGRectMake(180, 20, 60, 60); 51 | [btn setTitle:@"3" forState:UIControlStateNormal]; 52 | btn.tag=3; 53 | [self.window addSubview:btn]; 54 | 55 | return YES; 56 | } 57 | 58 | -(void)onBtn:(UIButton*)btn{ 59 | UIImage *img=[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",btn.tag]]; 60 | self.imageView.image=img; 61 | 62 | UIColor *most=[img mostColor]; 63 | self.window.backgroundColor=most; 64 | 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /MostColorPicker/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MostColorPicker/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MostColorPicker 4 | // 5 | // Created by Travis on 13-5-30. 6 | // Copyright (c) 2013年 Plumn LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SBAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SBAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 这是一个UIImage的helper. 可以实现类似iTunes11里的封面动态背景颜色效果 2 | 3 | 大概原理是: 4 | 5 | 1. 把图片缩小 加快计算速度 6 | 2. 得到每个点的RGBA 7 | 3. 找出出现最多的那个颜色 8 | 9 | 与iTunes的颜色**不尽相同**. 因为iTunes里图片是放在最右边了 所以只取了最左边的一部分像素. 10 | 11 | 12 | 可以通过微博跟我交流 [@trawor](http://weibo.com/trawor) 13 | 14 | 15 | 效果: 16 | 17 | ![](http://media.tumblr.com/7e9edf006e8d5ae92f9252284c862de6/tumblr_inline_mnsqpgGSyw1qz4rgp.png) 18 | ![](http://media.tumblr.com/8d39b8ee7004b68f228195e14751f80c/tumblr_inline_mnsqq26JKX1qz4rgp.png) 19 | 20 | 21 | -------------------------------------------------------------------------------- /UIImage+MostColor.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MostColor.h 3 | // Modo 4 | // 5 | // Created by Travis on 13-5-30. 6 | // Copyright (c) 2013年 Plumn LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage(MostColor) 12 | -(UIColor*)mostColor; 13 | @end 14 | -------------------------------------------------------------------------------- /UIImage+MostColor.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MostColor.m 3 | // Modo 4 | // 5 | // Created by Travis on 13-5-30. 6 | // Copyright (c) 2013年 Plumn LLC. All rights reserved. 7 | // 8 | 9 | #import "UIImage+MostColor.h" 10 | 11 | @implementation UIImage(MostColor) 12 | 13 | -(UIColor*)mostColor{ 14 | 15 | //第一步 先把图片缩小 加快计算速度. 但越小结果误差可能越大 16 | CGSize thumbSize=CGSizeMake(50, 50); 17 | 18 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 19 | CGContextRef context = CGBitmapContextCreate(NULL, 20 | thumbSize.width, 21 | thumbSize.height, 22 | 8,//bits per component 23 | thumbSize.width*4, 24 | colorSpace, 25 | kCGImageAlphaPremultipliedLast); 26 | 27 | CGRect drawRect = CGRectMake(0, 0, thumbSize.width, thumbSize.height); 28 | CGContextDrawImage(context, drawRect, self.CGImage); 29 | CGColorSpaceRelease(colorSpace); 30 | 31 | 32 | 33 | //第二步 取每个点的像素值 34 | unsigned char* data = CGBitmapContextGetData (context); 35 | 36 | if (data == NULL) return nil; 37 | 38 | NSCountedSet *cls=[NSCountedSet setWithCapacity:thumbSize.width*thumbSize.height]; 39 | 40 | for (int x=0; x