This is a small and configurable stars control with Animation.
- Fix 0 star can't show bug
Add "CDZStarsControl" files to your project
Add pod 'CDZStarsControl'
in your Podfile
#import "CDZStarscontrol.h"
First,Init the view, set the delegate ,and config if you want.
- (CDZStarsControl *)starsControl{
if (!_starsControl) {
_starsControl = [CDZStarsControl.alloc initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 50) stars:5 starSize:CGSizeMake(50, 50) noramlStarImage:[UIImage imageNamed:@"star_normal"] highlightedStarImage:[UIImage imageNamed:@"star_highlighted"]];
_starsControl.delegate = self;
_starsControl.allowFraction = YES;
_starsControl.score = 2.6f;
}
return _starsControl;
}
And Than,add the view.
[self.view addSubview:self.starsControl];
At last,deal the result in delegate.
- (void)starsControl:(CDZStarsControl *)starsControl didChangeScore:(CGFloat)score{
self.label.text = [NSString stringWithFormat:@"%.1f",score];//do someting you want
}
iOS 8.0 Above
- Open a issue
- QQ:757765420
- Email:[email protected]
- Weibo:@Nemocdz
CDZStarsControl is available under the MIT license. See the LICENSE file for more info.