File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ typedef enum {
4444@property (nonatomic , assign ) CGFloat rate;
4545@property (nonatomic , assign ) CGFloat padding;
4646@property (nonatomic , assign ) BOOL editable;
47+ @property (nonatomic , retain ) UIImage *fullStarImage;
48+ @property (nonatomic , retain ) UIImage *emptyStarImage;
4749@property (nonatomic , assign ) NSObject <DYRateViewDelegate> *delegate;
4850
4951- (DYRateView *)initWithFrame : (CGRect)frame ;
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ @implementation DYRateView
4444@synthesize alignment = _alignment;
4545@synthesize padding = _padding;
4646@synthesize editable = _editable;
47+ @synthesize fullStarImage = _fullStarImage;
48+ @synthesize emptyStarImage = _emptyStarImage;
4749@synthesize delegate = _delegate;
4850
4951- (DYRateView *)initWithFrame : (CGRect)frame {
@@ -144,6 +146,24 @@ - (void)setEditable:(BOOL)editable {
144146 self.userInteractionEnabled = _editable;
145147}
146148
149+ - (void )setFullStarImage : (UIImage *)fullStarImage
150+ {
151+ if (fullStarImage != _fullStarImage) {
152+ [_fullStarImage release ];
153+ _fullStarImage = [fullStarImage retain ];
154+ [self setNeedsDisplay ];
155+ }
156+ }
157+
158+ - (void )setEmptyStarImage : (UIImage *)emptyStarImage
159+ {
160+ if (emptyStarImage != _emptyStarImage) {
161+ [_emptyStarImage release ];
162+ _emptyStarImage = [emptyStarImage retain ];
163+ [self setNeedsDisplay ];
164+ }
165+ }
166+
147167- (void )handleTouchAtLocation : (CGPoint)location {
148168 for (int i = _numOfStars - 1 ; i > -1 ; i--) {
149169 if (location.x > _origin.x + i * (_fullStarImage.size .width + _padding) - _padding / 2 .) {
You can’t perform that action at this time.
0 commit comments