#import <DLStarRatingControl.h>
Definition at line 20 of file DLStarRatingControl.h.
◆ beginTrackingWithTouch:withEvent:()
- (BOOL) beginTrackingWithTouch: |
|
(UITouch *) |
touch |
withEvent: |
|
(UIEvent *) |
event |
|
|
| |
|
implementation |
Definition at line 134 of file DLStarRatingControl.m.
134 :(UITouch *)touch withEvent:(UIEvent *)
event {
135 CGPoint point = [touch locationInView:self];
136 UIButton *pressedButton = [
self starForPoint:point];
138 int idx = (int)pressedButton.tag;
139 if (pressedButton.highlighted) {
140 [
self disableStarsDownToExclusive:idx];
142 [
self enableStarsUpTo:idx];
◆ cancelTrackingWithEvent:()
- (void) cancelTrackingWithEvent: |
|
(UIEvent *) |
event |
|
|
implementation |
◆ continueTrackingWithTouch:withEvent:()
- (BOOL) continueTrackingWithTouch: |
|
(UITouch *) |
touch |
withEvent: |
|
(UIEvent *) |
event |
|
|
| |
|
implementation |
Definition at line 153 of file DLStarRatingControl.m.
153 :(UITouch *)touch withEvent:(UIEvent *)
event {
154 CGPoint point = [touch locationInView:self];
156 UIButton *pressedButton = [
self starForPoint:point];
158 int idx = (int)pressedButton.tag;
159 UIButton *currentButton = (UIButton*)[
self subViewWithTag:currentIdx];
162 currentButton.highlighted = NO;
164 [
self disableStarsDownToExclusive:idx];
166 currentButton.highlighted = YES;
167 pressedButton.highlighted = YES;
169 [
self enableStarsUpTo:idx];
171 }
else if (point.x < [
self subViewWithTag:0].frame.origin.x) {
172 ((UIButton*)[
self subViewWithTag:0]).highlighted = NO;
174 [
self disableStarsDownToExclusive:0];
◆ dealloc()
◆ disableStarsDownTo:()
- (void) disableStarsDownTo: |
|
(int) |
idx |
|
|
implementation |
◆ disableStarsDownToExclusive:()
- (void) disableStarsDownToExclusive: |
|
(int) |
idx |
|
|
implementation |
◆ enableStarsUpTo:()
- (void) enableStarsUpTo: |
|
(int) |
idx |
|
|
implementation |
Definition at line 127 of file DLStarRatingControl.m.
128 for (
int i=0; i <= idx; i++) {
129 UIButton *b = (UIButton*)[
self subViewWithTag:i];
◆ endTrackingWithTouch:withEvent:()
- (void) endTrackingWithTouch: |
|
(UITouch *) |
touch |
withEvent: |
|
(UIEvent *) |
event |
|
|
| |
|
implementation |
Definition at line 179 of file DLStarRatingControl.m.
179 :(UITouch *)touch withEvent:(UIEvent *)
event {
180 [
self.delegate newRating:self :self.rating];
181 [
super endTrackingWithTouch:touch withEvent:event];
◆ initWithCoder:()
- (id) initWithCoder: |
|
(NSCoder *) |
aDecoder |
|
|
implementation |
Definition at line 37 of file DLStarRatingControl.m.
37 :(NSCoder *)aDecoder {
38 self = [
super initWithCoder:aDecoder];
#define kNumberOfFractions
#define kDefaultNumberOfStars
BOOL isFractionalRatingEnabled
◆ initWithFrame:()
- (id) initWithFrame: |
|
(CGRect) |
frame |
|
Definition at line 48 of file DLStarRatingControl.m.
49 self = [
super initWithFrame:frame];
#define kNumberOfFractions
#define kDefaultNumberOfStars
BOOL isFractionalRatingEnabled
◆ initWithFrame:andStars:isFractional:()
- (id) initWithFrame: |
|
(CGRect) |
frame |
andStars: |
|
(NSUInteger) |
_numberOfStars |
isFractional: |
|
(BOOL) |
isFract |
|
|
| |
Definition at line 60 of file DLStarRatingControl.m.
60 :(CGRect)frame andStars:(NSUInteger)_numberOfStars isFractional:(BOOL)isFract{
61 self = [
super initWithFrame:frame];
#define kNumberOfFractions
BOOL isFractionalRatingEnabled
◆ layoutSubviews()
◆ setRating:()
- (void) setRating: |
|
(float) |
_rating |
|
|
implementation |
Definition at line 187 of file DLStarRatingControl.m.
191 [
self disableStarsDownTo:0];
193 [
self enableStarsUpTo:currentIdx];
#define kNumberOfFractions
BOOL isFractionalRatingEnabled
◆ setStar:highlightedStar:()
- (void) setStar: |
|
(UIImage*) |
defaultStarImage |
highlightedStar: |
|
(UIImage*) |
highlightedStarImage |
|
|
| |
Definition at line 81 of file DLStarRatingControl.m.
81 :(UIImage*)defaultStarImage
highlightedStar:(UIImage*)highlightedStarImage {
83 [
self setStar:defaultStarImage highlightedStar:highlightedStarImage atIndex:(int)i];
UIImage * highlightedStar
◆ setStar:highlightedStar:atIndex:()
- (void) setStar: |
|
(UIImage*) |
defaultStarImage |
highlightedStar: |
|
(UIImage*) |
highlightedStarImage |
atIndex: |
|
(int) |
index |
|
|
| |
Definition at line 87 of file DLStarRatingControl.m.
87 :(UIImage*)defaultStarImage
highlightedStar:(UIImage*)highlightedStarImage atIndex:(int)index {
91 if (!selectedStar)
return;
94 defaultStarImage = (defaultStarImage) ? defaultStarImage :
star;
95 highlightedStarImage = (highlightedStarImage) ? highlightedStarImage :
highlightedStar;
UIImage * highlightedStar
void setStarImage:highlightedStarImage:(UIImage *starImage, [highlightedStarImage] UIImage *highlightedImage)
◆ setupView()
Definition at line 25 of file DLStarRatingControl.m.
26 self.clipsToBounds = YES;
28 star = [UIImage imageNamed:@"star.png"];
32 DLStarView *v = [[
DLStarView alloc] initWithDefault:self.star highlighted:self.highlightedStar position:i allowFractions:isFractionalRatingEnabled];
UIImage * highlightedStar
◆ starForPoint:()
- (UIButton *) starForPoint: |
|
(CGPoint) |
point |
|
|
implementation |
Definition at line 103 of file DLStarRatingControl.m.
105 if (CGRectContainsPoint([
self subViewWithTag:i].frame, point)) {
106 return (UIButton*)[
self subViewWithTag:i];
◆ currentIdx
◆ numberOfStars
◆ delegate
◆ highlightedStar
- (UIImage *) highlightedStar |
|
readwritenonatomicretain |
◆ isFractionalRatingEnabled
- (BOOL) isFractionalRatingEnabled |
|
readwritenonatomicassign |
◆ rating
◆ star
The documentation for this class was generated from the following files: