diff --git a/AMRatingControl.podspec b/AMRatingControl.podspec deleted file mode 100644 index f8ef8f8..0000000 --- a/AMRatingControl.podspec +++ /dev/null @@ -1,24 +0,0 @@ -Pod::Spec.new do |s| - s.name = "AMRatingControl" - s.version = "1.3.0" - s.summary = "A simple rating control for the iPhone." - s.description = <<-DESC - AMRatingControl is a UI control that resembles the 'star rating' control seen in the iPod app. - AMRatingControl allows you to select a rating starting from 0 to any number of stars you want. - You can use default star symbols and customize colors or specify custom images. - DESC - s.homepage = "https://github.com/amseddi/AMRatingControl" - - s.license = { :type => 'MIT', :file => 'LICENSE' } - - s.author = "amseddi" - s.source = { :git => "https://github.com/amseddi/AMRatingControl.git", :tag => "1.3.0" } - - s.platform = :ios, '5.0' - - s.source_files = 'Classes' - - s.resources = "star.png", "dot.png" - - s.requires_arc = true -end diff --git a/Classes/AMRatingControl.h b/Classes/StarRatingControl.h similarity index 69% rename from Classes/AMRatingControl.h rename to Classes/StarRatingControl.h index ba286d3..68de197 100755 --- a/Classes/AMRatingControl.h +++ b/Classes/StarRatingControl.h @@ -1,5 +1,5 @@ // -// AMRatingControl.h +// StarRatingControl.h // RatingControl // @@ -10,14 +10,14 @@ typedef void (^EditingChangedBlock)(NSUInteger rating); typedef void (^EditingDidEndBlock)(NSUInteger rating); -@interface AMRatingControl : UIControl +@interface StarRatingControl : UIControl /**************************************************************************************************/ #pragma mark - Getters and Setters @property (nonatomic, assign) NSInteger maxRating; -@property (nonatomic, assign) NSInteger rating; +@property (nonatomic, assign) float rating; @property (nonatomic, readwrite) NSUInteger starFontSize; @property (nonatomic, readwrite) NSUInteger starWidthAndHeight; @property (nonatomic, readwrite) NSUInteger starSpacing; @@ -57,6 +57,21 @@ typedef void (^EditingDidEndBlock)(NSUInteger rating); solidImage:(UIImage *)solidImageOrNil andMaxRating:(NSInteger)maxRating; +/** + * @param location : position of the rating control in your view + * The control will manage its own width/height (kind of like UIActivityIndicator) + * @param emptyImage & solidImage can both be nil, or not even a dot or a star (a any images you want!) + * If either of these parameters are nil, the class will draw its own stars + * @param userInteractionEnabled - self explanatory + * @param initialRating will initialize the number of stars and partial stars to show with the control at startup + * @param maxRating + * + */ +- (id)initWithLocation:(CGPoint)location + emptyImage:(UIImage *)emptyImageOrNil + solidImage:(UIImage *)solidImageOrNil + initialRating:(float)initialRating + andMaxRating:(NSInteger)maxRating; @end diff --git a/Classes/AMRatingControl.m b/Classes/StarRatingControl.m similarity index 60% rename from Classes/AMRatingControl.m rename to Classes/StarRatingControl.m index a26ef58..8acf235 100755 --- a/Classes/AMRatingControl.m +++ b/Classes/StarRatingControl.m @@ -1,22 +1,21 @@ // -// AMRatingControl.m +// StarRatingControl.m // RatingControl // -#import "AMRatingControl.h" +#import "StarRatingControl.h" // Constants : static const CGFloat kFontSize = 20; -static const NSInteger kStarWidthAndHeight = 20; +static const NSInteger kStarWidthAndHeight = 27; static const NSInteger kStarSpacing = 0; static const NSString *kDefaultEmptyChar = @"☆"; static const NSString *kDefaultSolidChar = @"★"; - -@interface AMRatingControl (Private) +@interface StarRatingControl (Private) - (id)initWithLocation:(CGPoint)location emptyImage:(UIImage *)emptyImageOrNil @@ -31,12 +30,13 @@ - (void)handleTouch:(UITouch *)touch; @end -@implementation AMRatingControl +@implementation StarRatingControl { BOOL _respondsToTranslatesAutoresizingMaskIntoConstraints; UIImage *_emptyImage, *_solidImage; UIColor *_emptyColor, *_solidColor; NSInteger _maxRating; + BOOL _partialStarsAllowed; } /**************************************************************************************************/ @@ -52,7 +52,7 @@ - (void)setMaxRating:(NSInteger)maxRating [self setNeedsDisplay]; } -- (void)setRating:(NSInteger)rating +- (void)setRating:(float)rating { _rating = (rating < 0) ? 0 : rating; _rating = (rating > _maxRating) ? _maxRating : rating; @@ -99,6 +99,23 @@ - (id)initWithLocation:(CGPoint)location andMaxRating:maxRating]; } + +- (id)initWithLocation:(CGPoint)location + emptyImage:(UIImage *)emptyImageOrNil + solidImage:(UIImage *)solidImageOrNil + initialRating:(float)initialRating + andMaxRating:(NSInteger)maxRating +{ + return [self initWithLocation:location + emptyImage:emptyImageOrNil + solidImage:solidImageOrNil + emptyColor:nil + solidColor:nil + initialRating:initialRating + andMaxRating:maxRating]; +} + + - (id)initWithLocation:(CGPoint)location emptyColor:(UIColor *)emptyColor solidColor:(UIColor *)solidColor @@ -136,9 +153,12 @@ - (CGSize)intrinsicContentSize - (void)drawRect:(CGRect)rect { CGPoint currPoint = CGPointZero; + int wholeStars = (int)floor(_rating); + float partialStars = _rating - (float)wholeStars; - for (int i = 0; i < _rating; i++) + for (int i = 0; i < wholeStars; i++) { + if (_solidImage) { [_solidImage drawAtPoint:currPoint]; @@ -151,8 +171,15 @@ - (void)drawRect:(CGRect)rect currPoint.x += (_starWidthAndHeight + _starSpacing); } - - NSInteger remaining = _maxRating - _rating; + + if (partialStars > 0) { + UIImage *partialStar = [self partialImage:_solidImage fraction:partialStars]; + [_emptyImage drawAtPoint:currPoint]; + [partialStar drawAtPoint:currPoint]; + currPoint.x += (_starWidthAndHeight + _starSpacing); + } + + NSInteger remaining = (floor)(_maxRating - _rating) ; for (int i = 0; i < remaining; i++) { @@ -197,15 +224,30 @@ - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event /**************************************************************************************************/ #pragma mark - Private Methods + - (void)initializeWithEmptyImage:(UIImage *)emptyImageOrNil solidImage:(UIImage *)solidImageOrNil emptyColor:(UIColor *)emptyColor solidColor:(UIColor *)solidColor andMaxRating:(NSInteger)maxRating +{ + [self initializeWithEmptyImage:emptyImageOrNil + solidImage:solidImageOrNil + emptyColor:emptyColor + solidColor:solidColor + initialRating:0.0 + andMaxRating:maxRating]; +} + +- (void)initializeWithEmptyImage:(UIImage *)emptyImageOrNil + solidImage:(UIImage *)solidImageOrNil + emptyColor:(UIColor *)emptyColor + solidColor:(UIColor *)solidColor + initialRating:(float)initialRating + andMaxRating:(NSInteger)maxRating { _respondsToTranslatesAutoresizingMaskIntoConstraints = [self respondsToSelector:@selector(translatesAutoresizingMaskIntoConstraints)]; - _rating = 0; self.backgroundColor = [UIColor clearColor]; self.opaque = NO; @@ -214,9 +256,15 @@ - (void)initializeWithEmptyImage:(UIImage *)emptyImageOrNil _emptyColor = emptyColor; _solidColor = solidColor; _maxRating = maxRating; + _rating = initialRating; _starFontSize = kFontSize; _starWidthAndHeight = kStarWidthAndHeight; _starSpacing = kStarSpacing; + + if(!_emptyColor && !_solidColor && _solidImage) + { + _partialStarsAllowed = YES; + } } - (id)initWithCoder:(NSCoder *)decoder @@ -227,12 +275,37 @@ - (id)initWithCoder:(NSCoder *)decoder solidImage:nil emptyColor:nil solidColor:nil + initialRating:0.0 andMaxRating:0]; } return self; } +- (id)initWithLocation:(CGPoint)location + emptyImage:(UIImage *)emptyImageOrNil + solidImage:(UIImage *)solidImageOrNil + emptyColor:(UIColor *)emptyColor + solidColor:(UIColor *)solidColor + initialRating:(float)initialRating + andMaxRating:(NSInteger)maxRating +{ + if (self = [self initWithFrame:CGRectMake(location.x, + location.y, + (maxRating * kStarWidthAndHeight), + kStarWidthAndHeight)]) + { + [self initializeWithEmptyImage:emptyImageOrNil + solidImage:solidImageOrNil + emptyColor:emptyColor + solidColor:solidColor + initialRating:(float)initialRating + andMaxRating:maxRating]; + } + + return self; +} + - (id)initWithLocation:(CGPoint)location emptyImage:(UIImage *)emptyImageOrNil solidImage:(UIImage *)solidImageOrNil @@ -249,12 +322,14 @@ - (id)initWithLocation:(CGPoint)location solidImage:solidImageOrNil emptyColor:emptyColor solidColor:solidColor + initialRating:0.0f andMaxRating:maxRating]; } return self; } + - (void)adjustFrame { if (_respondsToTranslatesAutoresizingMaskIntoConstraints && !self.translatesAutoresizingMaskIntoConstraints) @@ -278,7 +353,7 @@ - (void)handleTouch:(UITouch *)touch CGPoint touchLocation = [touch locationInView:self]; - if (touchLocation.x < 0) + if (touchLocation.x < 0 || touchLocation.x < ((float)kStarWidthAndHeight)/3.0) { if (_rating != 0) { @@ -302,19 +377,53 @@ - (void)handleTouch:(UITouch *)touch } else { + float halfWidth = (float)_starWidthAndHeight/2.0; + for (int i = 0 ; i < _maxRating ; i++) { - if ((touchLocation.x > section.origin.x) && (touchLocation.x < (section.origin.x + _starWidthAndHeight))) + if (touchLocation.x > section.origin.x) { - if (_rating != (i + 1)) - { - _rating = i + 1; - if (self.editingChangedBlock) - { - self.editingChangedBlock(_rating); + if (_partialStarsAllowed) { + // first half of the star + if (touchLocation.x < (section.origin.x + halfWidth)) { + if (_rating != (i + 0.5)) + { + _rating = i + 0.5; + if (self.editingChangedBlock) + { + self.editingChangedBlock(_rating); + } + } + break; + } + + // second half of the star + if (touchLocation.x > (section.origin.x + halfWidth) && + touchLocation.x < (section.origin.x + _starWidthAndHeight)) { + if (_rating != (i + 1)) + { + _rating = i + 1; + if (self.editingChangedBlock) + { + self.editingChangedBlock(_rating); + } + } + break; + } + }else{ // only wholestars + if (touchLocation.x < (section.origin.x + _starWidthAndHeight)) { + if (_rating != (i + 1)) + { + _rating = i + 1; + if (self.editingChangedBlock) + { + self.editingChangedBlock(_rating); + } + } + break; } - } - break; + } + } section.origin.x += (_starWidthAndHeight + _starSpacing); } @@ -322,4 +431,13 @@ - (void)handleTouch:(UITouch *)touch [self setNeedsDisplay]; } +- (UIImage *) partialImage:(UIImage *)image fraction:(float)fraction +{ + CGImageRef imgRef = image.CGImage; + CGImageRef fractionalImgRef = CGImageCreateWithImageInRect(imgRef, CGRectMake(0, 0, image.size.width * fraction, image.size.height)); + UIImage *fractionalImg = [UIImage imageWithCGImage:fractionalImgRef]; + CGImageRelease(fractionalImgRef); + return fractionalImg; +} + @end diff --git a/Demo/App/AMRatingControlAppDelegate.h b/Demo/App/AMRatingControlAppDelegate.h deleted file mode 100644 index e709615..0000000 --- a/Demo/App/AMRatingControlAppDelegate.h +++ /dev/null @@ -1,21 +0,0 @@ -#import - - -@class AMRatingControlViewController; - - -@interface AMRatingControlAppDelegate : NSObject -{ - UIWindow *window; - AMRatingControlViewController *viewController; -} - - -/**************************************************************************************************/ -#pragma mark - Getters & Setters - -@property (nonatomic, strong) IBOutlet UIWindow *window; -@property (nonatomic, strong) IBOutlet AMRatingControlViewController *viewController; - - -@end diff --git a/Demo/App/StarRatingControlAppDelegate.h b/Demo/App/StarRatingControlAppDelegate.h new file mode 100755 index 0000000..b3403c4 --- /dev/null +++ b/Demo/App/StarRatingControlAppDelegate.h @@ -0,0 +1,21 @@ +#import + + +@class StarRatingControlViewController; + + +@interface StarRatingControlAppDelegate : NSObject +{ + UIWindow *window; + StarRatingControlViewController *viewController; +} + + +/**************************************************************************************************/ +#pragma mark - Getters & Setters + +@property (nonatomic, strong) IBOutlet UIWindow *window; +@property (nonatomic, strong) IBOutlet StarRatingControlViewController *viewController; + + +@end diff --git a/Demo/App/AMRatingControlAppDelegate.m b/Demo/App/StarRatingControlAppDelegate.m old mode 100644 new mode 100755 similarity index 70% rename from Demo/App/AMRatingControlAppDelegate.m rename to Demo/App/StarRatingControlAppDelegate.m index fd3059f..adcf661 --- a/Demo/App/AMRatingControlAppDelegate.m +++ b/Demo/App/StarRatingControlAppDelegate.m @@ -1,8 +1,8 @@ -#import "AMRatingControlAppDelegate.h" -#import "AMRatingControlViewController.h" +#import "StarRatingControlAppDelegate.h" +#import "StarRatingControlViewController.h" -@implementation AMRatingControlAppDelegate +@implementation StarRatingControlAppDelegate /**************************************************************************************************/ @@ -17,7 +17,7 @@ @implementation AMRatingControlAppDelegate - (void)applicationDidFinishLaunching:(UIApplication *)application { - [window addSubview:viewController.view]; + [self.window setRootViewController:viewController]; [window makeKeyAndVisible]; } diff --git a/Demo/Controller/AMRatingControlViewController.xib b/Demo/Controller/AMRatingControlViewController.xib deleted file mode 100644 index 6db710b..0000000 --- a/Demo/Controller/AMRatingControlViewController.xib +++ /dev/null @@ -1,428 +0,0 @@ - - - - 784 - 11G63 - 3084 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - YES - IBProxyObject - IBUILabel - IBUIView - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 292 - {{146, 96}, {154, 21}} - - - - NO - YES - NO - IBCocoaTouchFramework - Label - - 1 - MCAwIDAAA - - - 1 - 10 - 1 - - 1 - 17 - - - Helvetica - 17 - 16 - - - - - 292 - {{20, 125}, {110, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - End rating - - 1 - MCAwIDAAA - darkTextColor - - - 0 - - - NO - - - - 292 - {{20, 96}, {118, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Rating change - - - 0 - - - NO - - - - 292 - {{146, 125}, {154, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Label - - - 0 - 1 - - - NO - - - - 292 - {{20, 20}, {251, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Simple Rating Control (10px Space) - - - 0 - 9 - - - - - - 292 - {{20, 219}, {271, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Imaged Rating Control - - - 0 - - - NO - - - - 292 - {{20, 339}, {280, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Colored Rating Control - - - 0 - - - NO - - - {{0, 20}, {320, 460}} - - - - - 3 - MC43NQA - - 2 - - - NO - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 7 - - - - label - - - - 9 - - - - endLabel - - - - 13 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 6 - - - YES - - - - - - - - - - - - 8 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 14 - - - - - 15 - - - - - 17 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 14.IBPluginDependency - 15.IBPluginDependency - 17.IBPluginDependency - 6.IBPluginDependency - 8.IBPluginDependency - - - YES - AMRatingControlViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 17 - - - - YES - - AMRatingControlViewController - UIViewController - - YES - - YES - endLabel - label - - - YES - UILabel - UILabel - - - - YES - - YES - endLabel - label - - - YES - - endLabel - UILabel - - - label - UILabel - - - - - IBProjectSource - ./Classes/AMRatingControlViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 2083 - - diff --git a/Demo/Controller/AMRatingControlViewController.h b/Demo/Controller/StarRatingControlViewController.h old mode 100644 new mode 100755 similarity index 60% rename from Demo/Controller/AMRatingControlViewController.h rename to Demo/Controller/StarRatingControlViewController.h index 05dbe52..eda9b67 --- a/Demo/Controller/AMRatingControlViewController.h +++ b/Demo/Controller/StarRatingControlViewController.h @@ -1,6 +1,6 @@ #import -@interface AMRatingControlViewController : UIViewController +@interface StarRatingControlViewController : UIViewController { IBOutlet UILabel *label; IBOutlet UILabel *endLabel; diff --git a/Demo/Controller/AMRatingControlViewController.m b/Demo/Controller/StarRatingControlViewController.m old mode 100644 new mode 100755 similarity index 66% rename from Demo/Controller/AMRatingControlViewController.m rename to Demo/Controller/StarRatingControlViewController.m index 5800857..fac235a --- a/Demo/Controller/AMRatingControlViewController.m +++ b/Demo/Controller/StarRatingControlViewController.m @@ -1,8 +1,8 @@ -#import "AMRatingControlViewController.h" -#import "AMRatingControl.h" +#import "StarRatingControlViewController.h" +#import "StarRatingControl.h" -@interface AMRatingControlViewController (Private) +@interface StarRatingControlViewController (Private) - (void)updateRating:(id)sender; - (void)updateEndRating:(id)sender; @@ -10,7 +10,7 @@ - (void)updateEndRating:(id)sender; @end -@implementation AMRatingControlViewController +@implementation StarRatingControlViewController /**************************************************************************************************/ @@ -23,7 +23,7 @@ - (void)viewDidLoad // Create a simple instance, initing with : // - a CGPoint (the position in your view from which it will be drawn) // - and max rating - AMRatingControl *simpleRatingControl = [[AMRatingControl alloc] initWithLocation:CGPointMake(90, 50) + StarRatingControl *simpleRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(80, 60) andMaxRating:5]; // Customize the current rating if needed @@ -45,27 +45,30 @@ - (void)viewDidLoad // Create an instance with images, initing with : // - a CGPoint (the position in your view from which it will be drawn) // - a custom empty image and solid image if you wish (pass nil if you want to use the default). + // - initial rating (how many stars the rating will have initially when displayed) // - and max rating - UIImage *dot, *star; - dot = [UIImage imageNamed:@"dot.png"]; - star = [UIImage imageNamed:@"star.png"]; - AMRatingControl *imagesRatingControl = [[AMRatingControl alloc] initWithLocation:CGPointMake(110, 250) - emptyImage:dot - solidImage:star + // This control, when initialized with (at least) the fullStar image will support partial rating stars, i.e., 3.5 + UIImage *emptyStar, *fullStar; + emptyStar = [UIImage imageNamed:@"star_rating_empty.png"]; + fullStar = [UIImage imageNamed:@"star_rating_full.png"]; + + StarRatingControl *imagesRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(90, 220) + emptyImage:emptyStar + solidImage:fullStar + initialRating:3.5 andMaxRating:5]; - + // Create an instance with custom color, initing with : // - a CGPoint (the position in your view from which it will be drawn) - // - a custom empty image and solid image if you wish (pass nil if you want to use the default). + // - colors for "empty" and "full" rating stars // - and max rating - AMRatingControl *coloredRatingControl = [[AMRatingControl alloc] initWithLocation:CGPointMake(110, 370) + StarRatingControl *coloredRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(90, 380) emptyColor:[UIColor yellowColor] solidColor:[UIColor redColor] andMaxRating:5]; - // Add the control(s) as a subview of your view [self.view addSubview:simpleRatingControl]; [self.view addSubview:imagesRatingControl]; diff --git a/Demo/Controller/StarRatingControlViewController.xib b/Demo/Controller/StarRatingControlViewController.xib new file mode 100755 index 0000000..a4d021e --- /dev/null +++ b/Demo/Controller/StarRatingControlViewController.xib @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 index 3361a37..0d4074b --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012, Ameddi +Copyright (c) 2014, Xenia H Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MainWindow.xib b/MainWindow.xib old mode 100644 new mode 100755 index 22c2deb..030b976 --- a/MainWindow.xib +++ b/MainWindow.xib @@ -1,268 +1,35 @@ - - - - 1536 - 11G56 - 2840 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1926 - - - YES - IBProxyObject - IBUICustomObject - IBUIViewController - IBUIWindow - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - IBCocoaTouchFramework - - - AMRatingControlViewController - - - 1 - 1 - - IBCocoaTouchFramework - NO - - - - 292 - {320, 480} - - 1 - MSAxIDEAA - - NO - NO - - IBCocoaTouchFramework - - - - - YES - - - delegate - - - - 4 - - - - viewController - - - - 11 - - - - window - - - - 14 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - 3 - - - - - -2 - - - - - 10 - - - - - 12 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 10.CustomClassName - 10.IBPluginDependency - 12.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - - - YES - UIApplication - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - AMRatingControlViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - AMRatingControlAppDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 14 - - - - YES - - AMRatingControlAppDelegate - NSObject - - YES - - YES - viewController - window - - - YES - AMRatingControlViewController - UIWindow - - - - YES - - YES - viewController - window - - - YES - - viewController - AMRatingControlViewController - - - window - UIWindow - - - - - IBProjectSource - ./Classes/AMRatingControlAppDelegate.h - - - - AMRatingControlViewController - UIViewController - - YES - - YES - endLabel - label - - - YES - UILabel - UILabel - - - - YES - - YES - endLabel - label - - - YES - - endLabel - UILabel - - - label - UILabel - - - - - IBProjectSource - ./Classes/AMRatingControlViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 1926 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.mdown b/README.mdown old mode 100644 new mode 100755 index 2e0b686..0b76767 --- a/README.mdown +++ b/README.mdown @@ -1,71 +1,72 @@ -# AMRatingControl +# StarRatingControl -###### This is a fork from [jasarien/JSFavStarControl](https://github.com/jasarien/JSFavStarControl). +###### This is a fork from [amseddi/AMRatingControl](https://github.com/amseddi/AMRatingControl). -AMRatingControl is a UI control that resembles the 'star rating' control seen in the iPod app. +StarRatingControl is a UI control that resembles the 'star rating' control seen in the iPod app. -AMRatingControl allows you to select a rating starting from 0 to any number of stars you want. +StarRatingControl allows you to select a rating starting from 0 to any number of stars you want. You can use default star symbols and customize colors or specify custom images. ## How To Get Started -**- Using [CocoaPods](http://cocoapods.org/)** - -``` ruby -pod 'AMRatingControl' -``` - -**- Without CocoaPods** - -Add `AMRatingControl.h` and `AMRatingControl.m` to your project. +Add `StarRatingControl.h` and `StarRatingControl.m` to your project. ## Example Usage ``` objective-c - -#include "AMRatingControl.h" - -// Create a simple instance, initing with : -// - a CGPoint (the position in your view from which it will be drawn) -// - and max rating -AMRatingControl *simpleRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location - andMaxRating:(NSInteger)maxRating]; - -// Customize the current rating if needed -[ratingControl setRating:(NSInteger)rating]; - -// Define block to handle events -simpleRatingControl.editingChangedBlock = ^(NSUInteger rating) -{ - [label setText:[NSString stringWithFormat:@"%d", rating]]; -}; + #import "StarRatingControl.h" + + // Create a simple instance, initing with : + // - a CGPoint (the position in your view from which it will be drawn) + // - and max rating + StarRatingControl *simpleRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(90, 50) + andMaxRating:5]; + + // Customize the current rating if needed + [simpleRatingControl setRating:3]; + [simpleRatingControl setStarSpacing:10]; + + // Define block to handle events + simpleRatingControl.editingChangedBlock = ^(NSUInteger rating) + { + [label setText:[NSString stringWithFormat:@"%d", rating]]; + }; + + simpleRatingControl.editingDidEndBlock = ^(NSUInteger rating) + { + [endLabel setText:[NSString stringWithFormat:@"%d", rating]]; + }; + + + // Create an instance with images, initing with : + // - a CGPoint (the position in your view from which it will be drawn) + // - a custom empty image and solid image if you wish (pass nil if you want to use the default). + // - initial rating (how many stars the rating will have initially when displayed) + // - and max rating + // This control, when initialized with (at least) the fullStar image will support partial rating stars, i.e., 3.5 + UIImage *emptyStar, *fullStar; + emptyStar = [UIImage imageNamed:@"star_rating_empty.png"]; + fullStar = [UIImage imageNamed:@"star_rating_full.png"]; + + StarRatingControl *imagesRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(110, 250) + emptyImage:emptyStar + solidImage:fullStar + initialRating:3.5 + andMaxRating:5]; + + // Create an instance with custom color, initing with : + // - a CGPoint (the position in your view from which it will be drawn) + // - colors for "empty" and "full" rating stars + // - and max rating + StarRatingControl *coloredRatingControl = [[StarRatingControl alloc] initWithLocation:CGPointMake(110, 370) + emptyColor:[UIColor yellowColor] + solidColor:[UIColor redColor] + andMaxRating:5]; -simpleRatingControl.editingDidEndBlock = ^(NSUInteger rating) -{ - [endLabel setText:[NSString stringWithFormat:@"%d", rating]]; -}; - -// Create an instance with images, initing with : -// - a CGPoint (the position in your view from which it will be drawn) -// - a custom empty image and solid image if you wish (pass nil if you want to use the default). -// - and max rating -AMRatingControl *imagesRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location - emptyImage:(UIImage *)emptyImageOrNil - solidImage:(UIImage *)solidImageOrNil - andMaxRating:(NSInteger)maxRating]; - -// Create an instance with custom colors, initing with : -// - a CGPoint (the position in your view from which it will be drawn) -// - a custom empty image and solid image if you wish (pass nil if you want to use the default). -// - and max rating -AMRatingControl *coloredRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location - emptyColor:(UIColor *)emptyColorOrNi - solidColor:(UIColor *)solidColorOrNi - andMaxRating:(NSInteger)maxRating]; // Add the control(s) as subview of your view [view addSubview:simpleRatingControl]; @@ -73,13 +74,13 @@ AMRatingControl *coloredRatingControl = [[AMRatingControl alloc] initWithLocatio [view addSubview:coloredRatingControl]; ``` -Example ScreenShot +StarRatingControl ScreenShot ## ARC -AMRatingControl uses ARC. +StarRatingControl uses ARC. ## License -AMRatingControl is available under the MIT license. See the LICENSE file for more info. +StarRatingControl is available under the MIT license. See the LICENSE file for more info. diff --git a/Resources/star_rating_empty.png b/Resources/star_rating_empty.png new file mode 100644 index 0000000..2e98168 Binary files /dev/null and b/Resources/star_rating_empty.png differ diff --git a/Resources/star_rating_full.png b/Resources/star_rating_full.png new file mode 100644 index 0000000..a04a932 Binary files /dev/null and b/Resources/star_rating_full.png differ diff --git a/Screen Shot 2014-03-26 at 6.29.49 PM.png b/Screen Shot 2014-03-26 at 6.29.49 PM.png new file mode 100644 index 0000000..40d4b27 Binary files /dev/null and b/Screen Shot 2014-03-26 at 6.29.49 PM.png differ diff --git a/StarRatingControl b/StarRatingControl new file mode 160000 index 0000000..7f037c6 --- /dev/null +++ b/StarRatingControl @@ -0,0 +1 @@ +Subproject commit 7f037c6e48dbdaf51179ef104dbdfbf8a03eed65 diff --git a/AMRatingControl-Info.plist b/StarRatingControl-Info.plist old mode 100644 new mode 100755 similarity index 88% rename from AMRatingControl-Info.plist rename to StarRatingControl-Info.plist index 818a042..50753fb --- a/AMRatingControl-Info.plist +++ b/StarRatingControl-Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + com.xeniah.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion - 1.2.0 + 2.0.0 LSRequiresIPhoneOS NSMainNibFile diff --git a/AMRatingControl.xcodeproj/project.pbxproj b/StarRatingControl.xcodeproj/project.pbxproj similarity index 61% rename from AMRatingControl.xcodeproj/project.pbxproj rename to StarRatingControl.xcodeproj/project.pbxproj index 9880a3a..5e003d1 100755 --- a/AMRatingControl.xcodeproj/project.pbxproj +++ b/StarRatingControl.xcodeproj/project.pbxproj @@ -12,32 +12,32 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; - 758D370E112C04F6003C8E62 /* AMRatingControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 758D370D112C04F6003C8E62 /* AMRatingControl.m */; }; - 758D3711112C0881003C8E62 /* dot.png in Resources */ = {isa = PBXBuildFile; fileRef = 758D370F112C0881003C8E62 /* dot.png */; }; - 758D3712112C0881003C8E62 /* star.png in Resources */ = {isa = PBXBuildFile; fileRef = 758D3710112C0881003C8E62 /* star.png */; }; - C94C7B021619D449008701B7 /* AMRatingControlAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C94C7AFD1619D449008701B7 /* AMRatingControlAppDelegate.m */; }; - C94C7B031619D449008701B7 /* AMRatingControlViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C94C7B001619D449008701B7 /* AMRatingControlViewController.m */; }; - C94C7B041619D449008701B7 /* AMRatingControlViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C94C7B011619D449008701B7 /* AMRatingControlViewController.xib */; }; + 758D370E112C04F6003C8E62 /* StarRatingControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 758D370D112C04F6003C8E62 /* StarRatingControl.m */; }; + A9542ABE18E3BB5200145FB6 /* star_rating_empty.png in Resources */ = {isa = PBXBuildFile; fileRef = A9542ABC18E3BB5200145FB6 /* star_rating_empty.png */; }; + A9542ABF18E3BB5200145FB6 /* star_rating_full.png in Resources */ = {isa = PBXBuildFile; fileRef = A9542ABD18E3BB5200145FB6 /* star_rating_full.png */; }; + C94C7B021619D449008701B7 /* StarRatingControlAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C94C7AFD1619D449008701B7 /* StarRatingControlAppDelegate.m */; }; + C94C7B031619D449008701B7 /* StarRatingControlViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C94C7B001619D449008701B7 /* StarRatingControlViewController.m */; }; + C94C7B041619D449008701B7 /* StarRatingControlViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C94C7B011619D449008701B7 /* StarRatingControlViewController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D6058910D05DD3D006BFB54 /* AMRatingControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AMRatingControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1D6058910D05DD3D006BFB54 /* StarRatingControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StarRatingControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* AMRatingControl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMRatingControl_Prefix.pch; sourceTree = ""; }; - 758D370C112C04F6003C8E62 /* AMRatingControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMRatingControl.h; sourceTree = ""; }; - 758D370D112C04F6003C8E62 /* AMRatingControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMRatingControl.m; sourceTree = ""; }; - 758D370F112C0881003C8E62 /* dot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dot.png; sourceTree = ""; }; - 758D3710112C0881003C8E62 /* star.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = star.png; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* AMRatingControl-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "AMRatingControl-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; - C94C7AFC1619D449008701B7 /* AMRatingControlAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMRatingControlAppDelegate.h; sourceTree = ""; }; - C94C7AFD1619D449008701B7 /* AMRatingControlAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMRatingControlAppDelegate.m; sourceTree = ""; }; - C94C7AFF1619D449008701B7 /* AMRatingControlViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMRatingControlViewController.h; sourceTree = ""; }; - C94C7B001619D449008701B7 /* AMRatingControlViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMRatingControlViewController.m; sourceTree = ""; }; - C94C7B011619D449008701B7 /* AMRatingControlViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMRatingControlViewController.xib; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* StarRatingControl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarRatingControl_Prefix.pch; sourceTree = ""; }; + 758D370C112C04F6003C8E62 /* StarRatingControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarRatingControl.h; sourceTree = ""; }; + 758D370D112C04F6003C8E62 /* StarRatingControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StarRatingControl.m; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* StarRatingControl-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "StarRatingControl-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + A9542ABC18E3BB5200145FB6 /* star_rating_empty.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = star_rating_empty.png; path = Resources/star_rating_empty.png; sourceTree = ""; }; + A9542ABD18E3BB5200145FB6 /* star_rating_full.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = star_rating_full.png; path = Resources/star_rating_full.png; sourceTree = ""; }; + C94C7AFC1619D449008701B7 /* StarRatingControlAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarRatingControlAppDelegate.h; sourceTree = ""; }; + C94C7AFD1619D449008701B7 /* StarRatingControlAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StarRatingControlAppDelegate.m; sourceTree = ""; }; + C94C7AFF1619D449008701B7 /* StarRatingControlViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarRatingControlViewController.h; sourceTree = ""; }; + C94C7B001619D449008701B7 /* StarRatingControlViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StarRatingControlViewController.m; sourceTree = ""; }; + C94C7B011619D449008701B7 /* StarRatingControlViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StarRatingControlViewController.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -57,8 +57,8 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 758D370C112C04F6003C8E62 /* AMRatingControl.h */, - 758D370D112C04F6003C8E62 /* AMRatingControl.m */, + 758D370C112C04F6003C8E62 /* StarRatingControl.h */, + 758D370D112C04F6003C8E62 /* StarRatingControl.m */, C94C7AFA1619D41D008701B7 /* Demo */, ); path = Classes; @@ -67,7 +67,7 @@ 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( - 1D6058910D05DD3D006BFB54 /* AMRatingControl.app */, + 1D6058910D05DD3D006BFB54 /* StarRatingControl.app */, ); name = Products; sourceTree = ""; @@ -87,7 +87,7 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( - 32CA4F630368D1EE00C91783 /* AMRatingControl_Prefix.pch */, + 32CA4F630368D1EE00C91783 /* StarRatingControl_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; @@ -96,10 +96,10 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 758D370F112C0881003C8E62 /* dot.png */, - 758D3710112C0881003C8E62 /* star.png */, + A9542ABC18E3BB5200145FB6 /* star_rating_empty.png */, + A9542ABD18E3BB5200145FB6 /* star_rating_full.png */, 28AD733E0D9D9553002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* AMRatingControl-Info.plist */, + 8D1107310486CEB800E47090 /* StarRatingControl-Info.plist */, ); name = Resources; sourceTree = ""; @@ -127,8 +127,8 @@ C94C7AFB1619D449008701B7 /* App */ = { isa = PBXGroup; children = ( - C94C7AFC1619D449008701B7 /* AMRatingControlAppDelegate.h */, - C94C7AFD1619D449008701B7 /* AMRatingControlAppDelegate.m */, + C94C7AFC1619D449008701B7 /* StarRatingControlAppDelegate.h */, + C94C7AFD1619D449008701B7 /* StarRatingControlAppDelegate.m */, ); path = App; sourceTree = ""; @@ -136,9 +136,9 @@ C94C7AFE1619D449008701B7 /* Controller */ = { isa = PBXGroup; children = ( - C94C7AFF1619D449008701B7 /* AMRatingControlViewController.h */, - C94C7B001619D449008701B7 /* AMRatingControlViewController.m */, - C94C7B011619D449008701B7 /* AMRatingControlViewController.xib */, + C94C7AFF1619D449008701B7 /* StarRatingControlViewController.h */, + C94C7B001619D449008701B7 /* StarRatingControlViewController.m */, + C94C7B011619D449008701B7 /* StarRatingControlViewController.xib */, ); path = Controller; sourceTree = ""; @@ -146,9 +146,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* AMRatingControl */ = { + 1D6058900D05DD3D006BFB54 /* StarRatingControl */ = { isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AMRatingControl" */; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StarRatingControl" */; buildPhases = ( 1D60588D0D05DD3D006BFB54 /* Resources */, 1D60588E0D05DD3D006BFB54 /* Sources */, @@ -158,9 +158,9 @@ ); dependencies = ( ); - name = AMRatingControl; + name = StarRatingControl; productName = FavStarControl; - productReference = 1D6058910D05DD3D006BFB54 /* AMRatingControl.app */; + productReference = 1D6058910D05DD3D006BFB54 /* StarRatingControl.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -171,7 +171,7 @@ attributes = { LastUpgradeCheck = 0450; }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AMRatingControl" */; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StarRatingControl" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; @@ -185,7 +185,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 1D6058900D05DD3D006BFB54 /* AMRatingControl */, + 1D6058900D05DD3D006BFB54 /* StarRatingControl */, ); }; /* End PBXProject section */ @@ -195,10 +195,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A9542ABE18E3BB5200145FB6 /* star_rating_empty.png in Resources */, 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 758D3711112C0881003C8E62 /* dot.png in Resources */, - 758D3712112C0881003C8E62 /* star.png in Resources */, - C94C7B041619D449008701B7 /* AMRatingControlViewController.xib in Resources */, + C94C7B041619D449008701B7 /* StarRatingControlViewController.xib in Resources */, + A9542ABF18E3BB5200145FB6 /* star_rating_full.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -210,9 +210,9 @@ buildActionMask = 2147483647; files = ( 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 758D370E112C04F6003C8E62 /* AMRatingControl.m in Sources */, - C94C7B021619D449008701B7 /* AMRatingControlAppDelegate.m in Sources */, - C94C7B031619D449008701B7 /* AMRatingControlViewController.m in Sources */, + 758D370E112C04F6003C8E62 /* StarRatingControl.m in Sources */, + C94C7B021619D449008701B7 /* StarRatingControlAppDelegate.m in Sources */, + C94C7B031619D449008701B7 /* StarRatingControlViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -228,10 +228,10 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AMRatingControl_Prefix.pch; - INFOPLIST_FILE = "AMRatingControl-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - PRODUCT_NAME = AMRatingControl; + GCC_PREFIX_HEADER = StarRatingControl_Prefix.pch; + INFOPLIST_FILE = "StarRatingControl-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + PRODUCT_NAME = StarRatingControl; SDKROOT = iphoneos; }; name = Debug; @@ -243,10 +243,10 @@ CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AMRatingControl_Prefix.pch; - INFOPLIST_FILE = "AMRatingControl-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.3; - PRODUCT_NAME = AMRatingControl; + GCC_PREFIX_HEADER = StarRatingControl_Prefix.pch; + INFOPLIST_FILE = "StarRatingControl-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + PRODUCT_NAME = StarRatingControl; SDKROOT = iphoneos; }; name = Release; @@ -280,7 +280,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AMRatingControl" */ = { + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StarRatingControl" */ = { isa = XCConfigurationList; buildConfigurations = ( 1D6058940D05DD3E006BFB54 /* Debug */, @@ -289,7 +289,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AMRatingControl" */ = { + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StarRatingControl" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, diff --git a/AMRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/StarRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 similarity index 67% rename from AMRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to StarRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 625b4a6..11b1074 --- a/AMRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/StarRatingControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:StarRatingControl.xcodeproj"> diff --git a/StarRatingControl.xcodeproj/project.xcworkspace/xcshareddata/StarRatingControl.xccheckout b/StarRatingControl.xcodeproj/project.xcworkspace/xcshareddata/StarRatingControl.xccheckout new file mode 100644 index 0000000..d7090fc --- /dev/null +++ b/StarRatingControl.xcodeproj/project.xcworkspace/xcshareddata/StarRatingControl.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + BC486B43-75F5-4B16-9657-255970113E15 + IDESourceControlProjectName + StarRatingControl + IDESourceControlProjectOriginsDictionary + + 70E163FE-146A-4616-B282-718C3EBD2431 + ssh://github.com/xeniah/StarRatingControl.git + + IDESourceControlProjectPath + StarRatingControl.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 70E163FE-146A-4616-B282-718C3EBD2431 + ../.. + + IDESourceControlProjectURL + ssh://github.com/xeniah/StarRatingControl.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 70E163FE-146A-4616-B282-718C3EBD2431 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 70E163FE-146A-4616-B282-718C3EBD2431 + IDESourceControlWCCName + StarRatingControl + + + + diff --git a/AMRatingControl_Prefix.pch b/StarRatingControl_Prefix.pch old mode 100644 new mode 100755 similarity index 100% rename from AMRatingControl_Prefix.pch rename to StarRatingControl_Prefix.pch diff --git a/dot.png b/dot.png deleted file mode 100644 index 6830be7..0000000 Binary files a/dot.png and /dev/null differ diff --git a/index.html b/index.html old mode 100644 new mode 100755 diff --git a/main.m b/main.m old mode 100644 new mode 100755 index 3131713..c2e1e62 --- a/main.m +++ b/main.m @@ -10,7 +10,7 @@ int main(int argc, char *argv[]) { @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); + int retVal = UIApplicationMain(argc, argv, nil, @"StarRatingControlAppDelegate"); return retVal; } } diff --git a/screenshot.png b/screenshot.png old mode 100644 new mode 100755 diff --git a/star.png b/star.png deleted file mode 100644 index e086171..0000000 Binary files a/star.png and /dev/null differ diff --git a/star_rating_empty.png b/star_rating_empty.png new file mode 100644 index 0000000..2e98168 Binary files /dev/null and b/star_rating_empty.png differ diff --git a/star_rating_full.png b/star_rating_full.png new file mode 100644 index 0000000..a04a932 Binary files /dev/null and b/star_rating_full.png differ