├── Example
├── Resources
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── Images.xcassets
│ │ ├── AppIcon-2.appiconset
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── LaunchImage-2.launchimage
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── DJWStarRatingView-Info.plist
│ └── Base.lproj
│ │ └── Main.storyboard
├── Classes
│ ├── DJWAppDelegate.h
│ ├── DJWViewController.h
│ ├── DJWViewController.m
│ └── DJWAppDelegate.m
└── Other Sources
│ ├── DJWStarRatingView-Prefix.pch
│ └── main.m
├── DJWStarRatingViewTests
├── en.lproj
│ └── InfoPlist.strings
├── DJWStarRatingViewTests-Info.plist
└── DJWStarRatingViewTests.m
├── Screenshots
└── DJWStarRatingView.gif
├── DJWStarRatingView.xcodeproj
├── xcuserdata
│ ├── dan.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── DJWStarRatingView.xcscheme
│ └── danielwilliams.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── DJWStarRatingView.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── DJWStarRatingView.xccheckout
└── project.pbxproj
├── .GITIGNORE
├── LICENSE.md
├── README.md
├── DJWStarRatingView.podspec
└── DJWStarRatingView
├── DJWStarRatingView.h
└── DJWStarRatingView.m
/Example/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/DJWStarRatingViewTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Screenshots/DJWStarRatingView.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danwilliams64/DJWStarRatingView/HEAD/Screenshots/DJWStarRatingView.gif
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/dan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/danielwilliams.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.GITIGNORE:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | .DS_STORE
4 | build/
5 | *.pbxuser
6 | !default.pbxuser
7 | *.mode1v3
8 | !default.mode1v3
9 | *.mode2v3
10 | !default.mode2v3
11 | *.perspectivev3
12 | !default.perspectivev3
13 | xcuserdata
14 | *.xccheckout
15 | *.moved-aside
16 | DerivedData
17 | *.hmap
18 | *.ipa
19 | *.xcuserstate
20 | Pods/
21 |
--------------------------------------------------------------------------------
/Example/Classes/DJWAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // DJWAppDelegate.h
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface DJWAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/Classes/DJWViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // DJWViewController.h
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "DJWStarRatingView.h"
12 |
13 | @interface DJWViewController : UIViewController
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/Other Sources/DJWStarRatingView-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/Example/Other Sources/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "DJWAppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([DJWAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Example/Resources/Images.xcassets/AppIcon-2.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "60x60"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "2x",
11 | "size" : "40x40"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/Example/Resources/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" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/Example/Resources/Images.xcassets/LaunchImage-2.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "minimum-system-version" : "7.0",
7 | "scale" : "2x"
8 | },
9 | {
10 | "orientation" : "portrait",
11 | "idiom" : "iphone",
12 | "minimum-system-version" : "7.0",
13 | "subtype" : "retina4",
14 | "scale" : "2x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/dan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | DJWStarRatingView.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 0E1B4D4D18F989C2006F23D4
16 |
17 | primary
18 |
19 |
20 | 0E1B4D6E18F989C2006F23D4
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/danielwilliams.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | DJWStarRatingView.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 0E1B4D4D18F989C2006F23D4
16 |
17 | primary
18 |
19 |
20 | 0E1B4D6E18F989C2006F23D4
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/DJWStarRatingViewTests/DJWStarRatingViewTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | co.danwilliams.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/DJWStarRatingViewTests/DJWStarRatingViewTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // DJWStarRatingViewTests.m
3 | // DJWStarRatingViewTests
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface DJWStarRatingViewTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation DJWStarRatingViewTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Dan Williams
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DJWStarRatingView
2 |
3 | A view that represents a given rating using stars. Uses custom drawing to allow their appearance at any size. The view also allows for editing, using either tapping, panning, or both.
4 |
5 | ## Demo
6 |
7 | 
8 |
9 | ## Usage
10 |
11 | Create a new instance of DJWStarRatingView, utilising the designated initialiser:
12 |
13 | ```objective-c
14 | - (instancetype)initWithStarSize:(CGSize)starSize
15 | numberOfStars:(NSInteger)numberOfStars
16 | rating:(float)rating
17 | fillColor:(UIColor *)fillColor
18 | unfilledColor:(UIColor *)unfilledColor
19 | strokeColor:(UIColor *)strokeColor;
20 | ```
21 |
22 | ```rating``` value's decimal part can either be ```.0``` or ```.5```.
23 |
24 |
25 |
26 | ## Installation
27 |
28 | Simply add `DJWStarRatingView` to your Podfile if you're using CocoaPods. Alternatively, add `DJWStarRatingView.h` and `DJWStarRatingView.m` to your project. Included in this repository is a demo application, showing the project in action.
29 |
30 | ## License
31 |
32 | DJWStarRatingView is licensed under the [MIT license](https://raw.githubusercontent.com/danwilliams64/DJWStarRatingView/master/LICENSE.md).
33 |
--------------------------------------------------------------------------------
/DJWStarRatingView.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = "DJWStarRatingView"
4 | s.version = "0.0.4"
5 | s.summary = "A view that represents a given rating using stars. Uses custom drawing to allow their appearance at any size."
6 |
7 | s.description = <<-DESC
8 | A view that represents a given rating using stars. Uses custom drawing to allow their appearance at any size.
9 | The view also allows for editing, using either tapping, panning, or both.
10 | Properties that are configurable include star size, fill color, unfilled color, stroke, padding and stroke width.
11 | DESC
12 |
13 | s.homepage = "https://github.com/danwilliams64/DJWStarRatingView"
14 | s.screenshots = "https://raw.githubusercontent.com/danwilliams64/DJWStarRatingView/master/Screenshots/DJWStarRatingView.gif"
15 |
16 | s.license = "MIT (example)"
17 | s.license = { :type => "MIT", :file => "LICENSE.md" }
18 |
19 | s.author = { "Dan Williams" => "dan@danwilliams.co" }
20 | s.social_media_url = "http://twitter.com/danielwilliams"
21 |
22 | s.platform = :ios
23 | s.platform = :ios, "7.0"
24 |
25 | s.source = { :git => "https://github.com/danwilliams64/DJWStarRatingView.git", :tag => "#{s.version}" }
26 |
27 | s.source_files = "DJWStarRatingView"
28 |
29 | s.public_header_files = "DJWStarRatingView/*.h"
30 |
31 | s.requires_arc = true
32 |
33 | end
34 |
--------------------------------------------------------------------------------
/Example/Resources/DJWStarRatingView-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundleIcons~ipad
14 |
15 | CFBundleIdentifier
16 | co.danwilliams.${PRODUCT_NAME:rfc1034identifier}
17 | CFBundleInfoDictionaryVersion
18 | 6.0
19 | CFBundleName
20 | ${PRODUCT_NAME}
21 | CFBundlePackageType
22 | APPL
23 | CFBundleShortVersionString
24 | 0.0.1
25 | CFBundleSignature
26 | ????
27 | CFBundleVersion
28 | 1.0
29 | LSRequiresIPhoneOS
30 |
31 | UIMainStoryboardFile
32 | Main
33 | UIRequiredDeviceCapabilities
34 |
35 | armv7
36 |
37 | UIStatusBarStyle
38 | UIStatusBarStyleDefault
39 | UISupportedInterfaceOrientations
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/project.xcworkspace/xcshareddata/DJWStarRatingView.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | B535C918-A421-440F-9ADA-E4AE303D815E
9 | IDESourceControlProjectName
10 | DJWStarRatingView
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 09A37E81E2779F3D6604F6191D8167333DDE49BD
14 | https://github.com/danwilliams64/DJWStarRatingView.git
15 |
16 | IDESourceControlProjectPath
17 | DJWStarRatingView.xcodeproj/project.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 09A37E81E2779F3D6604F6191D8167333DDE49BD
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/danwilliams64/DJWStarRatingView.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 09A37E81E2779F3D6604F6191D8167333DDE49BD
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 09A37E81E2779F3D6604F6191D8167333DDE49BD
36 | IDESourceControlWCCName
37 | DJWStarRatingView
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Example/Classes/DJWViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DJWViewController.m
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import "DJWViewController.h"
10 |
11 | @interface DJWViewController ()
12 |
13 | @property (nonatomic, assign) UILabel *starRatingValue;
14 |
15 | @end
16 |
17 | @implementation DJWViewController
18 |
19 | - (void)viewDidLoad
20 | {
21 | [super viewDidLoad];
22 | self.view.backgroundColor = [UIColor blackColor];
23 |
24 | DJWStarRatingView *anotherStarRatingView = [[DJWStarRatingView alloc] initWithStarSize:CGSizeMake(40, 40) numberOfStars:5 rating:2.0 fillColor:[UIColor whiteColor] unfilledColor:[UIColor clearColor] strokeColor:[UIColor whiteColor]];
25 | [self.view addSubview:anotherStarRatingView];
26 | anotherStarRatingView.center = self.view.center;
27 | anotherStarRatingView.editable = YES;
28 | anotherStarRatingView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
29 | anotherStarRatingView.delegate = self;
30 |
31 | UILabel *starRatingValue = [[UILabel alloc] initWithFrame:CGRectMake(self.view.bounds.size.width / 2 - 100, self.view.bounds.size.height / 2 + 20, 200, 40) ];
32 | [self.view addSubview:starRatingValue];
33 | starRatingValue.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
34 | self.starRatingValue = starRatingValue;
35 | self.starRatingValue.textColor = [UIColor whiteColor];
36 | self.starRatingValue.textAlignment = NSTextAlignmentCenter;
37 | }
38 |
39 | - (void)djwStarRatingChangedValue:(DJWStarRatingView *)view
40 | {
41 | self.starRatingValue.text = [NSString stringWithFormat:@"Value updated to %.1f", view.rating];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Example/Classes/DJWAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // DJWAppDelegate.m
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import "DJWAppDelegate.h"
10 |
11 | @implementation DJWAppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | // Override point for customization after application launch.
16 | return YES;
17 | }
18 |
19 | - (void)applicationWillResignActive:(UIApplication *)application
20 | {
21 | // 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.
22 | // 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.
23 | }
24 |
25 | - (void)applicationDidEnterBackground:(UIApplication *)application
26 | {
27 | // 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.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | - (void)applicationWillEnterForeground:(UIApplication *)application
32 | {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | - (void)applicationDidBecomeActive:(UIApplication *)application
37 | {
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 | {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/DJWStarRatingView/DJWStarRatingView.h:
--------------------------------------------------------------------------------
1 | //
2 | // DJWStarRatingView.h
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | @import UIKit;
10 |
11 | @protocol DJWStarRatingViewDelegate;
12 |
13 | IB_DESIGNABLE
14 | @interface DJWStarRatingView : UIView
15 |
16 | /**
17 | * The individual size for each star.
18 | */
19 | @property (nonatomic, assign) IBInspectable CGSize starSize;
20 |
21 | /**
22 | * The total number of stars to show.
23 | */
24 | @property (nonatomic, assign) IBInspectable NSInteger numberOfStars;
25 |
26 | /**
27 | * The rating for the view to display. E.g. `3.0` or `4.5`. Fractional component must be either `0` or `5`.
28 | */
29 | @property (nonatomic, assign) IBInspectable float rating;
30 |
31 | /**
32 | * The fill color of the stars.
33 | */
34 | @property (nonatomic, strong) IBInspectable UIColor *fillColor;
35 |
36 | /**
37 | * The unfilled color of the stars.
38 | */
39 | @property (nonatomic, strong) IBInspectable UIColor *unfilledColor;
40 |
41 | /**
42 | * The color of the star's stroke.
43 | */
44 | @property (nonatomic, strong) IBInspectable UIColor *strokeColor;
45 |
46 | /**
47 | * The width of the stroke around the stars. Defaults to `1.0`.
48 | */
49 | @property (nonatomic, assign) IBInspectable CGFloat lineWidth;
50 |
51 | /**
52 | * The space between each star. Defaults to 5 percent of the width alocated to each star.
53 | */
54 | @property (nonatomic, assign) IBInspectable CGFloat padding;
55 |
56 | /**
57 | * If `YES` the user can change the rating by tapping on the view.
58 | */
59 | @property (nonatomic, assign) IBInspectable BOOL editable;
60 |
61 | /**
62 | * Allow the user to change the rating by tapping, if the view's editable property is `YES`. Defaults to `YES`.
63 | */
64 | @property (nonatomic, assign) IBInspectable BOOL allowsTapWhenEditable;
65 |
66 | /**
67 | * Allow the user to change the rating by swiping, if the view's editable property is `YES`. Defaults to `YES`.
68 | */
69 | @property (nonatomic, assign) IBInspectable BOOL allowsSwipeWhenEditable;
70 |
71 | /**
72 | * Allows ratings at half-integer boundaries aswell as integers. Defaults to `YES`.
73 | */
74 | @property (nonatomic, assign) IBInspectable BOOL allowsHalfIntegralRatings;
75 |
76 | /**
77 | * Delegate
78 | */
79 | @property (nonatomic, assign) IBOutlet id delegate;
80 |
81 | /**
82 | * An instance of DJWStarRatingView. The designated initializer for this class.
83 | *
84 | * @param starSize size of individual star
85 | * @param numberOfStars total number of stars for the view to display
86 | * @param rating rating to display
87 | * @param fillColor color to fill the stars
88 | * @param strokeColor color to stroke the outline of the stars
89 | *
90 | * @return DJWStarRatingView instance.
91 | */
92 | - (instancetype)initWithStarSize:(CGSize)starSize
93 | numberOfStars:(NSInteger)numberOfStars
94 | rating:(float)rating
95 | fillColor:(UIColor *)fillColor
96 | unfilledColor:(UIColor *)unfilledColor
97 | strokeColor:(UIColor *)strokeColor;
98 |
99 | @end
100 |
101 | @protocol DJWStarRatingViewDelegate
102 |
103 | - (void)djwStarRatingChangedValue:(DJWStarRatingView *)view;
104 |
105 | @end
106 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/dan.xcuserdatad/xcschemes/DJWStarRatingView.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/xcuserdata/danielwilliams.xcuserdatad/xcschemes/DJWStarRatingView.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Example/Resources/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 |
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 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/DJWStarRatingView/DJWStarRatingView.m:
--------------------------------------------------------------------------------
1 | //
2 | // DJWStarRatingView.m
3 | // DJWStarRatingView
4 | //
5 | // Created by Daniel Williams on 12/04/2014.
6 | // Copyright (c) 2014 Daniel Williams. All rights reserved.
7 | //
8 |
9 | #import "DJWStarRatingView.h"
10 |
11 | @interface DJWStarRatingView()
12 |
13 | @end
14 |
15 | @implementation DJWStarRatingView
16 |
17 | @synthesize padding = _padding;
18 | @synthesize lineWidth = _lineWidth;
19 |
20 | - (instancetype)initWithStarSize:(CGSize)starSize
21 | numberOfStars:(NSInteger)numberOfStars
22 | rating:(float)rating
23 | fillColor:(UIColor *)fillColor
24 | unfilledColor:(UIColor *)unfilledColor
25 | strokeColor:(UIColor *)strokeColor
26 | {
27 | if (self = [super initWithFrame:CGRectZero]) {
28 | _starSize = starSize;
29 | _numberOfStars = numberOfStars;
30 | _rating = rating;
31 | _fillColor = fillColor;
32 | _unfilledColor = unfilledColor;
33 | _strokeColor = strokeColor;
34 |
35 | _allowsSwipeWhenEditable = YES;
36 | _allowsTapWhenEditable = YES;
37 | _allowsHalfIntegralRatings = YES;
38 |
39 | self.backgroundColor = [UIColor clearColor];
40 | self.frame = CGRectMake(0, 0, self.intrinsicContentSize.width, self.intrinsicContentSize.height);
41 | [self setNeedsDisplay];
42 |
43 | [self initializeGestureRecognizers];
44 | }
45 | return self;
46 | }
47 |
48 | - (instancetype)initWithCoder:(NSCoder *)aDecoder
49 | {
50 | self = [super initWithCoder:aDecoder];
51 | if (self) {
52 | [self initializeGestureRecognizers];
53 | }
54 | return self;
55 | }
56 |
57 | - (void)initializeGestureRecognizers
58 | {
59 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processGestureRecogniser:)];
60 | [self addGestureRecognizer:tapGesture];
61 | UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(processGestureRecogniser:)];
62 | [self addGestureRecognizer:panGesture];
63 | }
64 |
65 | #pragma mark - Target / Action
66 |
67 | - (void)processGestureRecogniser:(UIGestureRecognizer *)gesture
68 | {
69 | if (!self.editable) return;
70 |
71 | if ([gesture isKindOfClass:[UITapGestureRecognizer class]] && !self.allowsTapWhenEditable) return;
72 | if ([gesture isKindOfClass:[UIPanGestureRecognizer class]] && !self.allowsSwipeWhenEditable) return;
73 |
74 | CGPoint point = [gesture locationInView:self];
75 | self.rating = [self ratingAtPoint:point];
76 | }
77 |
78 | - (float)ratingAtPoint:(CGPoint)point
79 | {
80 | CGFloat x = point.x;
81 | CGFloat starWidthWithPadding = _starSize.width + self.padding;
82 |
83 | CGFloat rating = (x / starWidthWithPadding) + 1;
84 | CGFloat fractional = fmodf(rating, 1);
85 | fractional = roundf(fractional * 2.0) / 2.0;
86 |
87 | if (!self.allowsHalfIntegralRatings) fractional = 0.5;
88 |
89 | rating = (int)rating;
90 | rating = rating + fractional - 0.5;
91 | rating = MAX(1, MIN(rating, self.numberOfStars));
92 | return rating;
93 | }
94 |
95 | #pragma mark - Drawing
96 |
97 | - (void)drawRect:(CGRect)rect
98 | {
99 | CGPoint drawPoint = CGPointMake([self padding], 0);
100 |
101 | // Draw Stars
102 | for (int i = 0; i < self.numberOfStars; i++) {
103 | CGRect starRect = CGRectMake(drawPoint.x, drawPoint.y, self.starSize.width, self.starSize.height);
104 | [self drawStarAtPoint:drawPoint inFrame:starRect forStarNumber:i];
105 | drawPoint.x = drawPoint.x + (self.starSize.width + [self padding]);
106 | }
107 | }
108 |
109 | - (void)drawStarAtPoint:(CGPoint)point inFrame:(CGRect)frame forStarNumber:(NSInteger)starNumber
110 | {
111 | CGContextRef context = UIGraphicsGetCurrentContext();
112 |
113 | // Star Drawing
114 | UIBezierPath* starPath = [UIBezierPath bezierPath];
115 | [starPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.50000 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.00000 * CGRectGetHeight(frame))];
116 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.60940 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.34942 * CGRectGetHeight(frame))];
117 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.97553 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.34549 * CGRectGetHeight(frame))];
118 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.67702 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.55752 * CGRectGetHeight(frame))];
119 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.79389 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.90451 * CGRectGetHeight(frame))];
120 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.50000 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.68613 * CGRectGetHeight(frame))];
121 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.20611 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.90451 * CGRectGetHeight(frame))];
122 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.32298 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.55752 * CGRectGetHeight(frame))];
123 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.02447 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.34549 * CGRectGetHeight(frame))];
124 | [starPath addLineToPoint: CGPointMake(CGRectGetMinX(frame) + 0.39060 * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.34942 * CGRectGetHeight(frame))];
125 | [starPath closePath];
126 | CGContextSaveGState(context);
127 | [starPath addClip];
128 |
129 | [self gradientFillForStar:CGPathGetBoundingBox(starPath.CGPath) forStarNumber:starNumber];
130 | CGContextRestoreGState(context);
131 |
132 | [self.strokeColor setStroke];
133 | starPath.lineWidth = self.lineWidth;
134 | [starPath stroke];
135 | }
136 |
137 | - (void)gradientFillForStar:(CGRect)starBounds forStarNumber:(NSInteger)starNumber
138 | {
139 | CGFloat fillPercentage = [self fillPercentageForStarNumber:starNumber];
140 |
141 | UIColor *startColor = self.fillColor;
142 | UIColor *endColor = self.unfilledColor;
143 |
144 | CGContextRef context = UIGraphicsGetCurrentContext();
145 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
146 | NSArray* gradientColors = [NSArray arrayWithObjects:
147 | (id)startColor.CGColor,
148 | (id)endColor.CGColor,
149 | (id)endColor.CGColor, nil];
150 | CGFloat gradientLocations[] = {fillPercentage, fillPercentage, fillPercentage};
151 | CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)gradientColors, gradientLocations);
152 |
153 | CGContextDrawLinearGradient(context, gradient,
154 | CGPointMake(CGRectGetMinX(starBounds), CGRectGetMidY(starBounds)),
155 | CGPointMake(CGRectGetMaxX(starBounds), CGRectGetMidY(starBounds)),
156 | 0);
157 |
158 | CGGradientRelease(gradient);
159 | CGColorSpaceRelease(colorSpace);
160 | }
161 |
162 | - (CGFloat)fillPercentageForStarNumber:(NSInteger)starNumber
163 | {
164 | float star = (float)starNumber + 1;
165 | if (star <= self.rating) {
166 | return 1.0;
167 | } else if ((float)(star - 0.5) <= self.rating) {
168 | return 0.5;
169 | } else {
170 | return 0;
171 | }
172 | }
173 |
174 | - (CGSize)intrinsicContentSize
175 | {
176 | CGSize starSize = self.starSize;
177 | starSize = CGSizeMake(starSize.width + 1, starSize.width + 1);
178 |
179 | CGFloat width = (starSize.width * self.numberOfStars) + ([self padding] * self.numberOfStars);
180 |
181 | return CGSizeMake(width, starSize.height);
182 | }
183 |
184 | #pragma mark - Getters
185 |
186 | - (CGFloat)lineWidth
187 | {
188 | if (!_lineWidth) {
189 | _lineWidth = 1.0;
190 | }
191 | return _lineWidth;
192 | }
193 |
194 | - (CGFloat)padding
195 | {
196 | if (!_padding) {
197 | _padding = self.starSize.width / 5.0;
198 | }
199 | return _padding;
200 | }
201 |
202 | #pragma mark - Setters
203 |
204 | - (void)setStarSize:(CGSize)starSize
205 | {
206 | _starSize = starSize;
207 | [self setNeedsDisplay];
208 | [self invalidateIntrinsicContentSize];
209 | }
210 |
211 | - (void)setNumberOfStars:(NSInteger)numberOfStars
212 | {
213 | _numberOfStars = numberOfStars;
214 | [self setNeedsDisplay];
215 | [self invalidateIntrinsicContentSize];
216 | }
217 |
218 | - (void)setRating:(float)rating
219 | {
220 | _rating = rating;
221 | [self setNeedsDisplay];
222 |
223 | if (self.delegate != nil && [self.delegate respondsToSelector:@selector(djwStarRatingChangedValue:) ] )
224 | {
225 | [self.delegate djwStarRatingChangedValue:self];
226 | }
227 | }
228 |
229 | - (void)setFillColor:(UIColor *)fillColor
230 | {
231 | _fillColor = fillColor;
232 | [self setNeedsDisplay];
233 | }
234 |
235 | - (void)setStrokeColor:(UIColor *)strokeColor
236 | {
237 | _strokeColor = strokeColor;
238 | [self setNeedsDisplay];
239 | }
240 |
241 | - (void)setLineWidth:(CGFloat)lineWidth
242 | {
243 | _lineWidth = lineWidth;
244 | [self setNeedsDisplay];
245 | }
246 |
247 | - (void)setPadding:(CGFloat)padding
248 | {
249 | _padding = padding;
250 | [self setNeedsDisplay];
251 | [self invalidateIntrinsicContentSize];
252 | }
253 |
254 | @end
255 |
--------------------------------------------------------------------------------
/DJWStarRatingView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0E1B4D5218F989C2006F23D4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D5118F989C2006F23D4 /* Foundation.framework */; };
11 | 0E1B4D5418F989C2006F23D4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D5318F989C2006F23D4 /* CoreGraphics.framework */; };
12 | 0E1B4D5618F989C2006F23D4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D5518F989C2006F23D4 /* UIKit.framework */; };
13 | 0E1B4D7118F989C2006F23D4 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D7018F989C2006F23D4 /* XCTest.framework */; };
14 | 0E1B4D7218F989C2006F23D4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D5118F989C2006F23D4 /* Foundation.framework */; };
15 | 0E1B4D7318F989C2006F23D4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E1B4D5518F989C2006F23D4 /* UIKit.framework */; };
16 | 0E1B4D7B18F989C2006F23D4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0E1B4D7918F989C2006F23D4 /* InfoPlist.strings */; };
17 | 0E1B4D7D18F989C2006F23D4 /* DJWStarRatingViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E1B4D7C18F989C2006F23D4 /* DJWStarRatingViewTests.m */; };
18 | 0E1B4D8818F989E8006F23D4 /* DJWStarRatingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E1B4D8718F989E8006F23D4 /* DJWStarRatingView.m */; };
19 | 37CD7691193522A4002F9BBF /* DJWAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37CD7688193522A4002F9BBF /* DJWAppDelegate.m */; };
20 | 37CD7692193522A4002F9BBF /* DJWViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 37CD768A193522A4002F9BBF /* DJWViewController.m */; };
21 | 37CD7693193522A4002F9BBF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 37CD768D193522A4002F9BBF /* main.m */; };
22 | 37CD7695193522A4002F9BBF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37CD7690193522A4002F9BBF /* Images.xcassets */; };
23 | 37CD769819352376002F9BBF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 37CD769619352376002F9BBF /* Main.storyboard */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXContainerItemProxy section */
27 | 0E1B4D7418F989C2006F23D4 /* PBXContainerItemProxy */ = {
28 | isa = PBXContainerItemProxy;
29 | containerPortal = 0E1B4D4618F989C2006F23D4 /* Project object */;
30 | proxyType = 1;
31 | remoteGlobalIDString = 0E1B4D4D18F989C2006F23D4;
32 | remoteInfo = DJWStarRatingView;
33 | };
34 | /* End PBXContainerItemProxy section */
35 |
36 | /* Begin PBXFileReference section */
37 | 0E1B4D4E18F989C2006F23D4 /* DJWStarRatingView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DJWStarRatingView.app; sourceTree = BUILT_PRODUCTS_DIR; };
38 | 0E1B4D5118F989C2006F23D4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
39 | 0E1B4D5318F989C2006F23D4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
40 | 0E1B4D5518F989C2006F23D4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
41 | 0E1B4D6F18F989C2006F23D4 /* DJWStarRatingViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DJWStarRatingViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 0E1B4D7018F989C2006F23D4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
43 | 0E1B4D7818F989C2006F23D4 /* DJWStarRatingViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DJWStarRatingViewTests-Info.plist"; sourceTree = ""; };
44 | 0E1B4D7A18F989C2006F23D4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
45 | 0E1B4D7C18F989C2006F23D4 /* DJWStarRatingViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DJWStarRatingViewTests.m; sourceTree = ""; };
46 | 0E1B4D8618F989E8006F23D4 /* DJWStarRatingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJWStarRatingView.h; sourceTree = ""; };
47 | 0E1B4D8718F989E8006F23D4 /* DJWStarRatingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJWStarRatingView.m; sourceTree = ""; };
48 | 37CD7687193522A4002F9BBF /* DJWAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJWAppDelegate.h; sourceTree = ""; };
49 | 37CD7688193522A4002F9BBF /* DJWAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJWAppDelegate.m; sourceTree = ""; };
50 | 37CD7689193522A4002F9BBF /* DJWViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJWViewController.h; sourceTree = ""; };
51 | 37CD768A193522A4002F9BBF /* DJWViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DJWViewController.m; sourceTree = ""; };
52 | 37CD768C193522A4002F9BBF /* DJWStarRatingView-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DJWStarRatingView-Prefix.pch"; sourceTree = ""; };
53 | 37CD768D193522A4002F9BBF /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
54 | 37CD768F193522A4002F9BBF /* DJWStarRatingView-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DJWStarRatingView-Info.plist"; sourceTree = ""; };
55 | 37CD7690193522A4002F9BBF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
56 | 37CD769719352376002F9BBF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | 0E1B4D4B18F989C2006F23D4 /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | 0E1B4D5418F989C2006F23D4 /* CoreGraphics.framework in Frameworks */,
65 | 0E1B4D5618F989C2006F23D4 /* UIKit.framework in Frameworks */,
66 | 0E1B4D5218F989C2006F23D4 /* Foundation.framework in Frameworks */,
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | 0E1B4D6C18F989C2006F23D4 /* Frameworks */ = {
71 | isa = PBXFrameworksBuildPhase;
72 | buildActionMask = 2147483647;
73 | files = (
74 | 0E1B4D7118F989C2006F23D4 /* XCTest.framework in Frameworks */,
75 | 0E1B4D7318F989C2006F23D4 /* UIKit.framework in Frameworks */,
76 | 0E1B4D7218F989C2006F23D4 /* Foundation.framework in Frameworks */,
77 | );
78 | runOnlyForDeploymentPostprocessing = 0;
79 | };
80 | /* End PBXFrameworksBuildPhase section */
81 |
82 | /* Begin PBXGroup section */
83 | 0E1B4D4518F989C2006F23D4 = {
84 | isa = PBXGroup;
85 | children = (
86 | 37CD768519352297002F9BBF /* Example */,
87 | 0E1B4D5718F989C2006F23D4 /* DJWStarRatingView */,
88 | 0E1B4D7618F989C2006F23D4 /* DJWStarRatingViewTests */,
89 | 0E1B4D5018F989C2006F23D4 /* Frameworks */,
90 | 0E1B4D4F18F989C2006F23D4 /* Products */,
91 | );
92 | sourceTree = "";
93 | };
94 | 0E1B4D4F18F989C2006F23D4 /* Products */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 0E1B4D4E18F989C2006F23D4 /* DJWStarRatingView.app */,
98 | 0E1B4D6F18F989C2006F23D4 /* DJWStarRatingViewTests.xctest */,
99 | );
100 | name = Products;
101 | sourceTree = "";
102 | };
103 | 0E1B4D5018F989C2006F23D4 /* Frameworks */ = {
104 | isa = PBXGroup;
105 | children = (
106 | 0E1B4D5118F989C2006F23D4 /* Foundation.framework */,
107 | 0E1B4D5318F989C2006F23D4 /* CoreGraphics.framework */,
108 | 0E1B4D5518F989C2006F23D4 /* UIKit.framework */,
109 | 0E1B4D7018F989C2006F23D4 /* XCTest.framework */,
110 | );
111 | name = Frameworks;
112 | sourceTree = "";
113 | };
114 | 0E1B4D5718F989C2006F23D4 /* DJWStarRatingView */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 0E1B4D8618F989E8006F23D4 /* DJWStarRatingView.h */,
118 | 0E1B4D8718F989E8006F23D4 /* DJWStarRatingView.m */,
119 | );
120 | path = DJWStarRatingView;
121 | sourceTree = "";
122 | };
123 | 0E1B4D7618F989C2006F23D4 /* DJWStarRatingViewTests */ = {
124 | isa = PBXGroup;
125 | children = (
126 | 0E1B4D7C18F989C2006F23D4 /* DJWStarRatingViewTests.m */,
127 | 0E1B4D7718F989C2006F23D4 /* Supporting Files */,
128 | );
129 | path = DJWStarRatingViewTests;
130 | sourceTree = "";
131 | };
132 | 0E1B4D7718F989C2006F23D4 /* Supporting Files */ = {
133 | isa = PBXGroup;
134 | children = (
135 | 0E1B4D7818F989C2006F23D4 /* DJWStarRatingViewTests-Info.plist */,
136 | 0E1B4D7918F989C2006F23D4 /* InfoPlist.strings */,
137 | );
138 | name = "Supporting Files";
139 | sourceTree = "";
140 | };
141 | 37CD768519352297002F9BBF /* Example */ = {
142 | isa = PBXGroup;
143 | children = (
144 | 37CD7686193522A4002F9BBF /* Classes */,
145 | 37CD768B193522A4002F9BBF /* Other Sources */,
146 | 37CD768E193522A4002F9BBF /* Resources */,
147 | );
148 | name = Example;
149 | sourceTree = "";
150 | };
151 | 37CD7686193522A4002F9BBF /* Classes */ = {
152 | isa = PBXGroup;
153 | children = (
154 | 37CD7687193522A4002F9BBF /* DJWAppDelegate.h */,
155 | 37CD7688193522A4002F9BBF /* DJWAppDelegate.m */,
156 | 37CD7689193522A4002F9BBF /* DJWViewController.h */,
157 | 37CD768A193522A4002F9BBF /* DJWViewController.m */,
158 | );
159 | name = Classes;
160 | path = Example/Classes;
161 | sourceTree = "";
162 | };
163 | 37CD768B193522A4002F9BBF /* Other Sources */ = {
164 | isa = PBXGroup;
165 | children = (
166 | 37CD768C193522A4002F9BBF /* DJWStarRatingView-Prefix.pch */,
167 | 37CD768D193522A4002F9BBF /* main.m */,
168 | );
169 | name = "Other Sources";
170 | path = "Example/Other Sources";
171 | sourceTree = "";
172 | };
173 | 37CD768E193522A4002F9BBF /* Resources */ = {
174 | isa = PBXGroup;
175 | children = (
176 | 37CD768F193522A4002F9BBF /* DJWStarRatingView-Info.plist */,
177 | 37CD769619352376002F9BBF /* Main.storyboard */,
178 | 37CD7690193522A4002F9BBF /* Images.xcassets */,
179 | );
180 | name = Resources;
181 | path = Example/Resources;
182 | sourceTree = "";
183 | };
184 | /* End PBXGroup section */
185 |
186 | /* Begin PBXNativeTarget section */
187 | 0E1B4D4D18F989C2006F23D4 /* DJWStarRatingView */ = {
188 | isa = PBXNativeTarget;
189 | buildConfigurationList = 0E1B4D8018F989C2006F23D4 /* Build configuration list for PBXNativeTarget "DJWStarRatingView" */;
190 | buildPhases = (
191 | 0E1B4D4A18F989C2006F23D4 /* Sources */,
192 | 0E1B4D4B18F989C2006F23D4 /* Frameworks */,
193 | 0E1B4D4C18F989C2006F23D4 /* Resources */,
194 | );
195 | buildRules = (
196 | );
197 | dependencies = (
198 | );
199 | name = DJWStarRatingView;
200 | productName = DJWStarRatingView;
201 | productReference = 0E1B4D4E18F989C2006F23D4 /* DJWStarRatingView.app */;
202 | productType = "com.apple.product-type.application";
203 | };
204 | 0E1B4D6E18F989C2006F23D4 /* DJWStarRatingViewTests */ = {
205 | isa = PBXNativeTarget;
206 | buildConfigurationList = 0E1B4D8318F989C2006F23D4 /* Build configuration list for PBXNativeTarget "DJWStarRatingViewTests" */;
207 | buildPhases = (
208 | 0E1B4D6B18F989C2006F23D4 /* Sources */,
209 | 0E1B4D6C18F989C2006F23D4 /* Frameworks */,
210 | 0E1B4D6D18F989C2006F23D4 /* Resources */,
211 | );
212 | buildRules = (
213 | );
214 | dependencies = (
215 | 0E1B4D7518F989C2006F23D4 /* PBXTargetDependency */,
216 | );
217 | name = DJWStarRatingViewTests;
218 | productName = DJWStarRatingViewTests;
219 | productReference = 0E1B4D6F18F989C2006F23D4 /* DJWStarRatingViewTests.xctest */;
220 | productType = "com.apple.product-type.bundle.unit-test";
221 | };
222 | /* End PBXNativeTarget section */
223 |
224 | /* Begin PBXProject section */
225 | 0E1B4D4618F989C2006F23D4 /* Project object */ = {
226 | isa = PBXProject;
227 | attributes = {
228 | CLASSPREFIX = DJW;
229 | LastUpgradeCheck = 0510;
230 | ORGANIZATIONNAME = "Daniel Williams";
231 | TargetAttributes = {
232 | 0E1B4D6E18F989C2006F23D4 = {
233 | TestTargetID = 0E1B4D4D18F989C2006F23D4;
234 | };
235 | };
236 | };
237 | buildConfigurationList = 0E1B4D4918F989C2006F23D4 /* Build configuration list for PBXProject "DJWStarRatingView" */;
238 | compatibilityVersion = "Xcode 3.2";
239 | developmentRegion = English;
240 | hasScannedForEncodings = 0;
241 | knownRegions = (
242 | en,
243 | Base,
244 | );
245 | mainGroup = 0E1B4D4518F989C2006F23D4;
246 | productRefGroup = 0E1B4D4F18F989C2006F23D4 /* Products */;
247 | projectDirPath = "";
248 | projectRoot = "";
249 | targets = (
250 | 0E1B4D4D18F989C2006F23D4 /* DJWStarRatingView */,
251 | 0E1B4D6E18F989C2006F23D4 /* DJWStarRatingViewTests */,
252 | );
253 | };
254 | /* End PBXProject section */
255 |
256 | /* Begin PBXResourcesBuildPhase section */
257 | 0E1B4D4C18F989C2006F23D4 /* Resources */ = {
258 | isa = PBXResourcesBuildPhase;
259 | buildActionMask = 2147483647;
260 | files = (
261 | 37CD769819352376002F9BBF /* Main.storyboard in Resources */,
262 | 37CD7695193522A4002F9BBF /* Images.xcassets in Resources */,
263 | );
264 | runOnlyForDeploymentPostprocessing = 0;
265 | };
266 | 0E1B4D6D18F989C2006F23D4 /* Resources */ = {
267 | isa = PBXResourcesBuildPhase;
268 | buildActionMask = 2147483647;
269 | files = (
270 | 0E1B4D7B18F989C2006F23D4 /* InfoPlist.strings in Resources */,
271 | );
272 | runOnlyForDeploymentPostprocessing = 0;
273 | };
274 | /* End PBXResourcesBuildPhase section */
275 |
276 | /* Begin PBXSourcesBuildPhase section */
277 | 0E1B4D4A18F989C2006F23D4 /* Sources */ = {
278 | isa = PBXSourcesBuildPhase;
279 | buildActionMask = 2147483647;
280 | files = (
281 | 37CD7692193522A4002F9BBF /* DJWViewController.m in Sources */,
282 | 37CD7691193522A4002F9BBF /* DJWAppDelegate.m in Sources */,
283 | 37CD7693193522A4002F9BBF /* main.m in Sources */,
284 | 0E1B4D8818F989E8006F23D4 /* DJWStarRatingView.m in Sources */,
285 | );
286 | runOnlyForDeploymentPostprocessing = 0;
287 | };
288 | 0E1B4D6B18F989C2006F23D4 /* Sources */ = {
289 | isa = PBXSourcesBuildPhase;
290 | buildActionMask = 2147483647;
291 | files = (
292 | 0E1B4D7D18F989C2006F23D4 /* DJWStarRatingViewTests.m in Sources */,
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | };
296 | /* End PBXSourcesBuildPhase section */
297 |
298 | /* Begin PBXTargetDependency section */
299 | 0E1B4D7518F989C2006F23D4 /* PBXTargetDependency */ = {
300 | isa = PBXTargetDependency;
301 | target = 0E1B4D4D18F989C2006F23D4 /* DJWStarRatingView */;
302 | targetProxy = 0E1B4D7418F989C2006F23D4 /* PBXContainerItemProxy */;
303 | };
304 | /* End PBXTargetDependency section */
305 |
306 | /* Begin PBXVariantGroup section */
307 | 0E1B4D7918F989C2006F23D4 /* InfoPlist.strings */ = {
308 | isa = PBXVariantGroup;
309 | children = (
310 | 0E1B4D7A18F989C2006F23D4 /* en */,
311 | );
312 | name = InfoPlist.strings;
313 | sourceTree = "";
314 | };
315 | 37CD769619352376002F9BBF /* Main.storyboard */ = {
316 | isa = PBXVariantGroup;
317 | children = (
318 | 37CD769719352376002F9BBF /* Base */,
319 | );
320 | name = Main.storyboard;
321 | sourceTree = "";
322 | };
323 | /* End PBXVariantGroup section */
324 |
325 | /* Begin XCBuildConfiguration section */
326 | 0E1B4D7E18F989C2006F23D4 /* Debug */ = {
327 | isa = XCBuildConfiguration;
328 | buildSettings = {
329 | ALWAYS_SEARCH_USER_PATHS = NO;
330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
331 | CLANG_CXX_LIBRARY = "libc++";
332 | CLANG_ENABLE_MODULES = YES;
333 | CLANG_ENABLE_OBJC_ARC = YES;
334 | CLANG_WARN_BOOL_CONVERSION = YES;
335 | CLANG_WARN_CONSTANT_CONVERSION = YES;
336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
337 | CLANG_WARN_EMPTY_BODY = YES;
338 | CLANG_WARN_ENUM_CONVERSION = YES;
339 | CLANG_WARN_INT_CONVERSION = YES;
340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
343 | COPY_PHASE_STRIP = NO;
344 | GCC_C_LANGUAGE_STANDARD = gnu99;
345 | GCC_DYNAMIC_NO_PIC = NO;
346 | GCC_OPTIMIZATION_LEVEL = 0;
347 | GCC_PREPROCESSOR_DEFINITIONS = (
348 | "DEBUG=1",
349 | "$(inherited)",
350 | );
351 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
354 | GCC_WARN_UNDECLARED_SELECTOR = YES;
355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
356 | GCC_WARN_UNUSED_FUNCTION = YES;
357 | GCC_WARN_UNUSED_VARIABLE = YES;
358 | IPHONEOS_DEPLOYMENT_TARGET = 7.1;
359 | ONLY_ACTIVE_ARCH = YES;
360 | SDKROOT = iphoneos;
361 | };
362 | name = Debug;
363 | };
364 | 0E1B4D7F18F989C2006F23D4 /* Release */ = {
365 | isa = XCBuildConfiguration;
366 | buildSettings = {
367 | ALWAYS_SEARCH_USER_PATHS = NO;
368 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
369 | CLANG_CXX_LIBRARY = "libc++";
370 | CLANG_ENABLE_MODULES = YES;
371 | CLANG_ENABLE_OBJC_ARC = YES;
372 | CLANG_WARN_BOOL_CONVERSION = YES;
373 | CLANG_WARN_CONSTANT_CONVERSION = YES;
374 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
375 | CLANG_WARN_EMPTY_BODY = YES;
376 | CLANG_WARN_ENUM_CONVERSION = YES;
377 | CLANG_WARN_INT_CONVERSION = YES;
378 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
379 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
381 | COPY_PHASE_STRIP = YES;
382 | ENABLE_NS_ASSERTIONS = NO;
383 | GCC_C_LANGUAGE_STANDARD = gnu99;
384 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
386 | GCC_WARN_UNDECLARED_SELECTOR = YES;
387 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
388 | GCC_WARN_UNUSED_FUNCTION = YES;
389 | GCC_WARN_UNUSED_VARIABLE = YES;
390 | IPHONEOS_DEPLOYMENT_TARGET = 7.1;
391 | SDKROOT = iphoneos;
392 | VALIDATE_PRODUCT = YES;
393 | };
394 | name = Release;
395 | };
396 | 0E1B4D8118F989C2006F23D4 /* Debug */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-2";
400 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "LaunchImage-2";
401 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
402 | INFOPLIST_FILE = "$(SRCROOT)/Example/Resources/DJWStarRatingView-Info.plist";
403 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
404 | PRODUCT_NAME = "$(TARGET_NAME)";
405 | WRAPPER_EXTENSION = app;
406 | };
407 | name = Debug;
408 | };
409 | 0E1B4D8218F989C2006F23D4 /* Release */ = {
410 | isa = XCBuildConfiguration;
411 | buildSettings = {
412 | ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-2";
413 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "LaunchImage-2";
414 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
415 | INFOPLIST_FILE = "$(SRCROOT)/Example/Resources/DJWStarRatingView-Info.plist";
416 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
417 | PRODUCT_NAME = "$(TARGET_NAME)";
418 | WRAPPER_EXTENSION = app;
419 | };
420 | name = Release;
421 | };
422 | 0E1B4D8418F989C2006F23D4 /* Debug */ = {
423 | isa = XCBuildConfiguration;
424 | buildSettings = {
425 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DJWStarRatingView.app/DJWStarRatingView";
426 | FRAMEWORK_SEARCH_PATHS = (
427 | "$(SDKROOT)/Developer/Library/Frameworks",
428 | "$(inherited)",
429 | "$(DEVELOPER_FRAMEWORKS_DIR)",
430 | );
431 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
432 | GCC_PREPROCESSOR_DEFINITIONS = (
433 | "DEBUG=1",
434 | "$(inherited)",
435 | );
436 | INFOPLIST_FILE = "DJWStarRatingViewTests/DJWStarRatingViewTests-Info.plist";
437 | PRODUCT_NAME = "$(TARGET_NAME)";
438 | TEST_HOST = "$(BUNDLE_LOADER)";
439 | WRAPPER_EXTENSION = xctest;
440 | };
441 | name = Debug;
442 | };
443 | 0E1B4D8518F989C2006F23D4 /* Release */ = {
444 | isa = XCBuildConfiguration;
445 | buildSettings = {
446 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DJWStarRatingView.app/DJWStarRatingView";
447 | FRAMEWORK_SEARCH_PATHS = (
448 | "$(SDKROOT)/Developer/Library/Frameworks",
449 | "$(inherited)",
450 | "$(DEVELOPER_FRAMEWORKS_DIR)",
451 | );
452 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
453 | INFOPLIST_FILE = "DJWStarRatingViewTests/DJWStarRatingViewTests-Info.plist";
454 | PRODUCT_NAME = "$(TARGET_NAME)";
455 | TEST_HOST = "$(BUNDLE_LOADER)";
456 | WRAPPER_EXTENSION = xctest;
457 | };
458 | name = Release;
459 | };
460 | /* End XCBuildConfiguration section */
461 |
462 | /* Begin XCConfigurationList section */
463 | 0E1B4D4918F989C2006F23D4 /* Build configuration list for PBXProject "DJWStarRatingView" */ = {
464 | isa = XCConfigurationList;
465 | buildConfigurations = (
466 | 0E1B4D7E18F989C2006F23D4 /* Debug */,
467 | 0E1B4D7F18F989C2006F23D4 /* Release */,
468 | );
469 | defaultConfigurationIsVisible = 0;
470 | defaultConfigurationName = Release;
471 | };
472 | 0E1B4D8018F989C2006F23D4 /* Build configuration list for PBXNativeTarget "DJWStarRatingView" */ = {
473 | isa = XCConfigurationList;
474 | buildConfigurations = (
475 | 0E1B4D8118F989C2006F23D4 /* Debug */,
476 | 0E1B4D8218F989C2006F23D4 /* Release */,
477 | );
478 | defaultConfigurationIsVisible = 0;
479 | defaultConfigurationName = Release;
480 | };
481 | 0E1B4D8318F989C2006F23D4 /* Build configuration list for PBXNativeTarget "DJWStarRatingViewTests" */ = {
482 | isa = XCConfigurationList;
483 | buildConfigurations = (
484 | 0E1B4D8418F989C2006F23D4 /* Debug */,
485 | 0E1B4D8518F989C2006F23D4 /* Release */,
486 | );
487 | defaultConfigurationIsVisible = 0;
488 | defaultConfigurationName = Release;
489 | };
490 | /* End XCConfigurationList section */
491 | };
492 | rootObject = 0E1B4D4618F989C2006F23D4 /* Project object */;
493 | }
494 |
--------------------------------------------------------------------------------