├── CWStarRatingViewDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── wangchao.xcuserdatad │ └── xcschemes │ ├── CWStarRatingViewDemo.xcscheme │ └── xcschememanagement.plist ├── CWStarRatingViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CWStarRateView.h ├── CWStarRateView.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m ├── b27_icon_star_gray@2x.png ├── b27_icon_star_yellow@2x.png └── main.m ├── CWStarRatingViewDemoTests ├── CWStarRatingViewDemoTests.m └── Info.plist ├── README.md └── Screen Shot.png /CWStarRatingViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7FE671F01A0E63A400E2D872 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE671EF1A0E63A400E2D872 /* main.m */; }; 11 | 7FE671F31A0E63A400E2D872 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE671F21A0E63A400E2D872 /* AppDelegate.m */; }; 12 | 7FE671F61A0E63A400E2D872 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE671F51A0E63A400E2D872 /* ViewController.m */; }; 13 | 7FE671F91A0E63A400E2D872 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7FE671F71A0E63A400E2D872 /* Main.storyboard */; }; 14 | 7FE671FB1A0E63A400E2D872 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7FE671FA1A0E63A400E2D872 /* Images.xcassets */; }; 15 | 7FE671FE1A0E63A400E2D872 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7FE671FC1A0E63A400E2D872 /* LaunchScreen.xib */; }; 16 | 7FE6720A1A0E63A400E2D872 /* CWStarRatingViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE672091A0E63A400E2D872 /* CWStarRatingViewDemoTests.m */; }; 17 | 7FE672151A0E63B700E2D872 /* CWStarRateView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE672141A0E63B700E2D872 /* CWStarRateView.m */; }; 18 | 7FE672191A0E644500E2D872 /* b27_icon_star_gray@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7FE672171A0E644500E2D872 /* b27_icon_star_gray@2x.png */; }; 19 | 7FE6721A1A0E644500E2D872 /* b27_icon_star_yellow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7FE672181A0E644500E2D872 /* b27_icon_star_yellow@2x.png */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 7FE672041A0E63A400E2D872 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 7FE671E21A0E63A400E2D872 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 7FE671E91A0E63A400E2D872; 28 | remoteInfo = CWStarRatingViewDemo; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 7FE671EA1A0E63A400E2D872 /* CWStarRatingViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CWStarRatingViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 7FE671EE1A0E63A400E2D872 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 7FE671EF1A0E63A400E2D872 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 7FE671F11A0E63A400E2D872 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 7FE671F21A0E63A400E2D872 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 7FE671F41A0E63A400E2D872 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | 7FE671F51A0E63A400E2D872 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | 7FE671F81A0E63A400E2D872 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 7FE671FA1A0E63A400E2D872 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | 7FE671FD1A0E63A400E2D872 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | 7FE672031A0E63A400E2D872 /* CWStarRatingViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CWStarRatingViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 7FE672081A0E63A400E2D872 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 7FE672091A0E63A400E2D872 /* CWStarRatingViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CWStarRatingViewDemoTests.m; sourceTree = ""; }; 46 | 7FE672131A0E63B700E2D872 /* CWStarRateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWStarRateView.h; sourceTree = ""; }; 47 | 7FE672141A0E63B700E2D872 /* CWStarRateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CWStarRateView.m; sourceTree = ""; }; 48 | 7FE672171A0E644500E2D872 /* b27_icon_star_gray@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "b27_icon_star_gray@2x.png"; sourceTree = ""; }; 49 | 7FE672181A0E644500E2D872 /* b27_icon_star_yellow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "b27_icon_star_yellow@2x.png"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 7FE671E71A0E63A400E2D872 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | 7FE672001A0E63A400E2D872 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 7FE671E11A0E63A400E2D872 = { 71 | isa = PBXGroup; 72 | children = ( 73 | 7FE671EC1A0E63A400E2D872 /* CWStarRatingViewDemo */, 74 | 7FE672061A0E63A400E2D872 /* CWStarRatingViewDemoTests */, 75 | 7FE671EB1A0E63A400E2D872 /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 7FE671EB1A0E63A400E2D872 /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 7FE671EA1A0E63A400E2D872 /* CWStarRatingViewDemo.app */, 83 | 7FE672031A0E63A400E2D872 /* CWStarRatingViewDemoTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 7FE671EC1A0E63A400E2D872 /* CWStarRatingViewDemo */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 7FE672161A0E642C00E2D872 /* CWStarRateView */, 92 | 7FE671F11A0E63A400E2D872 /* AppDelegate.h */, 93 | 7FE671F21A0E63A400E2D872 /* AppDelegate.m */, 94 | 7FE671F41A0E63A400E2D872 /* ViewController.h */, 95 | 7FE671F51A0E63A400E2D872 /* ViewController.m */, 96 | 7FE671F71A0E63A400E2D872 /* Main.storyboard */, 97 | 7FE671FA1A0E63A400E2D872 /* Images.xcassets */, 98 | 7FE671FC1A0E63A400E2D872 /* LaunchScreen.xib */, 99 | 7FE671ED1A0E63A400E2D872 /* Supporting Files */, 100 | ); 101 | path = CWStarRatingViewDemo; 102 | sourceTree = ""; 103 | }; 104 | 7FE671ED1A0E63A400E2D872 /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 7FE671EE1A0E63A400E2D872 /* Info.plist */, 108 | 7FE671EF1A0E63A400E2D872 /* main.m */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | 7FE672061A0E63A400E2D872 /* CWStarRatingViewDemoTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 7FE672091A0E63A400E2D872 /* CWStarRatingViewDemoTests.m */, 117 | 7FE672071A0E63A400E2D872 /* Supporting Files */, 118 | ); 119 | path = CWStarRatingViewDemoTests; 120 | sourceTree = ""; 121 | }; 122 | 7FE672071A0E63A400E2D872 /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 7FE672081A0E63A400E2D872 /* Info.plist */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | 7FE672161A0E642C00E2D872 /* CWStarRateView */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 7FE672171A0E644500E2D872 /* b27_icon_star_gray@2x.png */, 134 | 7FE672181A0E644500E2D872 /* b27_icon_star_yellow@2x.png */, 135 | 7FE672131A0E63B700E2D872 /* CWStarRateView.h */, 136 | 7FE672141A0E63B700E2D872 /* CWStarRateView.m */, 137 | ); 138 | name = CWStarRateView; 139 | sourceTree = ""; 140 | }; 141 | /* End PBXGroup section */ 142 | 143 | /* Begin PBXNativeTarget section */ 144 | 7FE671E91A0E63A400E2D872 /* CWStarRatingViewDemo */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = 7FE6720D1A0E63A400E2D872 /* Build configuration list for PBXNativeTarget "CWStarRatingViewDemo" */; 147 | buildPhases = ( 148 | 7FE671E61A0E63A400E2D872 /* Sources */, 149 | 7FE671E71A0E63A400E2D872 /* Frameworks */, 150 | 7FE671E81A0E63A400E2D872 /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = CWStarRatingViewDemo; 157 | productName = CWStarRatingViewDemo; 158 | productReference = 7FE671EA1A0E63A400E2D872 /* CWStarRatingViewDemo.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | 7FE672021A0E63A400E2D872 /* CWStarRatingViewDemoTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = 7FE672101A0E63A400E2D872 /* Build configuration list for PBXNativeTarget "CWStarRatingViewDemoTests" */; 164 | buildPhases = ( 165 | 7FE671FF1A0E63A400E2D872 /* Sources */, 166 | 7FE672001A0E63A400E2D872 /* Frameworks */, 167 | 7FE672011A0E63A400E2D872 /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | 7FE672051A0E63A400E2D872 /* PBXTargetDependency */, 173 | ); 174 | name = CWStarRatingViewDemoTests; 175 | productName = CWStarRatingViewDemoTests; 176 | productReference = 7FE672031A0E63A400E2D872 /* CWStarRatingViewDemoTests.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | 7FE671E21A0E63A400E2D872 /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastUpgradeCheck = 0610; 186 | ORGANIZATIONNAME = wangchao; 187 | TargetAttributes = { 188 | 7FE671E91A0E63A400E2D872 = { 189 | CreatedOnToolsVersion = 6.1; 190 | }; 191 | 7FE672021A0E63A400E2D872 = { 192 | CreatedOnToolsVersion = 6.1; 193 | TestTargetID = 7FE671E91A0E63A400E2D872; 194 | }; 195 | }; 196 | }; 197 | buildConfigurationList = 7FE671E51A0E63A400E2D872 /* Build configuration list for PBXProject "CWStarRatingViewDemo" */; 198 | compatibilityVersion = "Xcode 3.2"; 199 | developmentRegion = English; 200 | hasScannedForEncodings = 0; 201 | knownRegions = ( 202 | en, 203 | Base, 204 | ); 205 | mainGroup = 7FE671E11A0E63A400E2D872; 206 | productRefGroup = 7FE671EB1A0E63A400E2D872 /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | 7FE671E91A0E63A400E2D872 /* CWStarRatingViewDemo */, 211 | 7FE672021A0E63A400E2D872 /* CWStarRatingViewDemoTests */, 212 | ); 213 | }; 214 | /* End PBXProject section */ 215 | 216 | /* Begin PBXResourcesBuildPhase section */ 217 | 7FE671E81A0E63A400E2D872 /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | 7FE672191A0E644500E2D872 /* b27_icon_star_gray@2x.png in Resources */, 222 | 7FE6721A1A0E644500E2D872 /* b27_icon_star_yellow@2x.png in Resources */, 223 | 7FE671F91A0E63A400E2D872 /* Main.storyboard in Resources */, 224 | 7FE671FE1A0E63A400E2D872 /* LaunchScreen.xib in Resources */, 225 | 7FE671FB1A0E63A400E2D872 /* Images.xcassets in Resources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | 7FE672011A0E63A400E2D872 /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXSourcesBuildPhase section */ 239 | 7FE671E61A0E63A400E2D872 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | 7FE671F61A0E63A400E2D872 /* ViewController.m in Sources */, 244 | 7FE671F31A0E63A400E2D872 /* AppDelegate.m in Sources */, 245 | 7FE672151A0E63B700E2D872 /* CWStarRateView.m in Sources */, 246 | 7FE671F01A0E63A400E2D872 /* main.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | 7FE671FF1A0E63A400E2D872 /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 7FE6720A1A0E63A400E2D872 /* CWStarRatingViewDemoTests.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | 7FE672051A0E63A400E2D872 /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = 7FE671E91A0E63A400E2D872 /* CWStarRatingViewDemo */; 264 | targetProxy = 7FE672041A0E63A400E2D872 /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | 7FE671F71A0E63A400E2D872 /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 7FE671F81A0E63A400E2D872 /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | 7FE671FC1A0E63A400E2D872 /* LaunchScreen.xib */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | 7FE671FD1A0E63A400E2D872 /* Base */, 281 | ); 282 | name = LaunchScreen.xib; 283 | sourceTree = ""; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | 7FE6720B1A0E63A400E2D872 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 293 | CLANG_CXX_LIBRARY = "libc++"; 294 | CLANG_ENABLE_MODULES = YES; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_BOOL_CONVERSION = YES; 297 | CLANG_WARN_CONSTANT_CONVERSION = YES; 298 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INT_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | ENABLE_STRICT_OBJC_MSGSEND = YES; 308 | GCC_C_LANGUAGE_STANDARD = gnu99; 309 | GCC_DYNAMIC_NO_PIC = NO; 310 | GCC_OPTIMIZATION_LEVEL = 0; 311 | GCC_PREPROCESSOR_DEFINITIONS = ( 312 | "DEBUG=1", 313 | "$(inherited)", 314 | ); 315 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 316 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 317 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 318 | GCC_WARN_UNDECLARED_SELECTOR = YES; 319 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 320 | GCC_WARN_UNUSED_FUNCTION = YES; 321 | GCC_WARN_UNUSED_VARIABLE = YES; 322 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 323 | MTL_ENABLE_DEBUG_INFO = YES; 324 | ONLY_ACTIVE_ARCH = YES; 325 | SDKROOT = iphoneos; 326 | }; 327 | name = Debug; 328 | }; 329 | 7FE6720C1A0E63A400E2D872 /* Release */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_WARN_BOOL_CONVERSION = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_UNREACHABLE_CODE = YES; 345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | COPY_PHASE_STRIP = YES; 348 | ENABLE_NS_ASSERTIONS = NO; 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | GCC_C_LANGUAGE_STANDARD = gnu99; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 358 | MTL_ENABLE_DEBUG_INFO = NO; 359 | SDKROOT = iphoneos; 360 | VALIDATE_PRODUCT = YES; 361 | }; 362 | name = Release; 363 | }; 364 | 7FE6720E1A0E63A400E2D872 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 368 | INFOPLIST_FILE = CWStarRatingViewDemo/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | }; 372 | name = Debug; 373 | }; 374 | 7FE6720F1A0E63A400E2D872 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | INFOPLIST_FILE = CWStarRatingViewDemo/Info.plist; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | }; 382 | name = Release; 383 | }; 384 | 7FE672111A0E63A400E2D872 /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | BUNDLE_LOADER = "$(TEST_HOST)"; 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "$(SDKROOT)/Developer/Library/Frameworks", 390 | "$(inherited)", 391 | ); 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | INFOPLIST_FILE = CWStarRatingViewDemoTests/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CWStarRatingViewDemo.app/CWStarRatingViewDemo"; 400 | }; 401 | name = Debug; 402 | }; 403 | 7FE672121A0E63A400E2D872 /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | BUNDLE_LOADER = "$(TEST_HOST)"; 407 | FRAMEWORK_SEARCH_PATHS = ( 408 | "$(SDKROOT)/Developer/Library/Frameworks", 409 | "$(inherited)", 410 | ); 411 | INFOPLIST_FILE = CWStarRatingViewDemoTests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CWStarRatingViewDemo.app/CWStarRatingViewDemo"; 415 | }; 416 | name = Release; 417 | }; 418 | /* End XCBuildConfiguration section */ 419 | 420 | /* Begin XCConfigurationList section */ 421 | 7FE671E51A0E63A400E2D872 /* Build configuration list for PBXProject "CWStarRatingViewDemo" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | 7FE6720B1A0E63A400E2D872 /* Debug */, 425 | 7FE6720C1A0E63A400E2D872 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | 7FE6720D1A0E63A400E2D872 /* Build configuration list for PBXNativeTarget "CWStarRatingViewDemo" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 7FE6720E1A0E63A400E2D872 /* Debug */, 434 | 7FE6720F1A0E63A400E2D872 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | }; 438 | 7FE672101A0E63A400E2D872 /* Build configuration list for PBXNativeTarget "CWStarRatingViewDemoTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 7FE672111A0E63A400E2D872 /* Debug */, 442 | 7FE672121A0E63A400E2D872 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | }; 446 | /* End XCConfigurationList section */ 447 | }; 448 | rootObject = 7FE671E21A0E63A400E2D872 /* Project object */; 449 | } 450 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo.xcodeproj/xcuserdata/wangchao.xcuserdatad/xcschemes/CWStarRatingViewDemo.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo.xcodeproj/xcuserdata/wangchao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CWStarRatingViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 7FE671E91A0E63A400E2D872 16 | 17 | primary 18 | 19 | 20 | 7FE672021A0E63A400E2D872 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CWStarRatingViewDemo 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. 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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CWStarRatingViewDemo 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. 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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/CWStarRateView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CWStarRateView.h 3 | // StarRateDemo 4 | // 5 | // Created by WANGCHAO on 14/11/4. 6 | // Copyright (c) 2014年 wangchao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CWStarRateView; 12 | @protocol CWStarRateViewDelegate 13 | @optional 14 | - (void)starRateView:(CWStarRateView *)starRateView scroePercentDidChange:(CGFloat)newScorePercent; 15 | @end 16 | 17 | @interface CWStarRateView : UIView 18 | 19 | @property (nonatomic, assign) CGFloat scorePercent;//得分值,范围为0--1,默认为1 20 | @property (nonatomic, assign) BOOL hasAnimation;//是否允许动画,默认为NO 21 | @property (nonatomic, assign) BOOL allowIncompleteStar;//评分时是否允许不是整星,默认为NO 22 | 23 | @property (nonatomic, weak) iddelegate; 24 | 25 | - (instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars; 26 | 27 | @end -------------------------------------------------------------------------------- /CWStarRatingViewDemo/CWStarRateView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CWStarRateView.m 3 | // StarRateDemo 4 | // 5 | // Created by WANGCHAO on 14/11/4. 6 | // Copyright (c) 2014年 wangchao. All rights reserved. 7 | // 8 | 9 | #import "CWStarRateView.h" 10 | 11 | #define FOREGROUND_STAR_IMAGE_NAME @"b27_icon_star_yellow" 12 | #define BACKGROUND_STAR_IMAGE_NAME @"b27_icon_star_gray" 13 | #define DEFALUT_STAR_NUMBER 5 14 | #define ANIMATION_TIME_INTERVAL 0.2 15 | 16 | @interface CWStarRateView () 17 | 18 | @property (nonatomic, strong) UIView *foregroundStarView; 19 | @property (nonatomic, strong) UIView *backgroundStarView; 20 | 21 | @property (nonatomic, assign) NSInteger numberOfStars; 22 | 23 | @end 24 | 25 | @implementation CWStarRateView 26 | 27 | #pragma mark - Init Methods 28 | - (instancetype)init { 29 | NSAssert(NO, @"You should never call this method in this class. Use initWithFrame: instead!"); 30 | return nil; 31 | } 32 | 33 | - (instancetype)initWithFrame:(CGRect)frame { 34 | return [self initWithFrame:frame numberOfStars:DEFALUT_STAR_NUMBER]; 35 | } 36 | 37 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 38 | if (self = [super initWithCoder:aDecoder]) { 39 | _numberOfStars = DEFALUT_STAR_NUMBER; 40 | [self buildDataAndUI]; 41 | } 42 | return self; 43 | } 44 | 45 | - (instancetype)initWithFrame:(CGRect)frame numberOfStars:(NSInteger)numberOfStars { 46 | if (self = [super initWithFrame:frame]) { 47 | _numberOfStars = numberOfStars; 48 | [self buildDataAndUI]; 49 | } 50 | return self; 51 | } 52 | 53 | #pragma mark - Private Methods 54 | 55 | - (void)buildDataAndUI { 56 | _scorePercent = 1;//默认为1 57 | _hasAnimation = NO;//默认为NO 58 | _allowIncompleteStar = NO;//默认为NO 59 | 60 | self.foregroundStarView = [self createStarViewWithImage:FOREGROUND_STAR_IMAGE_NAME]; 61 | self.backgroundStarView = [self createStarViewWithImage:BACKGROUND_STAR_IMAGE_NAME]; 62 | 63 | [self addSubview:self.backgroundStarView]; 64 | [self addSubview:self.foregroundStarView]; 65 | 66 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(userTapRateView:)]; 67 | tapGesture.numberOfTapsRequired = 1; 68 | [self addGestureRecognizer:tapGesture]; 69 | } 70 | 71 | - (void)userTapRateView:(UITapGestureRecognizer *)gesture { 72 | CGPoint tapPoint = [gesture locationInView:self]; 73 | CGFloat offset = tapPoint.x; 74 | CGFloat realStarScore = offset / (self.bounds.size.width / self.numberOfStars); 75 | CGFloat starScore = self.allowIncompleteStar ? realStarScore : ceilf(realStarScore); 76 | self.scorePercent = starScore / self.numberOfStars; 77 | } 78 | 79 | - (UIView *)createStarViewWithImage:(NSString *)imageName { 80 | UIView *view = [[UIView alloc] initWithFrame:self.bounds]; 81 | view.clipsToBounds = YES; 82 | view.backgroundColor = [UIColor clearColor]; 83 | for (NSInteger i = 0; i < self.numberOfStars; i ++) 84 | { 85 | UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; 86 | imageView.frame = CGRectMake(i * self.bounds.size.width / self.numberOfStars, 0, self.bounds.size.width / self.numberOfStars, self.bounds.size.height); 87 | imageView.contentMode = UIViewContentModeScaleAspectFit; 88 | [view addSubview:imageView]; 89 | } 90 | return view; 91 | } 92 | 93 | - (void)layoutSubviews { 94 | [super layoutSubviews]; 95 | __weak CWStarRateView *weakSelf = self; 96 | CGFloat animationTimeInterval = self.hasAnimation ? ANIMATION_TIME_INTERVAL : 0; 97 | [UIView animateWithDuration:animationTimeInterval animations:^{ 98 | weakSelf.foregroundStarView.frame = CGRectMake(0, 0, weakSelf.bounds.size.width * weakSelf.scorePercent, weakSelf.bounds.size.height); 99 | }]; 100 | } 101 | 102 | #pragma mark - Get and Set Methods 103 | 104 | - (void)setScorePercent:(CGFloat)scroePercent { 105 | if (_scorePercent == scroePercent) { 106 | return; 107 | } 108 | 109 | if (scroePercent < 0) { 110 | _scorePercent = 0; 111 | } else if (scroePercent > 1) { 112 | _scorePercent = 1; 113 | } else { 114 | _scorePercent = scroePercent; 115 | } 116 | 117 | if ([self.delegate respondsToSelector:@selector(starRateView:scroePercentDidChange:)]) { 118 | [self.delegate starRateView:self scroePercentDidChange:scroePercent]; 119 | } 120 | 121 | [self setNeedsLayout]; 122 | } 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/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 | } -------------------------------------------------------------------------------- /CWStarRatingViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | tagged.$(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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CWStarRatingViewDemo 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CWStarRatingViewDemo 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "ViewController.h" 12 | #import "CWStarRateView.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (strong, nonatomic) CWStarRateView *starRateView; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.starRateView = [[CWStarRateView alloc] initWithFrame:CGRectMake(10, 100, 300, 40) numberOfStars:5]; 25 | self.starRateView.scorePercent = 0.3; 26 | self.starRateView.allowIncompleteStar = YES; 27 | self.starRateView.hasAnimation = YES; 28 | [self.view addSubview:self.starRateView]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CWStarRatingViewDemo/b27_icon_star_gray@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangChaooooo/StarRatingView/f152fd28e9013c010f2eed3c61a76f9e8a333427/CWStarRatingViewDemo/b27_icon_star_gray@2x.png -------------------------------------------------------------------------------- /CWStarRatingViewDemo/b27_icon_star_yellow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangChaooooo/StarRatingView/f152fd28e9013c010f2eed3c61a76f9e8a333427/CWStarRatingViewDemo/b27_icon_star_yellow@2x.png -------------------------------------------------------------------------------- /CWStarRatingViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CWStarRatingViewDemo 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. 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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemoTests/CWStarRatingViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CWStarRatingViewDemoTests.m 3 | // CWStarRatingViewDemoTests 4 | // 5 | // Created by WANGCHAO on 14/11/8. 6 | // Copyright (c) 2014年 wangchao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface CWStarRatingViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation CWStarRatingViewDemoTests 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 | -------------------------------------------------------------------------------- /CWStarRatingViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | tagged.$(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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | StarRatingView 2 | ============== 3 | 4 | 星级评分,支持显示部分星星,支持动画 5 | ![image](https://github.com/wangchaoIOS/StarRatingView/blob/master/Screen%20Shot.png) 6 | -------------------------------------------------------------------------------- /Screen Shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WangChaooooo/StarRatingView/f152fd28e9013c010f2eed3c61a76f9e8a333427/Screen Shot.png --------------------------------------------------------------------------------